[rspec-users] rspec 1.0.x and liquid?
Courtenay
court3nay at gmail.com
Tue Jun 12 06:40:59 EDT 2007
rspec thinks that response.should render_template comes AFTER the get :show
Thanks to Dylan (abcde) for this gotcha.
Also solves my should_redirect problems :)
On 6/12/07, Courtenay <court3nay at gmail.com> wrote:
> Is anyone else using liquid with the > 1 rspec? This seems to fail:
>
>
> it 'should render show' do
> response.should render_template('buyers/show')
> get :show, :id => 1
> end
>
>
> with an error like
>
> 1)
> NoMethodError in '/buyer GET should render show'
> You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.first_render
> /rails/store/trunk/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/render_template.rb:12:in
> `matches?'
> spec/controllers/buyer_controller_spec.rb:57:
> spec/controllers/buyer_controller_spec.rb:63:
>
>
> should render_template is looking for
>
> 11: def matches?(response)
> 12: @actual = response.rendered_file(!expected.include?('/'))
> 13: actual == expected
> 14: end
>
>
> TestResponse.rendered_file looks like
>
> 208: def rendered_file(with_controller=false)
> 209: unless template.first_render.nil?
> 210: unless with_controller
> 211: template.first_render
>
>
> so TestResponse is missing 'template'. Any clues?
>
>
>
> Courtenay
>
> http://blog.caboo.se
> http://entp.com
>
More information about the rspec-users
mailing list