Sha256: 55edd9aa781af41721cb3a08f870a8b0d4d57f4c71dd0441be7193a4922eb957

Contents?: true

Size: 840 Bytes

Versions: 4

Compression:

Stored size: 840 Bytes

Contents

module HelperMethods
  def session_for(partner)
     @partner = partner
     if @partner.is_a?(Symbol) || @partner.is_a?(String)
       @partner = Factory(partner)
     end
     PartnerSession.create(@partner)
   end
 
   def stubbed_session_for(partner)
     @partner = partner
     if @partner.is_a?(Symbol) || @partner.is_a?(String)
       @partner = Factory(partner)
     end
     @controller.stubs(:current_user).returns(@partner)
   end

   def current_user
     @partner ||= session_for(:partner)
   end
 
   def assert_not_received(mock, expected_method_name)
     matcher = have_received(expected_method_name)
     yield(matcher) if block_given?
     assert !matcher.matches?(mock), matcher.failure_message
   end

   def admin_login
     @request.env['HTTP_AUTHORIZATION'] = 'Basic ' + Base64::encode64("admin:10ckb0X")
   end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lockbox_middleware-1.3.0 spec/support/helper_methods.rb
lockbox_middleware-1.2.3 spec/support/helper_methods.rb
lockbox_middleware-1.2.2 spec/support/helper_methods.rb
lockbox_middleware-1.2.1 spec/support/helper_methods.rb