Testing sign-up with minitest

190 views
Skip to first unread message

bertly_the_coder

unread,
Jun 27, 2013, 9:19:24 AM6/27/13
to minites...@googlegroups.com
Hi folks,

I'm using minitest with capybara to write my integration tests. I'm attempting to test the sign up process, where a user goes to a form, inputs their info and clicks sign-up, which will in turn save them to the db. In rspec, I could do something like this:

def test_method
  fill out form

  expect do
    click_button "Save"
  end.to change(User, :count).by(1)
end


What would be the equivalent of the expect statement in minitest, and more importantly, where can I find this information? I have gone through the docs but can't seem to find documentation that could help me get to here from them

Thanks in advance!!

Mike Moore

unread,
Jun 27, 2013, 9:30:11 AM6/27/13
to minites...@googlegroups.com
I'm working on improving the documentation for the assertions in rails and hope to cut a new release this weekend. The assertion you are looking for is assert_difference.




​This assertion comes from rails and is not something minitest-rails adds. It's documented in minitest-rails only so all the methods are documented in the same place.

The must_change and wont_change  expectations shown in the documentation will be added in the next release.

On Thu, Jun 27, 2013 at 7:19 AM, bertly_the_coder <muc...@gmail.com="mailto:muc...@gmail.com">> wrote:
Hi folks, I'm using minitest with capybara to write my integration tests. I'm attempting to test the sign up process, where a user goes to a form, inputs their info and clicks sign-up, which will in turn save them to the db. In rspec, I could do something like this: def test_method fill out form expect do click_button "Save" end.to change(User, :count).by(1) end What would be the equivalent of the expect statement in minitest, and more importantly, where can I find this information? I have gone through the docs but can't seem to find documentation that could help me get to here from them Thanks in advance!! -- -- You received this message because you are subscribed to the Google Groups minitest-rails group. To post to this group, send email to minites...@googlegroups.com. To unsubscribe from this group, send email to minitest-rail...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/minitest-rails?hl=en --- You received this message because you are subscribed to the Google Groups "minitest-rails" group. To unsubscribe from this group and stop receiving emails from it, send an email to minitest-rail...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

bertly_the_coder

unread,
Jul 1, 2013, 2:42:05 AM7/1/13
to minites...@googlegroups.com
Thank you so much! That helps a lot!!!!!
Reply all
Reply to author
Forward
0 new messages