Sha256: 09591142285e682f231b46d9ec2cd60f5d16486c8e2ae96cf3f0c93aa49ca2dd

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

module Ddr::Auth
  RSpec.describe Group do

    subject { described_class.new("admins") }

    its(:agent) { is_expected.to eq("admins") }

    describe "#has_member?" do
      let!(:user) { FactoryGirl.build(:user) }
      context "when the user's groups include the group" do
        before { allow(user).to receive(:groups) { Groups.new([subject]) } }
        it "should be true" do
          expect(subject.has_member?(user)).to be true
        end
      end
      context "when the user's groups do not include the group" do
        before { allow(user).to receive(:groups) { Groups.new([Group.new("foo")]) } }
        it "should be false" do
          expect(subject.has_member?(user)).to be false
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddr-models-1.13.2 spec/auth/group_spec.rb