Sha256: b43a70cc2145c05f45f57edbb386b6a9f345cc2a8ab9a6a92bccade5b2694ef8

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

# Helpers used in Request Specs
module MnoEnterprise::TestingSupport::RequestSpecHelper
  shared_context 'signed in user' do
    # Simulate a user login by login through devise
    def login
      # Stub user manipulation
      api_stub_for(get: "/users/#{user.id}", response: from_api(user))
      api_stub_for(put: "/users/#{user.id}", response: from_api(user))

      # Stub session authentication
      api_stub_for(post: '/user_sessions', code: 200, response: from_api(user))

      # Log in
      post '/mnoe/auth/users/sign_in', user: {email: user.email, password: 'securepassword'}
    end

    let(:user) { FactoryGirl.build(:user, password_valid: true) }
    before { login }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 lib/mno_enterprise/testing_support/request_spec_helper.rb
mno-enterprise-core-3.3.3 lib/mno_enterprise/testing_support/request_spec_helper.rb