test/integration/app/test/functional/states_controller_test.rb in ultrasphinx-1.9 vs test/integration/app/test/functional/states_controller_test.rb in ultrasphinx-1.11
- old
+ new
@@ -23,12 +23,12 @@
get :new
assert_response :success
end
def test_should_create_state
- assert_difference('State.count') do
- post :create, :state => { }
+ assert_difference('Geo::State.count') do
+ post :create, :state => { :name => 'test', :abbreviation => 'te' }
end
assert_redirected_to state_path(assigns(:state))
end
@@ -46,12 +46,18 @@
put :update, :id => 1, :state => { }
assert_redirected_to state_path(assigns(:state))
end
def test_should_destroy_state
- assert_difference('State.count', -1) do
- delete :destroy, :id => 1
+ new_state = Geo::State.new(:name => 'test', :abbreviation => 'te')
+
+ assert_difference('Geo::State.count', +1) do
+ new_state.save
end
+ assert_difference('Geo::State.count', -1) do
+ delete :destroy, :id => new_state.id
+ end
+
assert_redirected_to states_path
end
end