[rspec-users] Controller specs erroneously loading views in edge rails?
svenfuchs at artweb-design.de
Sat Aug 23 07:12:34 EDT 2008
Trying to port an existing app to current Rails edge I've seen similar
things yesterday. I've also updated RSpec/Rails to recent edge.
Here are two workarounds I've come up with for two of the problems.
I'm not sure if they cause other problems themselves, but maybe
they're still useful as a hint.
I don't feel familiar enough with RSpec's guts to provide a patch.
#render_partial on ActionView::Base seems to break because the method
signature has changed.
#render on ControllerExampleGroup seems to break because #render_file
apparently has been removed.
On 23.08.2008, at 00:30, John Reilly wrote:
> I think I may have found a bug between rspec and edge rails... But I'm
> new to this so I'm hoping someone else can confirm before I go filing
> bug reports.
> Basically, I'm seeing what "appears" to be my controller specs
> deciding to load the views, even though I haven't called
> integrate_views. When I generate a default rspec_scaffold, the specs
> fail with an ActionView::TemplateError:
>> % script/generate rspec_scaffold Bike name:string sku:string
>> rake spec
>> Mock 'Bike_1017' received unexpected message :name with (no args)
>> On line #11 of app/views/index.html.erb
> If I modify the generated index spec like this, the spec passes:
>> it "should expose all bikes as @bikes" do
>> # adding these lines cause the spec to pass...
>> get :index
>> assigns[:bikes].should == [mock_bike]
> While this "fixes" the failures, it's no longer an isolated test of
> the controller.
> After spending some time with git-bisect, it looks like this problem
> was introduced in a commit to edge rails:
> The default rspec_scaffold tests pass before this commit, and fail
> after this commit.
> More details here:
> Am I insane? Or does this happen for anyone else? :-)
> -- John Reilly
> rspec-users mailing list
> rspec-users at rubyforge.org
sven fuchs svenfuchs at artweb-design.de
artweb design http://www.artweb-design.de
grünberger 65 + 49 (0) 30 - 47 98 69 96 (phone)
d-10245 berlin + 49 (0) 171 - 35 20 38 4 (mobile)
More information about the rspec-users