<commit_before>require 'spec_helper'

describe Aptible::Auth::User do
  describe '#organizations' do
    let(:so) { double 'Aptible::Auth::Role' }
    let(:owner) { double 'Aptible::Auth::Role' }
    let(:org) { double 'Aptible::Auth::Organization' }

    before do
      org.stub(:id) { 1 }
      so.stub(:organization) { org }
      owner.stub(:organization) { org }
    end

    it 'should return empty if no organizations' do
      subject.stub(:roles) { [] }
      expect(subject.organizations.count).to eq 0
    end

    it 'should return unique organizations only' do
      subject.stub(:roles) { [so, owner] }
      expect(subject.organizations.count).to eq 1
    end

  end
  describe '#roles' do

    let(:so) { double 'Aptible::Auth::Role' }
    let(:owner) { double 'Aptible::Auth::Role' }

    before do
      so.stub(:id) { 1 }
      owner.stub(:id) { 2 }
    end

    it 'should have role' do
      subject.stub(:roles) { [so] }
      expect(subject.role?(so)).to eq true
      expect(subject.role?(owner)).to eq false
    end
  end
end<commit_msg>fix spec<commit_after>require 'spec_helper'

describe Aptible::Auth::User do
  describe '#organizations' do
    let(:so) { double 'Aptible::Auth::Role' }
    let(:owner) { double 'Aptible::Auth::Role' }
    let(:org) { double 'Aptible::Auth::Organization' }

    before do
      org.stub(:id) { 1 }
      so.stub(:organization) { org }
      owner.stub(:organization) { org }
    end

    it 'should return empty if no organizations' do
      subject.stub(:roles) { [] }
      expect(subject.organizations.count).to eq 0
    end

    it 'should return unique organizations only' do
      subject.stub(:roles) { [so, owner] }
      expect(subject.organizations.count).to eq 1
    end

  end
  describe '#roles' do

    let(:so) { double 'Aptible::Auth::Role' }
    let(:owner) { double 'Aptible::Auth::Role' }

    before do
      so.stub(:id) { 1 }
      owner.stub(:id) { 2 }
    end

    it 'should have role' do
      subject.stub(:roles) { [so] }
      expect(subject.has_role?(so)).to eq true
      expect(subject.has_role?(owner)).to eq false
    end
  end
end
{'fraction_non_alphanumeric': 0.1456082667919211, 'fraction_numerical': 0.004697040864255519, 'mean_word_length': 2.817204301075269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3805551', 'n_tokens_mistral': 728, 'n_tokens_neox': 717, 'n_words': 172}