Fixed some broken tests

This commit is contained in:
LinguaFrancaTranslator
2017-06-16 17:15:55 -07:00
committed by Godwin
parent 7d7166c3be
commit 953f1a8e09
4 changed files with 86 additions and 116 deletions
+12 -9
View File
@@ -4,18 +4,21 @@ end
Then /^(.*) should get (.+) '(.+)' emails?$/i do |to, amount, subject|
address = email_address(to)
emails = emails_to(address, subject)
unless emails.length == (str_to_num(amount))
email_log = []
ActionMailer::Base.deliveries.each do |mail|
email_log << "\t#{mail.to.join(', ')}: #{mail.subject}"
end
total_emails = ActionMailer::Base.deliveries.length
attempt_to do
emails = emails_to(address, subject)
unless emails.length == (str_to_num(amount))
email_log = []
ActionMailer::Base.deliveries.each do |mail|
email_log << "\t#{mail.to.join(', ')}: #{mail.subject}"
end
total_emails = ActionMailer::Base.deliveries.length
fail "Failed to find #{amount} email#{amount == 1 ? '' : 's'} to #{address} with #{subject} in the subject amoung #{total_emails} total email#{total_emails == 1 ? '' : 's'}:\n#{email_log.join("\n")}"
end
end
TestState.last_email = emails.first
TestState.last_email = emails.first
end
end
Then /^th(?:e|at) email should contain (.+)$/i do |value|
+1 -3
View File
@@ -19,10 +19,8 @@ Given /^(?:I )?(?:am logged|log) in(?: as '(.+)')?$/i do |email|
rescue Capybara::Poltergeist::TimeoutError
end
begin
attempt_to true do
expect(page).to have_link TestState.my_account.name
rescue
fail "Error logging in"
end
end
end