Skip to content

Commit

Permalink
Remove view assertions from controller tests and other unnecessary
Browse files Browse the repository at this point in the history
macros
  • Loading branch information
joshuaclayton committed Jun 11, 2010
1 parent 5d0eae0 commit 7eb98af
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
5 changes: 4 additions & 1 deletion test/controllers/confirmations_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ class ConfirmationsControllerTest < ActionController::TestCase

should set_the_flash.to(/already confirmed/i)
should set_the_flash.to(/sign in/i)
should_not_be_signed_in
should_redirect_to_url_already_confirmed

should "not be signed in" do
assert_nil cookies[:remember_token]
end
end

context "no users" do
Expand Down
8 changes: 4 additions & 4 deletions test/controllers/passwords_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class PasswordsControllerTest < ActionController::TestCase

should respond_with(:success)
should render_template(:edit)
should_display_a_password_update_form
end

should_forbid "on GET to #edit with correct id but blank token" do
Expand Down Expand Up @@ -151,12 +150,13 @@ class PasswordsControllerTest < ActionController::TestCase
assert_not_nil @user.confirmation_token
end

should_not_be_signed_in
should "not be signed in" do
assert_nil cookies[:remember_token]
end

should_not set_the_flash
should respond_with(:success)
should render_template(:edit)

should_display_a_password_update_form
end

should_forbid "on PUT to #update with id but no token" do
Expand Down
6 changes: 2 additions & 4 deletions test/controllers/sessions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class SessionsControllerTest < ActionController::TestCase
should respond_with(:success)
should render_template(:new)
should_not set_the_flash
should_display_a_sign_in_form
end

context "on POST to #create with unconfirmed credentials" do
Expand Down Expand Up @@ -144,10 +143,9 @@ class SessionsControllerTest < ActionController::TestCase
should set_the_flash.to(/bad/i)
should respond_with(:unauthorized)
should render_template(:new)
should_not_be_signed_in

should 'not create the cookie' do
assert_nil cookies['remember_token']
should "not be signed in" do
assert_nil cookies[:remember_token]
end
end

Expand Down
9 changes: 6 additions & 3 deletions test/controllers/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class UsersControllerTest < ActionController::TestCase
should respond_with(:success)
should render_template(:new)
should_not set_the_flash

should_display_a_sign_up_form
end

context "on GET to #new with email" do
Expand Down Expand Up @@ -50,7 +48,12 @@ class UsersControllerTest < ActionController::TestCase
end
end

signed_in_user_context do
context "A signed-in user" do
setup do
@user = Factory(:email_confirmed_user)
sign_in_as @user
end

context "GET to new" do
setup { get :new }
should redirect_to("the home page") { root_url }
Expand Down

0 comments on commit 7eb98af

Please sign in to comment.