Sha256: a6533a3b90a5850e8795b434de69dd9583044d96d61a7bd305de797824daf2c5

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

require 'ostruct'

module AuthHelpers
  module Spec
    module Notifier
      def self.included(base)
        base.class_eval do
          before(:each) do
            @record = OpenStruct.new(:email            => 'recipient@email.com',
                                     :perishable_token => '0123456789')
          end

          it "should deliver new account notification" do
            email = ::AuthHelpers::Notifier.create_create_confirmation(@record)
            email.to.should == [ 'recipient@email.com' ]
            email.body.should match(/#{@record.perishable_token}/)
          end

          it "should deliver email changed notification" do
            email = ::AuthHelpers::Notifier.create_update_confirmation(@record)
            email.to.should == [ 'recipient@email.com' ]
            email.body.should match(/#{@record.perishable_token}/)
          end

          it "should deliver reset password code" do
            email = ::AuthHelpers::Notifier.create_reset_password(@record)
            email.to.should == [ 'recipient@email.com' ]
            email.body.should match(/#{@record.perishable_token}/)
          end

          it "should resend confirmation code" do
            email = ::AuthHelpers::Notifier.create_resend_confirmation(@record)
            email.to.should == [ 'recipient@email.com' ]
            email.body.should match(/#{@record.perishable_token}/)
          end
        end
      end
    end
  end
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
josevalim-auth_helpers-0.2.0 lib/auth_helpers/spec/notifier.rb
josevalim-auth_helpers-0.2.1 lib/auth_helpers/spec/notifier.rb
josevalim-auth_helpers-0.3.0 lib/auth_helpers/spec/notifier.rb
josevalim-auth_helpers-0.3.1 lib/auth_helpers/spec/notifier.rb
josevalim-auth_helpers-0.3.2 lib/auth_helpers/spec/notifier.rb
josevalim-auth_helpers-0.4.1 lib/auth_helpers/spec/notifier.rb
josevalim-auth_helpers-0.5.0 lib/auth_helpers/spec/notifier.rb
josevalim-auth_helpers-0.5.1 lib/auth_helpers/spec/notifier.rb