summaryrefslogtreecommitdiff
path: root/spec/gitlab_access_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/gitlab_access_spec.rb')
-rw-r--r--spec/gitlab_access_spec.rb23
1 files changed, 2 insertions, 21 deletions
diff --git a/spec/gitlab_access_spec.rb b/spec/gitlab_access_spec.rb
index bec7f25..e529a66 100644
--- a/spec/gitlab_access_spec.rb
+++ b/spec/gitlab_access_spec.rb
@@ -7,12 +7,7 @@ describe GitlabAccess do
let(:repo_path) { File.join(repository_path, repo_name) + ".git" }
let(:api) do
double(GitlabNet).tap do |api|
- api.stub(check_access: GitAccessStatus.new(true,
- 'ok',
- gl_repository: 'project-1',
- gl_username: 'testuser',
- repository_path: '/home/git/repositories',
- gitaly: nil))
+ allow(api).to receive(:check_access).and_return(Action::Gitaly.new('key-1', 'project-1', 'testuser', '/home/git/repositories', nil))
end
end
subject do
@@ -26,12 +21,6 @@ describe GitlabAccess do
allow_any_instance_of(GitlabConfig).to receive(:repos_path).and_return(repository_path)
end
- describe :initialize do
- it { expect(subject.send(:repo_path)).to eql repo_path } # FIXME: don't access private instance variables
- it { expect(subject.send(:changes)).to eql ['wow'] } # FIXME: don't access private instance variables
- it { expect(subject.send(:protocol)).to eql 'ssh' } # FIXME: don't access private instance variables
- end
-
describe "#exec" do
context "access is granted" do
@@ -41,16 +30,8 @@ describe GitlabAccess do
end
context "access is denied" do
-
before do
- api.stub(check_access: GitAccessStatus.new(
- false,
- 'denied',
- gl_repository: nil,
- gl_username: nil,
- repository_path: nil,
- gitaly: nil
- ))
+ allow(api).to receive(:check_access).and_raise(AccessDeniedError)
end
it "returns false" do