Pat Maddox wrote:
> You can still use the technique that I showed, you would just call
> before_filter in the fake controller. That would allow you to specify
> and implement the filter in isolation.
Aha! Success, although I needed to add in a little Route fixing to make
it work.
application_spec.rb:
describe ApplicationController, "storing locations" do
class FooController < ApplicationController
before_filter :assign_var
def index; render :text => "foos"; end
end
controller_name :foo
before(:each) do
ActionController::Routing::Routes.draw do |map|
map.resources :foo
end
end
it "should assign the current user" do
get :index
assigns[:var].should_not be_blank
end
end
application.rb:
class ApplicationController < ActionController::Base
def assign_var
@var = "Quantum Leap Rocks"
end
end
Hooray.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users