Created
December 29, 2010 00:50
-
-
Save jperrine/757975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# works | |
context "POST edit_subscriptions" do | |
setup do | |
fake_login | |
@user.subscriptions << Factory(:subscription) | |
@user.reminder_preferences << Factory(:reminder_preference) | |
post :edit_subscriptions, :params => {:commit => "Unsubscribe", :action => "edit_subscriptions", :id => @user.id, :controller => "users", | |
"#{@user.reminder_preferences.first.id}_email" => "on"} | |
assert_equal @user.reminder_preferences, [] | |
should respond_with :redirect | |
should render_template :unsubscribe | |
end | |
end | |
# doesn't | |
context "POST edit_subscriptions" do | |
setup do | |
fake_login | |
@user.subscriptions << Factory(:subscription) | |
@user.reminder_preferences << Factory(:reminder_preference) | |
post :edit_subscriptions, :params => {:commit => "Unsubscribe", :action => "edit_subscriptions", :id => @user.id, :controller => "users", | |
"#{@user.reminder_preferences.first.id}_email" => "on"} | |
assert_equal @user.reminder_preferences, [] | |
end | |
should respond_with :redirect | |
should render_template :unsubscribe | |
end | |
# this also works | |
context "GET unsubscribe" do | |
setup do | |
fake_login | |
get :unsubscribe, :id => @user.to_param | |
end | |
should render_template :unsubscribe | |
should respond_with :success | |
should assign_to :subscriptions | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment