How to use wait_time method of Howitzer Package

Best Howitzer_ruby code snippet using Howitzer.wait_time

email_spec.rb

Source:email_spec.rb Github

copy

Full Screen

...36 it 'should be protected' do37 expect { described_class.subject(message_subject) }.to raise_error(NoMethodError)38 end39 end40 describe '.wait_time' do41 subject { Class.new(described_class) }42 it 'should be protected' do43 expect { subject.wait_time(10) }.to raise_error(NoMethodError)44 end45 context 'when specified' do46 before { subject.send(:wait_time, 10) }47 it do48 expect(subject.send(:wait_time_value)).to eql 1049 expect(subject.private_methods(true)).to include(:wait_time_value)50 end51 end52 context 'when missing' do53 it do54 expect(subject.send(:wait_time_value)).to eql 6055 end56 end57 end58 describe '.find_by_recipient' do59 let(:recipient) { 'test@user.com' }60 context 'simple subject without parameters' do61 before { described_class.class_eval { subject 'Some title' } }62 it do63 expect(described_class.adapter).to receive(:find).with(recipient, 'Some title', wait: 60).once64 described_class.find_by_recipient(recipient)65 end66 end67 context 'complex subject with 1 parameter' do68 subject { described_class.find_by_recipient(recipient, name: 'Vasya') }...

Full Screen

Full Screen

email.rb

Source:email.rb Github

copy

Full Screen

...28 private_class_method :subject_value29 end30 # DSL method to specify a custom wait email time directly in an email class31 # @param value [Integer] an wait time for a particular email.32 # If it is ommitted, default Howitzer.mail_wait_time will be used.33 # @example34 # class WelcomeEmail < Howitzer::Email35 # wait_time 10.minutes36 # end37 # @!visibility public38 def wait_time(value)39 define_singleton_method(:wait_time_value) { value }40 private_class_method :wait_time_value41 end42 end43 wait_time Howitzer.try(:mail_wait_time)44 # Specifies a mail adapter45 # @param adapter_name [String, Symbol] an email adapter name46 # @raise [NoMailAdapterError] when the adapter name is not String or Symbol47 def self.adapter=(adapter_name)48 @adapter_name = adapter_name49 case adapter_name50 when Symbol, String51 require "howitzer/mail_adapters/#{adapter_name}"52 @adapter = MailAdapters.const_get(adapter_name.to_s.capitalize.to_s)53 else54 raise Howitzer::NoMailAdapterError55 end56 end57 # Searches a mail by a recepient58 # @param recipient [String] recepient's email address59 # @param params [Hash] placeholders with appropriate values60 # @raise [NoEmailSubjectError] when a subject is not specified for the email class61 # @return [Email] an instance of the email message62 # @see .subject63 def self.find_by_recipient(recipient, params = {})64 if defined?(subject_value).nil? || subject_value.nil?65 raise Howitzer::NoEmailSubjectError, "Please specify email subject. For example:\n" \66 "class SomeEmail < Howitzer::Email\n " \67 "subject ‘some subject text’\nend"68 end69 new(adapter.find(recipient, expand_subject(params), wait: wait_time_value))70 end71 def initialize(message)72 @message = message73 end74 # @return [String, nil] a plain text of the email message75 def plain_text_body76 message.plain_text_body77 end78 # @return [String, nil] a html body of the email message79 def html_body80 message.html_body81 end82 # @return [String, nil] a mail text83 def text...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful