From 2467697d81e4ab9e9d770d55d8cb33cb5779db22 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 23 Jun 2016 11:12:56 +0200 Subject: Simplify the GitAccessStatus class Make the optional 'message' argument required. Remove unused 'to_json' method. --- spec/gitlab_access_spec.rb | 4 ++-- spec/gitlab_shell_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/gitlab_access_spec.rb b/spec/gitlab_access_spec.rb index 4768c71..39c3ab3 100644 --- a/spec/gitlab_access_spec.rb +++ b/spec/gitlab_access_spec.rb @@ -7,7 +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)) + api.stub(check_access: GitAccessStatus.new(true, 'ok')) end end subject do @@ -38,7 +38,7 @@ describe GitlabAccess do context "access is denied" do before do - api.stub(check_access: GitAccessStatus.new(false)) + api.stub(check_access: GitAccessStatus.new(false, 'denied')) end it "returns false" do diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index dd5cfb2..3be1671 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -22,7 +22,7 @@ describe GitlabShell do let(:api) do double(GitlabNet).tap do |api| api.stub(discover: { 'name' => 'John Doe' }) - api.stub(check_access: GitAccessStatus.new(true)) + api.stub(check_access: GitAccessStatus.new(true, 'ok')) end end @@ -230,7 +230,7 @@ describe GitlabShell do end it "should disallow access and log the attempt if check_access returns false status" do - api.stub(check_access: GitAccessStatus.new(false)) + api.stub(check_access: GitAccessStatus.new(false, 'denied')) message = "gitlab-shell: Access denied for git command " message << "by user with key #{key_id}." $logger.should_receive(:warn).with(message) -- cgit v1.2.1