Sha256: 68ce6f5bb1e2ed061ea3ef90ec6f31b8413c396c8dfebbfe34b88c8172b8feaf

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

require 'rails_helper'

module SocialFramework
  RSpec.describe Users::SessionsController, type: :controller do
    include Devise::TestHelpers
    routes {SocialFramework::Engine.routes}

    describe "Authentication with login or username" do
      it "Authentication when login equals username" do
        user = create(:user)
        
        request.env["devise.mapping"] = Devise.mappings[:user]
        post :create, user: {
          login: "user", password: "password"
        }

        expect(response).to have_http_status(302)
      end

      it "Authentication when login equals email" do
        user = create(:user)
        
        request.env["devise.mapping"] = Devise.mappings[:user]
        post :create, user: {
          login: "user@email.com", password: "password"
        }

        expect(response).to have_http_status(302)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
social_framework-0.0.3 spec/controllers/social_framework/sessions_controller_spec.rb
social_framework-0.0.2 spec/controllers/social_framework/sessions_controller_spec.rb