Skip to content

Instantly share code, notes, and snippets.

@Fercell

Fercell/Time (1) Secret

Created January 21, 2015 18:15
Show Gist options
  • Save Fercell/1706a7779e3f143a670a to your computer and use it in GitHub Desktop.
Save Fercell/1706a7779e3f143a670a to your computer and use it in GitHub Desktop.
Time issue
let(:date_from) { Time.now - 60 }
let(:query) { "email:'gal.andrius@yahoo.com' AND subject:'Reset password instructions' AND ts:[#{date_from.to_i} TO #{Time.now.to_i}]" }
let(:messages) { mandrill.messages.search query }
let(:message_id) { messages.first['_id'] }
let(:message) { mandrill.messages.content message_id }
let(:url) { message['text'].match(/http:\/\/.*(?=>)/).to_s }
let(:response) { Faraday.get(url) }
let(:reset_password_url) { response.headers['location'].gsub('http', 'https') }
it 'checks email that contains reset password link', :retry => 3, :retry_wait => 300 do
expect(message).to have_content('Reset my password')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment