Skip to content

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleyprice committed Feb 16, 2018
1 parent b129ae1 commit 2d3d576
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/secrets.yml
Expand Up @@ -29,7 +29,7 @@ test:
secret_key_base: 284eadb629144bd4cd8f49ee4ce1ae86fe2aad705944fc6e47e4c52aaf333492ac7ed642002531128bb01afe462f346203d50b57bfd2916d4e20e110278b8178
github_key: <%= ENV["GITHUB_KEY"] %>
github_secret: <%= ENV["GITHUB_SECRET"] %>
produciton_email: <%= ENV["PRODUCITON_EMAIL"] %>
produciton_email: test@produciton.com


# Do not keep production secrets in the unencrypted secrets file.
Expand Down
1 change: 1 addition & 0 deletions spec/features/checklists_spec.rb
Expand Up @@ -38,6 +38,7 @@
end

scenario 'sharing a checklist with another user' do
allow(MailerJob).to receive(:perform_async)
visit checklist_path(ruby)
log_in(user)
click_on(ruby.title)
Expand Down
14 changes: 10 additions & 4 deletions spec/mailers/share_checklist_spec.rb
Expand Up @@ -2,15 +2,21 @@

RSpec.describe ShareChecklistMailer, type: :mailer do
describe 'email' do
let(:from_user) { double('User', email: 'from@example.com') }
let(:to_user) { double('User', email: 'to@example.org') }
let(:from_user) { double('User', id: 1, email: 'from@example.com') }
let(:to_user) { double('User', id: 2, email: 'to@example.org') }
let(:checklist) { double('Checklist', id: 1) }
let(:mail) { ShareChecklistMailer.email(from_user, to_user, checklist) }
let(:mail) { ShareChecklistMailer.email(from_user.id, to_user.id, checklist.id) }

before do
allow(User).to receive(:find).with(from_user.id).and_return(from_user)
allow(User).to receive(:find).with(to_user.id).and_return(to_user)
allow(Checklist).to receive(:find).with(checklist.id).and_return(checklist)
end

it 'renders the headers' do
expect(mail.subject).to eq("#{from_user.email} has shared a Checklist with you!")
expect(mail.to).to eq(['to@example.org'])
expect(mail.from).to eq([ENV['PRODUCITON_EMAIL']])
expect(mail.from).to eq([Rails.application.secrets.produciton_email].compact)
end

it 'renders the body' do
Expand Down

0 comments on commit 2d3d576

Please sign in to comment.