Sha256: f36a26843d4c3cd4e7c4d8ec583928fc12fb21fe70562a7444b3a39faa2e5bd2

Contents?: true

Size: 860 Bytes

Versions: 110

Compression:

Stored size: 860 Bytes

Contents

module Ddr::Auth
  RSpec.describe WebAuthContext do

    subject { described_class.new(user, env) }

    let(:user) { FactoryGirl.build(:user) }
    let(:mock_ip_middleware) { double(calculate_ip: "8.8.8.8") }

    let(:env) do
      { "affiliation"=>"staff@duke.edu;student@duke.edu",
        "ismemberof"=>"group1;group2;group3",
        "action_dispatch.remote_ip"=>mock_ip_middleware
      }
    end

    it_behaves_like "an auth context"

    its(:affiliation) { should contain_exactly("staff", "student") }
    its(:ismemberof) { should contain_exactly("group1", "group2", "group3") }
    its(:ip_address) { should eq("8.8.8.8") }

    describe "when env vars are not present" do
      let(:env) { {} }
      its(:affiliation) { should be_empty }
      its(:ismemberof) { should be_empty }
      its(:ip_address) { should be_nil }
    end
    
  end
end

Version data entries

110 entries across 110 versions & 1 rubygems

Version Path
ddr-models-2.11.0 spec/auth/web_auth_context_spec.rb
ddr-models-2.10.2 spec/auth/web_auth_context_spec.rb
ddr-models-2.10.1 spec/auth/web_auth_context_spec.rb
ddr-models-2.10.0 spec/auth/web_auth_context_spec.rb
ddr-models-2.10.0.rc2 spec/auth/web_auth_context_spec.rb
ddr-models-2.10.0.rc1 spec/auth/web_auth_context_spec.rb
ddr-models-2.9.2 spec/auth/web_auth_context_spec.rb
ddr-models-2.9.1 spec/auth/web_auth_context_spec.rb
ddr-models-2.9.0 spec/auth/web_auth_context_spec.rb
ddr-models-2.9.0.rc1 spec/auth/web_auth_context_spec.rb
ddr-models-2.8.0 spec/auth/web_auth_context_spec.rb
ddr-models-2.8.0.rc1 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.6 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.5 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.4 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.3 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.2 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.1 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.0 spec/auth/web_auth_context_spec.rb
ddr-models-2.7.0.rc1 spec/auth/web_auth_context_spec.rb