Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhall <kevinmichaelhall@gmail.com>2014-08-25 22:10:23 +0400
committerkhall <kevinmichaelhall@gmail.com>2014-08-27 04:10:26 +0400
commitc42916df279e23cdc5715885977709502412978a (patch)
tree9b243550a971862eab44dea8615dab032c7d2615 /spec/workers
parent027bb9fcb0000c2b7fc883e78179af7d8f4a5e28 (diff)
Two tests failing after rspec 2.99 => 3.0.0
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/delete_account_spec.rb4
-rw-r--r--spec/workers/delete_post_from_service_spec.rb4
-rw-r--r--spec/workers/fetch_profile_photo_spec.rb32
-rw-r--r--spec/workers/gather_o_embed_data_spec.rb10
-rw-r--r--spec/workers/gather_open_graph_data_spec.rb18
-rw-r--r--spec/workers/http_multi_spec.rb24
-rw-r--r--spec/workers/mail/invite_email_spec.rb4
-rw-r--r--spec/workers/mail/mentioned_spec.rb4
-rw-r--r--spec/workers/mail/private_message_spec.rb4
-rw-r--r--spec/workers/mail/reshared_spec.rb4
-rw-r--r--spec/workers/notify_local_users_spec.rb4
-rw-r--r--spec/workers/post_to_service_spec.rb6
-rw-r--r--spec/workers/process_photo_spec.rb14
-rw-r--r--spec/workers/publish_to_hub_spec.rb4
-rw-r--r--spec/workers/receive_salmon_spec.rb6
-rw-r--r--spec/workers/receive_spec.rb6
-rw-r--r--spec/workers/resend_invitation_spec.rb4
-rw-r--r--spec/workers/reset_password_spec.rb4
18 files changed, 78 insertions, 78 deletions
diff --git a/spec/workers/delete_account_spec.rb b/spec/workers/delete_account_spec.rb
index 5f374cfd3..dd604f7d8 100644
--- a/spec/workers/delete_account_spec.rb
+++ b/spec/workers/delete_account_spec.rb
@@ -8,8 +8,8 @@ describe Workers::DeleteAccount do
describe '#perform' do
it 'performs the account deletion' do
account_deletion = double
- AccountDeletion.stub(:find).and_return(account_deletion)
- account_deletion.should_receive(:perform!)
+ allow(AccountDeletion).to receive(:find).and_return(account_deletion)
+ expect(account_deletion).to receive(:perform!)
Workers::DeleteAccount.new.perform(1)
end
diff --git a/spec/workers/delete_post_from_service_spec.rb b/spec/workers/delete_post_from_service_spec.rb
index b941335c1..75e902034 100644
--- a/spec/workers/delete_post_from_service_spec.rb
+++ b/spec/workers/delete_post_from_service_spec.rb
@@ -9,8 +9,8 @@ describe Workers::DeletePostFromService do
it 'calls service#delete_post with given service' do
m = double()
url = "foobar"
- m.should_receive(:delete_post)
- Service.stub(:find_by_id).and_return(m)
+ expect(m).to receive(:delete_post)
+ allow(Service).to receive(:find_by_id).and_return(m)
Workers::DeletePostFromService.new.perform("123", @post.id.to_s)
end
end
diff --git a/spec/workers/fetch_profile_photo_spec.rb b/spec/workers/fetch_profile_photo_spec.rb
index 24afa1d70..0b118ce7e 100644
--- a/spec/workers/fetch_profile_photo_spec.rb
+++ b/spec/workers/fetch_profile_photo_spec.rb
@@ -7,36 +7,36 @@ describe Workers::FetchProfilePhoto do
@url = "https://service.com/user/profile_image"
- @service.stub(:profile_photo_url).and_return(@url)
- @user.stub(:update_profile)
+ allow(@service).to receive(:profile_photo_url).and_return(@url)
+ allow(@user).to receive(:update_profile)
- User.stub(:find).and_return(@user)
- Service.stub(:find).and_return(@service)
+ allow(User).to receive(:find).and_return(@user)
+ allow(Service).to receive(:find).and_return(@service)
@photo_double = double
- @photo_double.stub(:save!).and_return(true)
- @photo_double.stub(:url).and_return("image.jpg")
+ allow(@photo_double).to receive(:save!).and_return(true)
+ allow(@photo_double).to receive(:url).and_return("image.jpg")
end
it 'saves the profile image' do
- @photo_double.should_receive(:save!).and_return(true)
- Photo.should_receive(:diaspora_initialize).with(hash_including(:author => @user.person, :image_url => @url, :pending => true)).and_return(@photo_double)
+ expect(@photo_double).to receive(:save!).and_return(true)
+ expect(Photo).to receive(:diaspora_initialize).with(hash_including(:author => @user.person, :image_url => @url, :pending => true)).and_return(@photo_double)
Workers::FetchProfilePhoto.new.perform(@user.id, @service.id)
end
context "service does not have a profile_photo_url" do
it "does nothing without fallback" do
- @service.stub(:profile_photo_url).and_return(nil)
- Photo.should_not_receive(:diaspora_initialize)
+ allow(@service).to receive(:profile_photo_url).and_return(nil)
+ expect(Photo).not_to receive(:diaspora_initialize)
Workers::FetchProfilePhoto.new.perform(@user.id, @service.id)
end
it "fetches fallback if it's provided" do
- @photo_double.should_receive(:save!).and_return(true)
- @service.stub(:profile_photo_url).and_return(nil)
- Photo.should_receive(:diaspora_initialize).with(hash_including(:author => @user.person, :image_url => "https://service.com/fallback_lowres.jpg", :pending => true)).and_return(@photo_double)
+ expect(@photo_double).to receive(:save!).and_return(true)
+ allow(@service).to receive(:profile_photo_url).and_return(nil)
+ expect(Photo).to receive(:diaspora_initialize).with(hash_including(:author => @user.person, :image_url => "https://service.com/fallback_lowres.jpg", :pending => true)).and_return(@photo_double)
Workers::FetchProfilePhoto.new.perform(@user.id, @service.id, "https://service.com/fallback_lowres.jpg")
end
@@ -44,10 +44,10 @@ describe Workers::FetchProfilePhoto do
it 'updates the profile' do
- @photo_double.stub(:url).and_return("large.jpg", "medium.jpg", "small.jpg")
+ allow(@photo_double).to receive(:url).and_return("large.jpg", "medium.jpg", "small.jpg")
- Photo.should_receive(:diaspora_initialize).and_return(@photo_double)
- @user.should_receive(:update_profile).with(hash_including({
+ expect(Photo).to receive(:diaspora_initialize).and_return(@photo_double)
+ expect(@user).to receive(:update_profile).with(hash_including({
:image_url => "large.jpg",
:image_url_medium => "medium.jpg",
:image_url_small => "small.jpg"
diff --git a/spec/workers/gather_o_embed_data_spec.rb b/spec/workers/gather_o_embed_data_spec.rb
index 1593ed4e0..97177d7de 100644
--- a/spec/workers/gather_o_embed_data_spec.rb
+++ b/spec/workers/gather_o_embed_data_spec.rb
@@ -32,7 +32,7 @@ describe Workers::GatherOEmbedData do
it 'requests not data from the internet' do
Workers::GatherOEmbedData.new.perform(@status_message.id, @flickr_photo_url)
- a_request(:get, @flickr_oembed_get_request).should have_been_made
+ expect(a_request(:get, @flickr_oembed_get_request)).to have_been_made
end
it 'requests not data from the internet only once' do
@@ -40,7 +40,7 @@ describe Workers::GatherOEmbedData do
Workers::GatherOEmbedData.new.perform(@status_message.id, @flickr_photo_url)
end
- a_request(:get, @flickr_oembed_get_request).should have_been_made.times(1)
+ expect(a_request(:get, @flickr_oembed_get_request)).to have_been_made.times(1)
end
it 'creates one cache entry' do
@@ -48,16 +48,16 @@ describe Workers::GatherOEmbedData do
expected_data = @flickr_oembed_data
expected_data['trusted_endpoint_url'] = @flickr_oembed_url
- OEmbedCache.find_by_url(@flickr_photo_url).data.should == expected_data
+ expect(OEmbedCache.find_by_url(@flickr_photo_url).data).to eq(expected_data)
Workers::GatherOEmbedData.new.perform(@status_message.id, @flickr_photo_url)
- OEmbedCache.where(url: @flickr_photo_url).count.should == 1
+ expect(OEmbedCache.where(url: @flickr_photo_url).count).to eq(1)
end
it 'creates no cache entry for unsupported pages' do
Workers::GatherOEmbedData.new.perform(@status_message.id, @no_oembed_url)
- OEmbedCache.find_by_url(@no_oembed_url).should be_nil
+ expect(OEmbedCache.find_by_url(@no_oembed_url)).to be_nil
end
it 'gracefully handles a deleted post' do
diff --git a/spec/workers/gather_open_graph_data_spec.rb b/spec/workers/gather_open_graph_data_spec.rb
index dbe53ff81..7c2397e4f 100644
--- a/spec/workers/gather_open_graph_data_spec.rb
+++ b/spec/workers/gather_open_graph_data_spec.rb
@@ -28,7 +28,7 @@ describe Workers::GatherOpenGraphData do
it 'requests not data from the internet' do
Workers::GatherOpenGraphData.new.perform(@status_message.id, @ogsite_url)
- a_request(:get, @ogsite_url).should have_been_made
+ expect(a_request(:get, @ogsite_url)).to have_been_made
end
it 'requests not data from the internet only once' do
@@ -36,7 +36,7 @@ describe Workers::GatherOpenGraphData do
Workers::GatherOpenGraphData.new.perform(@status_message.id, @ogsite_url)
end
- a_request(:get, @ogsite_url).should have_been_made.times(1)
+ expect(a_request(:get, @ogsite_url)).to have_been_made.times(1)
end
it 'creates one cache entry' do
@@ -44,20 +44,20 @@ describe Workers::GatherOpenGraphData do
ogc = OpenGraphCache.find_by_url(@ogsite_url)
- ogc.title.should == @ogsite_title
- ogc.ob_type.should == @ogsite_type
- ogc.image.should == @ogsite_url + @ogsite_image
- ogc.url.should == @ogsite_url
- ogc.description.should == @ogsite_description
+ expect(ogc.title).to eq(@ogsite_title)
+ expect(ogc.ob_type).to eq(@ogsite_type)
+ expect(ogc.image).to eq(@ogsite_url + @ogsite_image)
+ expect(ogc.url).to eq(@ogsite_url)
+ expect(ogc.description).to eq(@ogsite_description)
Workers::GatherOpenGraphData.new.perform(@status_message.id, @ogsite_url)
- OpenGraphCache.where(url: @ogsite_url).count.should == 1
+ expect(OpenGraphCache.where(url: @ogsite_url).count).to eq(1)
end
it 'creates no cache entry for unsupported pages' do
Workers::GatherOpenGraphData.new.perform(@status_message.id, @no_open_graph_url)
- OpenGraphCache.find_by_url(@no_open_graph_url).should be_nil
+ expect(OpenGraphCache.find_by_url(@no_open_graph_url)).to be_nil
end
it 'gracefully handles a deleted post' do
diff --git a/spec/workers/http_multi_spec.rb b/spec/workers/http_multi_spec.rb
index b78088e8f..05e70d2f2 100644
--- a/spec/workers/http_multi_spec.rb
+++ b/spec/workers/http_multi_spec.rb
@@ -16,11 +16,11 @@ describe Workers::HttpMulti do
@post_xml = Base64.encode64 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH"
@hydra = Typhoeus::Hydra.new
- Typhoeus::Hydra.stub(:new).and_return(@hydra)
+ allow(Typhoeus::Hydra).to receive(:new).and_return(@hydra)
@salmon = Salmon::EncryptedSlap.create_by_user_and_activity bob, Base64.decode64(@post_xml)
- Salmon::EncryptedSlap.stub(:create_by_user_and_activity).and_return @salmon
+ allow(Salmon::EncryptedSlap).to receive(:create_by_user_and_activity).and_return @salmon
@body = "encrypted things"
- @salmon.stub(:xml_for).and_return @body
+ allow(@salmon).to receive(:xml_for).and_return @body
@response = Typhoeus::Response.new(
code: 200,
@@ -57,8 +57,8 @@ describe Workers::HttpMulti do
Typhoeus.stub(person.receive_url).and_return @response
end
- @hydra.should_receive(:queue).twice
- @hydra.should_receive(:run).once
+ expect(@hydra).to receive(:queue).twice
+ expect(@hydra).to receive(:run).once
Workers::HttpMulti.new.perform bob.id, @post_xml, @people.map(&:id), "Postzord::Dispatcher::Private"
end
@@ -68,7 +68,7 @@ describe Workers::HttpMulti do
Typhoeus.stub(person.receive_url).and_return @failed_response
- Workers::HttpMulti.should_receive(:perform_in).with(1.hour, bob.id, @post_xml, [person.id], anything, 1).once
+ expect(Workers::HttpMulti).to receive(:perform_in).with(1.hour, bob.id, @post_xml, [person.id], anything, 1).once
Workers::HttpMulti.new.perform bob.id, @post_xml, [person.id], "Postzord::Dispatcher::Private"
end
@@ -77,7 +77,7 @@ describe Workers::HttpMulti do
Typhoeus.stub(person.receive_url).and_return @unable_to_resolve_response
- Workers::HttpMulti.should_receive(:perform_in).with(1.hour, bob.id, @post_xml, [person.id], anything, 1).once
+ expect(Workers::HttpMulti).to receive(:perform_in).with(1.hour, bob.id, @post_xml, [person.id], anything, 1).once
Workers::HttpMulti.new.perform bob.id, @post_xml, [person.id], "Postzord::Dispatcher::Private"
end
@@ -86,7 +86,7 @@ describe Workers::HttpMulti do
Typhoeus.stub(person.receive_url).and_return @ssl_error_response
- Workers::HttpMulti.should_not_receive(:perform_in)
+ expect(Workers::HttpMulti).not_to receive(:perform_in)
Workers::HttpMulti.new.perform bob.id, @post_xml, [person.id], "Postzord::Dispatcher::Private"
end
@@ -95,7 +95,7 @@ describe Workers::HttpMulti do
Typhoeus.stub(person.receive_url).and_return @failed_response
- Workers::HttpMulti.should_not_receive :perform_in
+ expect(Workers::HttpMulti).not_to receive :perform_in
Workers::HttpMulti.new.perform bob.id, @post_xml, [person.id], "Postzord::Dispatcher::Private", 3
end
@@ -103,7 +103,7 @@ describe Workers::HttpMulti do
person = @people.first
Typhoeus.stub(person.receive_url).and_return @response
- @salmon.should_receive(:xml_for).and_return @body
+ expect(@salmon).to receive(:xml_for).and_return @body
Workers::HttpMulti.new.perform bob.id, @post_xml, [person.id], "Postzord::Dispatcher::Private"
end
@@ -124,7 +124,7 @@ describe Workers::HttpMulti do
Workers::HttpMulti.new.perform bob.id, @post_xml, [person.id], "Postzord::Dispatcher::Private"
person.reload
- person.url.should == "https://remote.net/"
+ expect(person.url).to eq("https://remote.net/")
end
it 'only sends to users with valid RSA keys' do
@@ -138,7 +138,7 @@ describe Workers::HttpMulti do
Typhoeus.stub(person.receive_url).and_return @response
Typhoeus.stub(@people[1].receive_url).and_return @response
- @hydra.should_receive(:queue).once
+ expect(@hydra).to receive(:queue).once
Workers::HttpMulti.new.perform bob.id, @post_xml, @people.map(&:id), "Postzord::Dispatcher::Private"
end
end
diff --git a/spec/workers/mail/invite_email_spec.rb b/spec/workers/mail/invite_email_spec.rb
index ca0a2d6e2..6c94460e9 100644
--- a/spec/workers/mail/invite_email_spec.rb
+++ b/spec/workers/mail/invite_email_spec.rb
@@ -6,9 +6,9 @@ describe Workers::Mail::InviteEmail do
let(:email_inviter) { double('EmailInviter') }
it 'creates a new email inviter' do
- EmailInviter.should_receive(:new).with(emails, alice, message: message)
+ expect(EmailInviter).to receive(:new).with(emails, alice, message: message)
.and_return(email_inviter)
- email_inviter.should_receive(:send!)
+ expect(email_inviter).to receive(:send!)
Workers::Mail::InviteEmail.new.perform(emails, alice, message: message)
end
end
diff --git a/spec/workers/mail/mentioned_spec.rb b/spec/workers/mail/mentioned_spec.rb
index 332f8cdda..ac7e787b2 100644
--- a/spec/workers/mail/mentioned_spec.rb
+++ b/spec/workers/mail/mentioned_spec.rb
@@ -12,8 +12,8 @@ describe Workers::Mail::Mentioned do
m = Mention.new(:person => user.person, :post=> sm)
mail_double = double()
- mail_double.should_receive(:deliver)
- Notifier.should_receive(:mentioned).with(user.id, sm.author.id, m.id).and_return(mail_double)
+ expect(mail_double).to receive(:deliver)
+ expect(Notifier).to receive(:mentioned).with(user.id, sm.author.id, m.id).and_return(mail_double)
Workers::Mail::Mentioned.new.perform(user.id, sm.author.id, m.id)
end
diff --git a/spec/workers/mail/private_message_spec.rb b/spec/workers/mail/private_message_spec.rb
index 3fa271342..9ee1c0fbf 100644
--- a/spec/workers/mail/private_message_spec.rb
+++ b/spec/workers/mail/private_message_spec.rb
@@ -18,8 +18,8 @@ describe Workers::Mail::PrivateMessage do
message = cnv.messages.first
mail_double = double()
- mail_double.should_receive(:deliver)
- Notifier.should_receive(:mentioned).with(user2.id, user1.person.id, message.id).and_return(mail_double)
+ expect(mail_double).to receive(:deliver)
+ expect(Notifier).to receive(:mentioned).with(user2.id, user1.person.id, message.id).and_return(mail_double)
Workers::Mail::Mentioned.new.perform(user2.id, user1.person.id, message.id)
end
diff --git a/spec/workers/mail/reshared_spec.rb b/spec/workers/mail/reshared_spec.rb
index 478cd5a96..016d75b43 100644
--- a/spec/workers/mail/reshared_spec.rb
+++ b/spec/workers/mail/reshared_spec.rb
@@ -11,8 +11,8 @@ describe Workers::Mail::Reshared do
reshare = FactoryGirl.build(:reshare, :author => alice.person, :root=> sm)
mail_double = double()
- mail_double.should_receive(:deliver)
- Notifier.should_receive(:reshared).with(bob.id, reshare.author.id, reshare.id).and_return(mail_double)
+ expect(mail_double).to receive(:deliver)
+ expect(Notifier).to receive(:reshared).with(bob.id, reshare.author.id, reshare.id).and_return(mail_double)
Workers::Mail::Reshared.new.perform(bob.id, reshare.author.id, reshare.id)
end
diff --git a/spec/workers/notify_local_users_spec.rb b/spec/workers/notify_local_users_spec.rb
index b058d0f77..6f89e1ed5 100644
--- a/spec/workers/notify_local_users_spec.rb
+++ b/spec/workers/notify_local_users_spec.rb
@@ -10,9 +10,9 @@ describe Workers::NotifyLocalUsers do
person = FactoryGirl.create :person
post = FactoryGirl.create :status_message
- StatusMessage.should_receive(:find_by_id).with(post.id).and_return(post)
+ expect(StatusMessage).to receive(:find_by_id).with(post.id).and_return(post)
#User.should_receive(:where).and_return([alice, eve])
- Notification.should_receive(:notify).with(instance_of(User), instance_of(StatusMessage), instance_of(Person)).twice
+ expect(Notification).to receive(:notify).with(instance_of(User), instance_of(StatusMessage), instance_of(Person)).twice
Workers::NotifyLocalUsers.new.perform([alice.id, eve.id], post.class.to_s, post.id, person.id)
end
diff --git a/spec/workers/post_to_service_spec.rb b/spec/workers/post_to_service_spec.rb
index 4ba8c4767..e75578079 100644
--- a/spec/workers/post_to_service_spec.rb
+++ b/spec/workers/post_to_service_spec.rb
@@ -5,11 +5,11 @@ describe Workers::PostToService do
user = alice
aspect = user.aspects.create(:name => "yeah")
post = user.post(:status_message, :text => 'foo', :to => aspect.id)
- User.stub(:find_by_id).with(user.id.to_s).and_return(user)
+ allow(User).to receive(:find_by_id).with(user.id.to_s).and_return(user)
m = double()
url = "foobar"
- m.should_receive(:post).with(anything, url)
- Service.stub(:find_by_id).and_return(m)
+ expect(m).to receive(:post).with(anything, url)
+ allow(Service).to receive(:find_by_id).and_return(m)
Workers::PostToService.new.perform("123", post.id.to_s, url)
end
end
diff --git a/spec/workers/process_photo_spec.rb b/spec/workers/process_photo_spec.rb
index 5b07b4316..8294902ca 100644
--- a/spec/workers/process_photo_spec.rb
+++ b/spec/workers/process_photo_spec.rb
@@ -12,14 +12,14 @@ describe Workers::ProcessPhoto do
end
it 'saves the processed image' do
- @saved_photo.processed_image.path.should be_nil
+ expect(@saved_photo.processed_image.path).to be_nil
result = Workers::ProcessPhoto.new.perform(@saved_photo.id)
@saved_photo.reload
- @saved_photo.processed_image.path.should_not be_nil
- result.should be true
+ expect(@saved_photo.processed_image.path).not_to be_nil
+ expect(result).to be true
end
context 'when trying to process a photo that has already been processed' do
@@ -35,8 +35,8 @@ describe Workers::ProcessPhoto do
@saved_photo.reload
- @saved_photo.processed_image.path.should == processed_image_path
- result.should be false
+ expect(@saved_photo.processed_image.path).to eq(processed_image_path)
+ expect(result).to be false
end
end
@@ -50,8 +50,8 @@ describe Workers::ProcessPhoto do
it 'does not process the gif' do
result = Workers::ProcessPhoto.new.perform(@saved_gif.id)
- @saved_gif.reload.processed_image.path.should be_nil
- result.should be false
+ expect(@saved_gif.reload.processed_image.path).to be_nil
+ expect(result).to be false
end
end
diff --git a/spec/workers/publish_to_hub_spec.rb b/spec/workers/publish_to_hub_spec.rb
index 47cb4a9a4..d864ae2c9 100644
--- a/spec/workers/publish_to_hub_spec.rb
+++ b/spec/workers/publish_to_hub_spec.rb
@@ -10,8 +10,8 @@ describe Workers::PublishToHub do
url = "http://publiczone.com/"
m = double()
- m.should_receive(:publish).with(url+'.atom')
- Pubsubhubbub.should_receive(:new).with(AppConfig.environment.pubsub_server).and_return(m)
+ expect(m).to receive(:publish).with(url+'.atom')
+ expect(Pubsubhubbub).to receive(:new).with(AppConfig.environment.pubsub_server).and_return(m)
Workers::PublishToHub.new.perform(url)
end
end
diff --git a/spec/workers/receive_salmon_spec.rb b/spec/workers/receive_salmon_spec.rb
index 84e598e33..a57bc6fbc 100644
--- a/spec/workers/receive_salmon_spec.rb
+++ b/spec/workers/receive_salmon_spec.rb
@@ -4,7 +4,7 @@ describe Workers::ReceiveEncryptedSalmon do
before do
@user = alice
@xml = '<xml></xml>'
- User.stub(:find){ |id|
+ allow(User).to receive(:find){ |id|
if id == @user.id
@user
else
@@ -15,8 +15,8 @@ describe Workers::ReceiveEncryptedSalmon do
it 'calls receive_salmon' do
zord = double
- zord.should_receive(:perform!)
- Postzord::Receiver::Private.should_receive(:new).with(@user, hash_including(:salmon_xml => @xml)).and_return(zord)
+ expect(zord).to receive(:perform!)
+ expect(Postzord::Receiver::Private).to receive(:new).with(@user, hash_including(:salmon_xml => @xml)).and_return(zord)
Workers::ReceiveEncryptedSalmon.new.perform(@user.id, @xml)
end
diff --git a/spec/workers/receive_spec.rb b/spec/workers/receive_spec.rb
index dda95c890..0ee0b0a53 100644
--- a/spec/workers/receive_spec.rb
+++ b/spec/workers/receive_spec.rb
@@ -5,7 +5,7 @@ describe Workers::Receive do
@user = alice
@person = FactoryGirl.create(:person)
@xml = '<xml></xml>'
- User.stub(:find){ |id|
+ allow(User).to receive(:find){ |id|
if id == @user.id
@user
else
@@ -16,8 +16,8 @@ describe Workers::Receive do
it 'calls receive' do
zord_double = double()
- zord_double.should_receive(:parse_and_receive).with(@xml)
- Postzord::Receiver::Private.should_receive(:new).with(@user, anything).and_return(zord_double)
+ expect(zord_double).to receive(:parse_and_receive).with(@xml)
+ expect(Postzord::Receiver::Private).to receive(:new).with(@user, anything).and_return(zord_double)
Workers::Receive.new.perform(@user.id, @xml, @person.id)
end
end
diff --git a/spec/workers/resend_invitation_spec.rb b/spec/workers/resend_invitation_spec.rb
index a0e0afd33..002cf78a5 100644
--- a/spec/workers/resend_invitation_spec.rb
+++ b/spec/workers/resend_invitation_spec.rb
@@ -9,8 +9,8 @@ describe Workers::ResendInvitation do
it 'should call .resend on the object' do
invite = FactoryGirl.build(:invitation, :service => 'email', :identifier => 'foo@bar.com')
- Invitation.stub(:find).and_return(invite)
- invite.should_receive(:resend)
+ allow(Invitation).to receive(:find).and_return(invite)
+ expect(invite).to receive(:resend)
Workers::ResendInvitation.new.perform(invite.id)
end
end
diff --git a/spec/workers/reset_password_spec.rb b/spec/workers/reset_password_spec.rb
index eed8697d7..f0f393f75 100644
--- a/spec/workers/reset_password_spec.rb
+++ b/spec/workers/reset_password_spec.rb
@@ -11,8 +11,8 @@ describe Workers::ResetPassword do
it "correctly sets the message parameters" do
Workers::ResetPassword.new.perform(alice.id)
mail = Devise.mailer.deliveries.last
- mail.to.should == [alice.email]
- mail.body.should include("change your password")
+ expect(mail.to).to eq([alice.email])
+ expect(mail.body).to include("change your password")
end
end
end