Permalink
Browse files

update to rspec expect syntax

  • Loading branch information...
1 parent da3a27e commit 217ab35a1d86e45ad74b72754cb40116d2e15b49 @twalpole twalpole committed Jun 5, 2014
Showing with 42 additions and 42 deletions.
  1. +32 −32 spec/email/driver_spec.rb
  2. +10 −10 spec/node/email_spec.rb
@@ -17,41 +17,41 @@ def self.call(env)
open_email('test@example.com')
current_email.click_link 'example'
- page.should have_content 'Hello world!'
- current_email.should have_content 'This is only a html test'
+ expect(page).to have_content 'Hello world!'
+ expect(current_email).to have_content 'This is only a html test'
- all_emails.first.should eq email
+ expect(all_emails.first).to eq email
clear_emails
- all_emails.should be_empty
+ expect(all_emails).to be_empty
end
scenario 'html email follows links' do
email = deliver(html_email)
open_email('test@example.com')
current_email.click_link 'example'
- page.current_url.should eq('http://example.com/')
+ expect(page.current_url).to eq('http://example.com/')
current_email.click_link 'another example'
- page.current_url.should eq('http://example.com:1234/')
+ expect(page.current_url).to eq('http://example.com:1234/')
current_email.click_link 'yet another example'
- page.current_url.should eq('http://example.com:1234/some/path?foo=bar')
+ expect(page.current_url).to eq('http://example.com:1234/some/path?foo=bar')
end
scenario 'plain text email' do
email = deliver(plain_email)
open_email('test@example.com')
current_email.click_link 'http://example.com'
- page.should have_content 'Hello world!'
- current_email.should have_content 'This is only a plain test.'
+ expect(page).to have_content 'Hello world!'
+ expect(current_email).to have_content 'This is only a plain test.'
- all_emails.first.should eq email
+ expect(all_emails.first).to eq email
clear_emails
- all_emails.should be_empty
+ expect(all_emails).to be_empty
end
# should read html_part
@@ -60,19 +60,19 @@ def self.call(env)
open_email('test@example.com')
current_email.click_link 'example'
- page.should have_content 'Hello world!'
- current_email.should have_content 'This is only a html test'
+ expect(page).to have_content 'Hello world!'
+ expect(current_email).to have_content 'This is only a html test'
- all_emails.first.should eq email
+ expect(all_emails.first).to eq email
clear_emails
- all_emails.should be_empty
+ expect(all_emails).to be_empty
end
it 'delegates to base' do
email = deliver(plain_email)
open_email('test@example.com')
- current_email.subject.should eq 'Test Email'
+ expect(current_email.subject).to eq 'Test Email'
end
# should read html_part
@@ -81,13 +81,13 @@ def self.call(env)
open_email('test@example.com')
current_email.click_link 'example'
- page.should have_content 'Hello world!'
- current_email.should have_content 'This is only a html test'
+ expect(page).to have_content 'Hello world!'
+ expect(current_email).to have_content 'This is only a html test'
- all_emails.first.should eq email
+ expect(all_emails.first).to eq email
clear_emails
- all_emails.should be_empty
+ expect(all_emails).to be_empty
end
# should read html_part
@@ -96,56 +96,56 @@ def self.call(env)
open_email('test@example.com')
current_email.click_link 'example'
- page.should have_content 'Hello world!'
- current_email.should have_content 'This is only a html test'
+ expect(page).to have_content 'Hello world!'
+ expect(current_email).to have_content 'This is only a html test'
- all_emails.first.should eq email
+ expect(all_emails.first).to eq email
clear_emails
- all_emails.should be_empty
+ expect(all_emails).to be_empty
end
scenario 'email content matchers' do
email = deliver(multipart_email)
open_email('test@example.com')
- current_email.should have_link('another example', :href => 'http://example.com:1234')
+ expect(current_email).to have_link('another example', :href => 'http://example.com:1234')
end
scenario 'via ActionMailer' do
email = deliver(plain_email)
- all_emails.first.should eq email
+ expect(all_emails.first).to eq email
clear_emails
- all_emails.should be_empty
+ expect(all_emails).to be_empty
end
scenario 'via Mail' do
email = plain_email.deliver!
- all_emails.first.should eq email
+ expect(all_emails.first).to eq email
clear_emails
- all_emails.should be_empty
+ expect(all_emails).to be_empty
end
scenario 'multiple emails' do
deliver(plain_email)
deliver(Mail::Message.new(:to => 'test@example.com', :body => 'New Message', :context => 'text/plain'))
open_email('test@example.com')
- current_email.body.should eq 'New Message'
+ expect(current_email.body).to eq 'New Message'
end
scenario "cc'd" do
deliver(Mail::Message.new(:cc => 'test@example.com', :body => 'New Message', :context => 'text/plain'))
open_email('test@example.com')
- current_email.body.should eq 'New Message'
+ expect(current_email.body).to eq 'New Message'
end
scenario "bcc'd" do
deliver(Mail::Message.new(:bcc => 'test@example.com', :body => 'New Message', :context => 'text/plain'))
open_email('test@example.com')
- current_email.body.should eq 'New Message'
+ expect(current_email.body).to eq 'New Message'
end
end
@@ -12,7 +12,7 @@
end
it 'delegates to the base' do
- email.body.should eq '<a href="http://example.com">example</a>'
+ expect(email.body).to eq '<a href="http://example.com">example</a>'
end
end
@@ -23,7 +23,7 @@
end
it 'delegates to the base' do
- email.body.should eq 'http://example.com'
+ expect(email.body).to eq 'http://example.com'
end
end
end
@@ -34,7 +34,7 @@
end
it 'delegates to the base' do
- email.subject.should eq 'Test subject'
+ expect(email.subject).to eq 'Test subject'
end
end
@@ -44,7 +44,7 @@
end
it 'delegates to the base' do
- email.to.should include 'test@example.com'
+ expect(email.to).to include 'test@example.com'
end
end
@@ -54,7 +54,7 @@
end
it 'delegates to the base' do
- email.reply_to.should include 'test@example.com'
+ expect(email.reply_to).to include 'test@example.com'
end
end
@@ -64,7 +64,7 @@
end
it 'delegates to the base' do
- email.from.should include 'test@example.com'
+ expect(email.from).to include 'test@example.com'
end
end
@@ -74,7 +74,7 @@
end
it 'delegates to the base' do
- email.header('header-key').should eq 'header_value'
+ expect(email.header('header-key')).to eq 'header_value'
end
end
@@ -85,14 +85,14 @@
end
it 'delegates to the base' do
- email.headers.should include 'first-key'
- email.headers.should include 'second-key'
+ expect(email.headers).to include 'first-key'
+ expect(email.headers).to include 'second-key'
end
end
describe '#inspect' do
it 'corrects class name' do
- email.inspect.should eq '<Capybara::Node::Email>'
+ expect(email.inspect).to eq '<Capybara::Node::Email>'
end
end
end

0 comments on commit 217ab35

Please sign in to comment.