Hello there,
I working on my tests but I getting this strange errror:
I can see on the database that the object was created but I still got an failure on my test.
this is my test code:
test "should create artist" do assert_difference('Artist.count', difference = 1) do post :create, :artist => { } end assert_redirected_to artist_path(assigns(:artist)) end
and this is my failure message:
1) Failure: test_should_create_artist(ArtistsControllerTest) [/Users/bonacode/Desktop/arteacesso-br/arteacesso/vendor/rails/ activesupport/lib/active_support/testing/core_ext/test/unit/ assertions.rb:51:in `assert_difference' (eval):3:in `each_with_index' /Users/bonacode/Desktop/arteacesso-br/arteacesso/vendor/rails/ activesupport/lib/active_support/testing/core_ext/test/unit/ assertions.rb:47:in `each' /Users/bonacode/Desktop/arteacesso-br/arteacesso/vendor/rails/ activesupport/lib/active_support/testing/core_ext/test/unit/ assertions.rb:47:in `each_with_index' /Users/bonacode/Desktop/arteacesso-br/arteacesso/vendor/rails/ activesupport/lib/active_support/testing/core_ext/test/unit/ assertions.rb:47:in `assert_difference' ./test/functional/artists_controller_test.rb:16:in `test_should_create_artist' /Users/bonacode/Desktop/arteacesso-br/arteacesso/vendor/rails/ activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `__send__' /Users/bonacode/Desktop/arteacesso-br/arteacesso/vendor/rails/ activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `run']: <Artist.count> was the expression that failed. <2> expected but was <1>.
I checking the database and my use was created, I just dont't understand why is it expecting 2 if there's only one on my fixture...
thanks for any help!
Luciano