Fixed some broken tests

This commit is contained in:
LinguaFrancaTranslator
2017-04-12 23:04:30 +00:00
parent 5d20630ed6
commit cb07484265
5 changed files with 606 additions and 609 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