[rspec-users] can I output the html of the page after calling click_button?

Andrew Premdas apremdas at gmail.com
Fri Mar 2 11:23:44 UTC 2012


see below

On 2 March 2012 03:33, S Ahmed <sahmed1020 at gmail.com> wrote:

> I am not sure why my form submission is failing (request test).
>
> I am calling:
>
> # form is filled in a 'before do' block.
>
> it "should create an account" do
>   expect { click_button "Create" }.to change(Account, :count).by(1)
>

put a debugger statement here

  debugger
  1 # so the debugger doesn't drop into rspec

end
>
> Could I somehow view the HTML after the click_button call?
>
> Manually submitting the form works fine for me, so I'm confused.
>
>
Now you can

1) Look at the html directly e.g. > page.body
2) Output the page.body in a pretty way perhaps using Coderay
3) Use irb to do all sorts of other thing


Alternatively use capybara' save_and_open_page

HTH

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120302/23e94b78/attachment.html>


More information about the rspec-users mailing list