diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-10 15:43:27 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-10 15:43:27 +0200 |
commit | 5a2ae296fafb434e9f6a72118b02ddc1f584a9a9 (patch) | |
tree | 6953c90c06f2790c45e2ae42f4d6be9f002727a4 /spec/observers | |
parent | 5289190ce844e445c0215852dabea5c2880c10dc (diff) | |
download | gitlab-ce-5a2ae296fafb434e9f6a72118b02ddc1f584a9a9.tar.gz |
fix observer specs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/observers')
-rw-r--r-- | spec/observers/issue_observer_spec.rb | 2 | ||||
-rw-r--r-- | spec/observers/merge_request_observer_spec.rb | 2 | ||||
-rw-r--r-- | spec/observers/user_observer_spec.rb | 2 | ||||
-rw-r--r-- | spec/observers/users_group_observer_spec.rb | 2 | ||||
-rw-r--r-- | spec/observers/users_project_observer_spec.rb | 33 |
5 files changed, 17 insertions, 24 deletions
diff --git a/spec/observers/issue_observer_spec.rb b/spec/observers/issue_observer_spec.rb index 4155ff31193..9a0a2c4329c 100644 --- a/spec/observers/issue_observer_spec.rb +++ b/spec/observers/issue_observer_spec.rb @@ -9,7 +9,7 @@ describe IssueObserver do before { subject.stub(:current_user).and_return(some_user) } before { subject.stub(:current_commit).and_return(nil) } - before { subject.stub(notification: mock('NotificationService').as_null_object) } + before { subject.stub(notification: double('NotificationService').as_null_object) } before { mock_issue.project.stub_chain(:repository, :commit).and_return(nil) } subject { IssueObserver.instance } diff --git a/spec/observers/merge_request_observer_spec.rb b/spec/observers/merge_request_observer_spec.rb index 3e5cdfaf5d6..a450b4d518e 100644 --- a/spec/observers/merge_request_observer_spec.rb +++ b/spec/observers/merge_request_observer_spec.rb @@ -11,7 +11,7 @@ describe MergeRequestObserver do let(:closed_unassigned_mr) { create(:closed_merge_request, author: author, target_project: create(:project)) } before { subject.stub(:current_user).and_return(some_user) } - before { subject.stub(notification: mock('NotificationService').as_null_object) } + before { subject.stub(notification: double('NotificationService').as_null_object) } before { mr_mock.stub(:author_id) } before { mr_mock.stub(:target_project) } before { mr_mock.stub(:source_project) } diff --git a/spec/observers/user_observer_spec.rb b/spec/observers/user_observer_spec.rb index b74fceb98b1..9aeade535f9 100644 --- a/spec/observers/user_observer_spec.rb +++ b/spec/observers/user_observer_spec.rb @@ -4,7 +4,7 @@ describe UserObserver do before(:each) { enable_observers } after(:each) {disable_observers} subject { UserObserver.instance } - before { subject.stub(notification: mock('NotificationService').as_null_object) } + before { subject.stub(notification: double('NotificationService').as_null_object) } it 'calls #after_create when new users are created' do new_user = build(:user) diff --git a/spec/observers/users_group_observer_spec.rb b/spec/observers/users_group_observer_spec.rb index 65484806b19..2ab99c33b78 100644 --- a/spec/observers/users_group_observer_spec.rb +++ b/spec/observers/users_group_observer_spec.rb @@ -5,7 +5,7 @@ describe UsersGroupObserver do after(:each) { disable_observers } subject { UsersGroupObserver.instance } - before { subject.stub(notification: mock('NotificationService').as_null_object) } + before { subject.stub(notification: double('NotificationService').as_null_object) } describe "#after_create" do it "should send email to user" do diff --git a/spec/observers/users_project_observer_spec.rb b/spec/observers/users_project_observer_spec.rb index ab259e948d0..dea90b2bfa7 100644 --- a/spec/observers/users_project_observer_spec.rb +++ b/spec/observers/users_project_observer_spec.rb @@ -9,26 +9,6 @@ describe UsersProjectObserver do subject { UsersProjectObserver.instance } before { subject.stub(notification: double('NotificationService').as_null_object) } - describe "#after_commit" do - it "should called when UsersProject created" do - subject.should_receive(:after_commit) - create(:users_project) - end - - it "should send email to user" do - subject.should_receive(:notification) - Event.stub(create: true) - - create(:users_project) - end - - it "should create new event" do - Event.should_receive(:create) - - create(:users_project) - end - end - describe "#after_update" do before do @users_project = create :users_project @@ -90,5 +70,18 @@ describe UsersProjectObserver do it { File.exists?(@path).should be_false } end end + + it "should send email to user" do + subject.should_receive(:notification) + Event.stub(create: true) + + create(:users_project) + end + + it "should create new event" do + Event.should_receive(:create) + + create(:users_project) + end end end |