diff options
Diffstat (limited to 'spec/services/lfs')
-rw-r--r-- | spec/services/lfs/lock_file_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/lfs/locks_finder_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/lfs/unlock_file_service_spec.rb | 5 |
3 files changed, 9 insertions, 4 deletions
diff --git a/spec/services/lfs/lock_file_service_spec.rb b/spec/services/lfs/lock_file_service_spec.rb index 15dbc3231a3..2bd62b96083 100644 --- a/spec/services/lfs/lock_file_service_spec.rb +++ b/spec/services/lfs/lock_file_service_spec.rb @@ -54,7 +54,9 @@ describe Lfs::LockFileService do context 'when an error is raised' do it "doesn't succeed" do - allow_any_instance_of(described_class).to receive(:create_lock!).and_raise(StandardError) + allow_next_instance_of(described_class) do |instance| + allow(instance).to receive(:create_lock!).and_raise(StandardError) + end expect(subject.execute[:status]).to eq(:error) end diff --git a/spec/services/lfs/locks_finder_service_spec.rb b/spec/services/lfs/locks_finder_service_spec.rb index 0fc2c593d94..fdc60e2c03f 100644 --- a/spec/services/lfs/locks_finder_service_spec.rb +++ b/spec/services/lfs/locks_finder_service_spec.rb @@ -91,7 +91,9 @@ describe Lfs::LocksFinderService do context 'when an error is raised' do it "doesn't succeed" do - allow_any_instance_of(described_class).to receive(:find_locks).and_raise(StandardError) + allow_next_instance_of(described_class) do |instance| + allow(instance).to receive(:find_locks).and_raise(StandardError) + end result = subject.execute diff --git a/spec/services/lfs/unlock_file_service_spec.rb b/spec/services/lfs/unlock_file_service_spec.rb index 8e36617c0d6..1334b074e84 100644 --- a/spec/services/lfs/unlock_file_service_spec.rb +++ b/spec/services/lfs/unlock_file_service_spec.rb @@ -18,7 +18,7 @@ describe Lfs::UnlockFileService do expect(result[:status]).to eq(:error) expect(result[:http_status]).to eq(403) - expect(result[:message]).to eq('You have no permissions') + expect(result[:message]).to eq(_('You have no permissions')) end end @@ -29,6 +29,7 @@ describe Lfs::UnlockFileService do context 'when lock does not exists' do let(:params) { { id: 123 } } + it "doesn't succeed" do result = subject.execute @@ -82,7 +83,7 @@ describe Lfs::UnlockFileService do result = subject.execute expect(result[:status]).to eq(:error) - expect(result[:message]).to match(/You must have maintainer access/) + expect(result[:message]).to eq(_('You must have maintainer access to force delete a lock')) expect(result[:http_status]).to eq(403) end end |