Sha256: 1d5264bb78d2db398a1a3861cb34a6cf066bda1cfaefe800a2c486d130cbaa9d

Contents?: true

Size: 534 Bytes

Versions: 45

Compression:

Stored size: 534 Bytes

Contents

require 'spec_helper'

describe 'IpBasedAbilitySpec' do
  controller do
    include Hydra::Controller::IpBasedAbility
  end

  describe '#ability' do
    let(:user) { double }
    let(:ip) { '123.456.789.111' }

    before do
      allow(controller).to receive(:current_user).and_return(user)
      allow_any_instance_of(ActionDispatch::Request).to receive(:remote_ip) { ip }
    end

    it 'passes ip to ability' do
      expect(Ability).to receive(:new).with(user, remote_ip: ip)
      controller.current_ability
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
hydra-core-13.0.0 spec/controllers/ip_based_ability_spec.rb
hydra-core-12.1.0 spec/controllers/ip_based_ability_spec.rb
hydra-core-12.0.2 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.7 spec/controllers/ip_based_ability_spec.rb
hydra-core-12.0.1 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.6 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.5 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.4 spec/controllers/ip_based_ability_spec.rb
hydra-core-12.0.0 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.1 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.0 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.0.rc2 spec/controllers/ip_based_ability_spec.rb
hydra-core-10.7.0 spec/controllers/ip_based_ability_spec.rb
hydra-core-10.6.2 spec/controllers/ip_based_ability_spec.rb
hydra-core-10.6.1 spec/controllers/ip_based_ability_spec.rb
hydra-core-10.6.0 spec/controllers/ip_based_ability_spec.rb
hydra-core-10.5.1 spec/controllers/ip_based_ability_spec.rb
hydra-core-11.0.0.rc1 spec/controllers/ip_based_ability_spec.rb
hydra-core-10.5.0 spec/controllers/ip_based_ability_spec.rb
hydra-core-10.4.0 spec/controllers/ip_based_ability_spec.rb