This answer is probably too old to be very useful for you, but it seems to me that I like the pair.
1) This should not be an integration test, since you are not testing the interaction between several controllers. This should be a functional test that is used to test individual controllers, in this case your UserController. This is important because various methods and functions are available or loaded depending on your ad.
class UserStoriesTest < ActionDispatch::IntegrationTest
You will get a completely different environment than
class UserTest < ActiveSupport::TestCase
Note that the integration test is part of ActionDispatch, and the functional test is part of ActiveSupport. I highly recommend translating this to a functional test, and this is probably the source of your errors.
2) Using delete_all is a bit extreme. In fact, you can just run the assert test when you do your post to find out if there is a difference in the score.
assert_difference('User.count') do post :create, :user => {name: 'david', email: ' david@example.com ', password: 'qwe123', password_confirmation: 'qwe123'} end
This will claim that User.count is different from how you run what is in the do loop and after it completes. This block can replace everything that you have in your test "Register". For fun, you can change assert_difference to assert_no_difference, and if that passes, you know that something is wrong with your post method in your user_controller.rb (this is where I assume your problem actually lies).
3) The assert_equal line looks a bit strange. The last argument passed, this is the message that it will spit out on error. Listing only a number may work for one test, but it will look very strange in many tests. Something like the following, in my opinion, closer to the norm:
assert_equal 1, User.count, "Expected User.count to be equal to 1, instead it is equal to: " + User.count.to_s
Also note that you can simply use ModelName.count instead of doing something like putting all the records in an object and then calling the size of that object. It can become very dirty, very fast.
Finally, as a general debugging tool, you can throw puts statements or sign-ups everywhere to see what really happens.
puts User.count
After your delete_all and your post_via_redirect tell you very quickly what is going wrong. if you use the logger method, it will be logged in your appname / log / ENV.log. Therefore, if you use tests, it will be in test.log.
logger.debug User.count
Your logs will also store all requests, so you can read and see if you get 200 OK, 302 redirects, etc.
I suggest checking out the following guides provided by the rails, these are great starting points:
http://guides.rubyonrails.org/testing.html
http://guides.rubyonrails.org/debugging_rails_applications.html
Hope this helps someone!