[rspec-users] RSpec Controller Testing - render_templte Issue
Curtis j Schofield
curtis.schofield at gmail.com
Mon Jul 12 13:02:56 EDT 2010
On Mon, Jul 12, 2010 at 9:44 AM, Rails Learner <lists at ruby-forum.com> wrote:
> Hi!
>
> I am writing controller specs and getting a weird expectation failure.
> Here is the example. Please read the comments for details:
>
> it 'renders children/_show partial' do
> post :create, :child => @child
>
> # The line "response.should render_template('children/_show')"
> gives
> # me error:
> # ChildrenController when the enrollment form data is valid
> renders
> # children/_show partial' FAILED
> # expected "children/_show", got
> "children/_show_print_layout.html.erb"
> response.should render_template('children/_show')
>
>
> # This is weird. _show partial contains a button 'Print Form' and
> next #assertion passes, but the one above fails.
> response.should have_selector( 'input',
> :type => 'submit',
> :value => 'Print Form' )
> response.should be_success
> end
>
> Many Thanks!
Please include your controller code for create! :d
--
Make Haste Slowly
More information about the rspec-users
mailing list