Sha256: 984d647783992e0e298eca00993a9cea87c5000a91e5794558f7344303b2774e

Contents?: true

Size: 1.63 KB

Versions: 33

Compression:

Stored size: 1.63 KB

Contents

require 'rails_helper'
feature "Authorization" do
  let(:user){ create(:user) }

  scenario "Url preserving after authorization" do
    current_unauthorized_url = new_admin_book_url
    visit current_unauthorized_url

    within("form") do
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button 'Sign in'
    end

    expect(current_url).to eq current_unauthorized_url
  end

  scenario "Redirection to role default controller after authorization" do
    visit releaf_root_url
    within("form.login") do
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button 'Sign in'
    end

    expect(current_url).to eq url_for(action: 'index', controller: '/' + user.role.default_controller)
  end

  scenario "Redirection to role :redirect_to GET parameter after authorization when parameter value is relative url" do
    visit new_releaf_permissions_user_session_url(redirect_to: new_admin_book_path)
    within("form.login") do
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button 'Sign in'
    end

    expect(current_url).to eq new_admin_book_url
  end

  scenario "Redirection to role default controller after authorization when :redirect_to GET parameter is absolute url" do
    visit new_releaf_permissions_user_session_url(redirect_to: new_admin_book_url)
    within("form.login") do
      fill_in 'Email', with: user.email
      fill_in 'Password', with: user.password
      click_button 'Sign in'
    end

    expect(current_url).to eq url_for(action: 'index', controller: '/' + user.role.default_controller)
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
releaf-core-2.0.0 spec/features/authorization_spec.rb
releaf-core-1.1.22 spec/features/authorization_spec.rb
releaf-core-1.1.21 spec/features/authorization_spec.rb
releaf-core-1.1.20 spec/features/authorization_spec.rb
releaf-core-1.1.19 spec/features/authorization_spec.rb
releaf-core-1.1.18 spec/features/authorization_spec.rb
releaf-core-1.1.17 spec/features/authorization_spec.rb
releaf-core-1.1.16 spec/features/authorization_spec.rb
releaf-core-1.1.15 spec/features/authorization_spec.rb
releaf-core-1.1.14 spec/features/authorization_spec.rb
releaf-core-1.1.13 spec/features/authorization_spec.rb
releaf-core-1.1.12 spec/features/authorization_spec.rb
releaf-core-1.1.11 spec/features/authorization_spec.rb
releaf-core-1.1.10 spec/features/authorization_spec.rb
releaf-core-1.1.9 spec/features/authorization_spec.rb
releaf-core-1.1.8 spec/features/authorization_spec.rb
releaf-core-1.1.7 spec/features/authorization_spec.rb
releaf-core-1.1.6 spec/features/authorization_spec.rb
releaf-core-1.1.5 spec/features/authorization_spec.rb
releaf-core-1.1.4 spec/features/authorization_spec.rb