diff options
author | Angus MacArthur <amacarthur@blackberry.com> | 2013-10-04 15:11:50 -0400 |
---|---|---|
committer | Angus MacArthur <amacarthur@blackberry.com> | 2013-10-16 01:20:53 -0400 |
commit | aefe2e952f33267ce38fb9270400f4f6f194d37b (patch) | |
tree | 3546807c2b7942585a41cfb1163dc5e6a69e40e0 /spec/requests | |
parent | a8eb525e72f6883a07539af9429ccd41dbc8698b (diff) | |
download | gitlab-ce-aefe2e952f33267ce38fb9270400f4f6f194d37b.tar.gz |
Fixing unsafe use of Thread.current variable :current_user
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/issues_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/api/milestones_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/api/notes_spec.rb | 12 |
3 files changed, 36 insertions, 0 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index e9422cd2643..c55025d72b5 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -100,4 +100,16 @@ describe API::API do response.status.should == 405 end end + + describe "PUT /projects/:id/issues/:issue_id to test observer on close" do + before { enable_observers } + after { disable_observers } + + it "should create an activity event when an issue is closed" do + Event.should_receive(:create) + + put api("/projects/#{project.id}/issues/#{issue.id}", user), + state_event: "close" + end + end end diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb index e79ce083a46..febfc63921e 100644 --- a/spec/requests/api/milestones_spec.rb +++ b/spec/requests/api/milestones_spec.rb @@ -90,4 +90,16 @@ describe API::API do json_response['state'].should == 'closed' end end + + describe "PUT /projects/:id/milestones/:milestone_id to test observer on close" do + before { enable_observers } + after { disable_observers } + + it "should create an activity event when an milestone is closed" do + Event.should_receive(:create) + + put api("/projects/#{project.id}/milestones/#{milestone.id}", user), + state_event: 'close' + end + end end diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index ba18b123039..6ed96eb97f3 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -176,4 +176,16 @@ describe API::API do end end end + + describe "POST /projects/:id/noteable/:noteable_id/notes to test observer on create" do + before { enable_observers } + after { disable_observers } + + it "should create an activity event when an issue note is created" do + Event.should_receive(:create) + + post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!' + end + end + end |