Skip to content

Instantly share code, notes, and snippets.

@rtacconi
Created July 27, 2010 16:12
Show Gist options
  • Save rtacconi/492436 to your computer and use it in GitHub Desktop.
Save rtacconi/492436 to your computer and use it in GitHub Desktop.
context "should destroy participation" do
setup do
@configuration = Factory.create :configuration, :status => 'LIVE'
@p = Factory.create :participation, :configuration => @configuration
@admin = Factory.create :participant, :admin => true
login_as @admin
end
should "delete :destroy participations" do
assert_difference('Participation.count', -1) do
delete :destroy, :id => @p.to_param
end
assert_select "a", "redirected"
end
end
test "should destroy" do
@configuration = Factory.create :configuration, :status => 'LIVE'
@p = Factory.create :participation, :configuration => @configuration
@admin = Factory.create :participant, :admin => true
login_as @admin
assert_difference('Participation.count', -1) do
delete :destroy, :id => @p.to_param
end
assert_redirected_to(:controller => "configurations",
:action => "edit",
:id => @configuration.id)
assert_equal 'The host has been unassociated.', flash[:notice]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment