diff --git a/spec/controllers/api/v1/notices_controller_spec.rb b/spec/controllers/api/v1/notices_controller_spec.rb
index 338d5db..0bd91c7 100644
--- a/spec/controllers/api/v1/notices_controller_spec.rb
+++ b/spec/controllers/api/v1/notices_controller_spec.rb
@@ -17,7 +17,7 @@ describe Api::V1::NoticesController do
it "should return JSON if JSON is requested" do
get :index, :auth_token => @user.authentication_token, :format => "json"
- lambda { JSON.load(response.body) }.should_not raise_error(JSON::ParserError)
+ expect { JSON.load(response.body) }.not_to raise_error() #JSON::ParserError)
end
it "should return XML if XML is requested" do
@@ -27,7 +27,7 @@ describe Api::V1::NoticesController do
it "should return JSON by default" do
get :index, :auth_token => @user.authentication_token
- lambda { JSON.load(response.body) }.should_not raise_error(JSON::ParserError)
+ expect { JSON.load(response.body) }.not_to raise_error() #JSON::ParserError)
end
describe "given a date range" do
diff --git a/spec/controllers/api/v1/problems_controller_spec.rb b/spec/controllers/api/v1/problems_controller_spec.rb
index f3e5e10..195cf53 100644
--- a/spec/controllers/api/v1/problems_controller_spec.rb
+++ b/spec/controllers/api/v1/problems_controller_spec.rb
@@ -19,7 +19,7 @@ describe Api::V1::ProblemsController do
it "should return JSON if JSON is requested" do
get :index, :auth_token => @user.authentication_token, :format => "json"
- lambda { JSON.load(response.body) }.should_not raise_error(JSON::ParserError)
+ expect { JSON.load(response.body) }.not_to raise_error()#JSON::ParserError)
end
it "should return XML if XML is requested" do
@@ -29,7 +29,7 @@ describe Api::V1::ProblemsController do
it "should return JSON by default" do
get :index, :auth_token => @user.authentication_token
- lambda { JSON.load(response.body) }.should_not raise_error(JSON::ParserError)
+ expect { JSON.load(response.body) }.not_to raise_error()#JSON::ParserError)
end
diff --git a/spec/controllers/notices_controller_spec.rb b/spec/controllers/notices_controller_spec.rb
index 26285ef..15df904 100644
--- a/spec/controllers/notices_controller_spec.rb
+++ b/spec/controllers/notices_controller_spec.rb
@@ -6,7 +6,7 @@ describe NoticesController do
let(:notice) { Fabricate(:notice) }
let(:xml) { Rails.root.join('spec','fixtures','hoptoad_test_notice.xml').read }
let(:app) { Fabricate(:app) }
- let(:error_report) { mock(:valid? => true, :generate_notice! => true, :notice => notice) }
+ let(:error_report) { double(:valid? => true, :generate_notice! => true, :notice => notice) }
context 'notices API' do
context "with all params" do
@@ -46,7 +46,7 @@ describe NoticesController do
response.body.should match(%r{]*>(.+)#{locate_path(notice.id)}})
end
context "with an invalid API_KEY" do
- let(:error_report) { mock(:valid? => false) }
+ let(:error_report) { double(:valid? => false) }
it 'return 422' do
post :create, :format => :xml, :data => xml
expect(response.status).to eq 422
diff --git a/spec/controllers/problems_controller_spec.rb b/spec/controllers/problems_controller_spec.rb
index c142d0b..b4e40fb 100644
--- a/spec/controllers/problems_controller_spec.rb
+++ b/spec/controllers/problems_controller_spec.rb
@@ -103,7 +103,7 @@ describe ProblemsController do
3.times { problems << Fabricate(:err).problem }
3.times { problems << Fabricate(:err, :problem => Fabricate(:problem, :resolved => true)).problem }
Problem.should_receive(:ordered_by).and_return(
- mock('proxy', :page => mock('other_proxy', :per => problems))
+ double('proxy', :page => double('other_proxy', :per => problems))
)
get :index, :all_errs => true
controller.problems.should == problems
diff --git a/spec/controllers/users/omniauth_callbacks_controller_spec.rb b/spec/controllers/users/omniauth_callbacks_controller_spec.rb
index 20c7d8d..02940fe 100644
--- a/spec/controllers/users/omniauth_callbacks_controller_spec.rb
+++ b/spec/controllers/users/omniauth_callbacks_controller_spec.rb
@@ -12,7 +12,7 @@ describe Users::OmniauthCallbacksController do
:credentials => { :token => token }
)
}
- @controller.stub!(:env).and_return(env)
+ @controller.stub(:env).and_return(env)
end
context 'Linking a GitHub account to a signed in user' do
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 57f3e16..5bcf4b4 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -207,7 +207,7 @@ describe UsersController do
context "DELETE /users/:id" do
context "with a destroy success" do
- let(:user_destroy) { mock(:destroy => true) }
+ let(:user_destroy) { double(:destroy => true) }
before {
UserDestroy.should_receive(:new).with(user).and_return(user_destroy)
diff --git a/spec/interactors/problem_destroy_spec.rb b/spec/interactors/problem_destroy_spec.rb
index 124158d..b43ace1 100644
--- a/spec/interactors/problem_destroy_spec.rb
+++ b/spec/interactors/problem_destroy_spec.rb
@@ -8,8 +8,8 @@ describe ProblemDestroy do
context "in unit way" do
let(:problem) {
problem = Problem.new
- problem.stub(:errs).and_return(mock(:criteria, :only => [err_1, err_2]))
- problem.stub(:comments).and_return(mock(:criteria, :only => [comment_1, comment_2]))
+ problem.stub(:errs).and_return(double(:criteria, :only => [err_1, err_2]))
+ problem.stub(:comments).and_return(double(:criteria, :only => [comment_1, comment_2]))
problem.stub(:delete)
problem
}
diff --git a/spec/interactors/problem_merge_spec.rb b/spec/interactors/problem_merge_spec.rb
index 6d5673d..38c2bc6 100644
--- a/spec/interactors/problem_merge_spec.rb
+++ b/spec/interactors/problem_merge_spec.rb
@@ -42,7 +42,7 @@ describe ProblemMerge do
end
it 'update problem cache' do
- ProblemUpdaterCache.should_receive(:new).with(problem).and_return(mock(:update => true))
+ ProblemUpdaterCache.should_receive(:new).with(problem).and_return(double(:update => true))
problem_merge.merge
end
diff --git a/spec/models/backtrace_spec.rb b/spec/models/backtrace_spec.rb
index c240886..3bffda3 100644
--- a/spec/models/backtrace_spec.rb
+++ b/spec/models/backtrace_spec.rb
@@ -22,8 +22,8 @@ describe Backtrace do
describe "find_or_create" do
subject { described_class.find_or_create(attributes) }
- let(:attributes) { mock :attributes }
- let(:backtrace) { mock :backtrace }
+ let(:attributes) { double :attributes }
+ let(:backtrace) { double :backtrace }
before { described_class.stub(:new => backtrace) }
@@ -37,7 +37,7 @@ describe Backtrace do
end
context "similar backtrace exist" do
- let(:similar_backtrace) { mock :similar_backtrace }
+ let(:similar_backtrace) { double :similar_backtrace }
before { backtrace.stub(:similar => similar_backtrace) }
it { should == similar_backtrace }
diff --git a/spec/models/comment_observer_spec.rb b/spec/models/comment_observer_spec.rb
index b2ec963..c9470e5 100644
--- a/spec/models/comment_observer_spec.rb
+++ b/spec/models/comment_observer_spec.rb
@@ -10,7 +10,7 @@ describe CommentObserver do
it 'should send an email notification' do
Mailer.should_receive(:comment_notification).
with(comment).
- and_return(mock('email', :deliver => true))
+ and_return(double('email', :deliver => true))
comment.save
end
end
diff --git a/spec/models/deploy_observer_spec.rb b/spec/models/deploy_observer_spec.rb
index cd7201b..a234b2a 100644
--- a/spec/models/deploy_observer_spec.rb
+++ b/spec/models/deploy_observer_spec.rb
@@ -5,7 +5,7 @@ describe DeployObserver do
context 'and the app should notify on deploys' do
it 'should send an email notification' do
Mailer.should_receive(:deploy_notification).
- and_return(mock('email', :deliver => true))
+ and_return(double('email', :deliver => true))
Fabricate(:deploy, :app => Fabricate(:app_with_watcher, :notify_on_deploys => true))
end
end
diff --git a/spec/models/issue_trackers/fogbugz_tracker_spec.rb b/spec/models/issue_trackers/fogbugz_tracker_spec.rb
index dc1bdf0..cf05288 100644
--- a/spec/models/issue_trackers/fogbugz_tracker_spec.rb
+++ b/spec/models/issue_trackers/fogbugz_tracker_spec.rb
@@ -9,7 +9,7 @@ describe IssueTrackers::FogbugzTracker do
number = 123
@issue_link = "https://#{tracker.account}.fogbugz.com/default.asp?#{number}"
response = "12345123"
- http_mock = mock
+ http_mock = double
http_mock.should_receive(:new).and_return(http_mock)
http_mock.should_receive(:request).twice.and_return(response)
Fogbugz.adapter[:http] = http_mock
diff --git a/spec/models/notice_observer_spec.rb b/spec/models/notice_observer_spec.rb
index dadf1c1..13fb5e0 100644
--- a/spec/models/notice_observer_spec.rb
+++ b/spec/models/notice_observer_spec.rb
@@ -18,7 +18,7 @@ describe NoticeObserver do
it "sends an email notification after #{threshold} notice(s)" do
@err.problem.stub(:notices_count).and_return(threshold)
Mailer.should_receive(:err_notification).
- and_return(mock('email', :deliver => true))
+ and_return(double('email', :deliver => true))
Fabricate(:notice, :err => @err)
end
end
@@ -38,7 +38,7 @@ describe NoticeObserver do
it "should send email notification after 1 notice since an error has been resolved" do
@err.problem.resolve!
Mailer.should_receive(:err_notification).
- and_return(mock('email', :deliver => true))
+ and_return(double('email', :deliver => true))
Fabricate(:notice, :err => @err)
end
end
@@ -103,7 +103,7 @@ describe NoticeObserver do
Fabricate(:notice, :err => err)
end
end
-
+
describe "should send a notification at desired intervals" do
let(:app) { Fabricate(:app, :email_at_notices => [1], :notification_service => Fabricate(:campfire_notification_service, :notify_at_notices => [1,2]))}
let(:backtrace) { Fabricate(:backtrace) }
diff --git a/spec/models/notification_service/campfire_service_spec.rb b/spec/models/notification_service/campfire_service_spec.rb
index 5f61f5c..0762e11 100644
--- a/spec/models/notification_service/campfire_service_spec.rb
+++ b/spec/models/notification_service/campfire_service_spec.rb
@@ -8,7 +8,7 @@ describe NotificationService::CampfireService do
problem = notice.problem
#campy stubbing
- campy = mock('CampfireService')
+ campy = double('CampfireService')
Campy::Room.stub(:new).and_return(campy)
campy.stub(:speak) { true }
diff --git a/spec/models/notification_service/gtalk_service_spec.rb b/spec/models/notification_service/gtalk_service_spec.rb
index 91b6469..492c4a5 100644
--- a/spec/models/notification_service/gtalk_service_spec.rb
+++ b/spec/models/notification_service/gtalk_service_spec.rb
@@ -9,7 +9,7 @@ describe NotificationService::GtalkService do
problem = notice.problem
#gtalk stubbing
- gtalk = mock('GtalkService')
+ gtalk = double('GtalkService')
jid = double("jid")
message = double("message")
Jabber::JID.should_receive(:new).with(notification_service.subdomain).and_return(jid)
@@ -19,13 +19,13 @@ describe NotificationService::GtalkService do
message_value = """#{problem.app.name.to_s}
http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}
#{notification_service.notification_description problem}"""
-
+
Jabber::Message.should_receive(:new).with(notification_service.user_id, message_value).and_return(message)
Jabber::Message.should_receive(:new).with(notification_service.room_id, message_value).and_return(message)
-
+
Jabber::MUC::SimpleMUCClient.should_receive(:new).and_return(gtalk)
gtalk.should_receive(:join).with(notification_service.room_id + "/errbit")
-
+
#assert
gtalk.should_receive(:send).exactly(2).times.with(message)
@@ -43,7 +43,7 @@ http://#{Errbit::Config.host}/apps/#{@problem.app.id.to_s}
#{@notification_service.notification_description @problem}"""
# gtalk stubbing
- @gtalk = mock('GtalkService')
+ @gtalk = double('GtalkService')
@gtalk.should_receive(:connect)
@gtalk.should_receive(:auth)
jid = double("jid")
@@ -86,7 +86,7 @@ http://#{Errbit::Config.host}/apps/#{@problem.app.id.to_s}
@notification_service.room_id = ""
@notification_service.create_notification(@problem)
end
-
+
end
it "it should send a notification to room only" do
@@ -97,7 +97,7 @@ http://#{Errbit::Config.host}/apps/#{@problem.app.id.to_s}
problem = notice.problem
#gtalk stubbing
- gtalk = mock('GtalkService')
+ gtalk = double('GtalkService')
jid = double("jid")
message = double("message")
Jabber::JID.should_receive(:new).with(notification_service.subdomain).and_return(jid)
@@ -107,11 +107,11 @@ http://#{Errbit::Config.host}/apps/#{@problem.app.id.to_s}
message_value = """#{problem.app.name.to_s}
http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s}
#{notification_service.notification_description problem}"""
-
+
Jabber::Message.should_receive(:new).with(notification_service.room_id, message_value).and_return(message)
-
+
Jabber::MUC::SimpleMUCClient.should_receive(:new).and_return(gtalk)
- gtalk.should_receive(:join).with(notification_service.room_id + "/errbit")
+ gtalk.should_receive(:join).with(notification_service.room_id + "/errbit")
notification_service.user_id = ""
diff --git a/spec/models/notification_service/hoiio_service_spec.rb b/spec/models/notification_service/hoiio_service_spec.rb
index 2eb7033..7ab0bf9 100644
--- a/spec/models/notification_service/hoiio_service_spec.rb
+++ b/spec/models/notification_service/hoiio_service_spec.rb
@@ -8,7 +8,7 @@ describe NotificationService::HoiioService do
problem = notice.problem
# hoi stubbing
- sms = mock('HoiioService')
+ sms = double('HoiioService')
Hoi::SMS.stub(:new).and_return(sms)
sms.stub(:send) { true }
diff --git a/spec/models/notification_service/pushover_service_spec.rb b/spec/models/notification_service/pushover_service_spec.rb
index 2b0b5f9..1bf419d 100644
--- a/spec/models/notification_service/pushover_service_spec.rb
+++ b/spec/models/notification_service/pushover_service_spec.rb
@@ -8,7 +8,7 @@ describe NotificationService::PushoverService do
problem = notice.problem
# hoi stubbing
- notification = mock('PushoverService')
+ notification = double('PushoverService')
Rushover::Client.stub(:new).and_return(notification)
notification.stub(:notify) { true }
diff --git a/spec/models/problem_spec.rb b/spec/models/problem_spec.rb
index 1b6cbab..3a823e6 100644
--- a/spec/models/problem_spec.rb
+++ b/spec/models/problem_spec.rb
@@ -123,12 +123,12 @@ describe Problem do
it "should throw an err if it's not successful" do
problem = Fabricate(:problem)
problem.should_not be_resolved
- problem.stub!(:valid?).and_return(false)
+ problem.stub(:valid?).and_return(false)
## update_attributes not test #valid? but #errors.any?
# https://github.com/mongoid/mongoid/blob/master/lib/mongoid/persistence.rb#L137
er = ActiveModel::Errors.new(problem)
er.add_on_blank(:resolved)
- problem.stub!(:errors).and_return(er)
+ problem.stub(:errors).and_return(er)
problem.should_not be_valid
lambda {
problem.resolve!
--
libgit2 0.21.2