2016-04-18 12:53:32 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AccessRequestable do
|
|
|
|
describe 'Group' do
|
|
|
|
describe '#request_access' do
|
|
|
|
let(:group) { create(:group, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
it { expect(group.request_access(user)).to be_a(GroupMember) }
|
2016-06-02 12:05:06 -04:00
|
|
|
it { expect(group.request_access(user).user).to eq(user) }
|
2016-04-18 12:53:32 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '#access_requested?' do
|
|
|
|
let(:group) { create(:group, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before { group.request_access(user) }
|
|
|
|
|
2016-06-27 10:20:57 -04:00
|
|
|
it { expect(group.requesters.exists?(user_id: user)).to be_truthy }
|
2016-04-18 12:53:32 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'Project' do
|
|
|
|
describe '#request_access' do
|
|
|
|
let(:project) { create(:empty_project, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
it { expect(project.request_access(user)).to be_a(ProjectMember) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#access_requested?' do
|
|
|
|
let(:project) { create(:empty_project, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before { project.request_access(user) }
|
|
|
|
|
2016-06-27 10:20:57 -04:00
|
|
|
it { expect(project.requesters.exists?(user_id: user)).to be_truthy }
|
2016-04-18 12:53:32 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|