diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-07-26 18:22:23 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2018-08-01 00:24:16 +1000 |
commit | c8df6bcf6ff4288ddb9bf063195eae28cccc1860 (patch) | |
tree | 3289d5b2c8433c69b24fde305cd8df25b759a741 /spec/gitlab_access_spec.rb | |
parent | f2eb95f00cc36108f66afbff1481a9354eca35e1 (diff) | |
download | gitlab-shell-c8df6bcf6ff4288ddb9bf063195eae28cccc1860.tar.gz |
Fix some rspec deprecations
Diffstat (limited to 'spec/gitlab_access_spec.rb')
-rw-r--r-- | spec/gitlab_access_spec.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/gitlab_access_spec.rb b/spec/gitlab_access_spec.rb index 8882e01..bec7f25 100644 --- a/spec/gitlab_access_spec.rb +++ b/spec/gitlab_access_spec.rb @@ -3,8 +3,8 @@ require 'gitlab_access' describe GitlabAccess do let(:repository_path) { "/home/git/repositories" } - let(:repo_name) { 'dzaporozhets/gitlab-ci' } - let(:repo_path) { File.join(repository_path, repo_name) + ".git" } + let(:repo_name) { 'dzaporozhets/gitlab-ci' } + 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, @@ -17,19 +17,19 @@ describe GitlabAccess do end subject do GitlabAccess.new(nil, repo_path, 'key-123', 'wow', 'ssh').tap do |access| - access.stub(exec_cmd: :exec_called) - access.stub(api: api) + allow(access).to receive(:exec_cmd).and_return(:exec_called) + allow(access).to receive(:api).and_return(api) end end before do - GitlabConfig.any_instance.stub(repos_path: repository_path) + allow_any_instance_of(GitlabConfig).to receive(:repos_path).and_return(repository_path) end describe :initialize do - it { subject.repo_path.should == repo_path } - it { subject.changes.should == ['wow'] } - it { subject.protocol.should == 'ssh' } + 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 @@ -61,7 +61,7 @@ describe GitlabAccess do context "API connection fails" do before do - api.stub(:check_access).and_raise(GitlabNet::ApiUnreachableError) + allow(api).to receive(:check_access).and_raise(GitlabNet::ApiUnreachableError) end it "returns false" do |