diff options
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/issues/create_service_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/notes/update_service_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/snippets/create_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/spam/akismet_service_spec.rb (renamed from spec/services/akismet_service_spec.rb) | 2 | ||||
-rw-r--r-- | spec/services/spam/spam_check_service_spec.rb | 6 |
5 files changed, 14 insertions, 8 deletions
diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 3246578c743..44d4cd70f9a 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -355,7 +355,7 @@ describe Issues::CreateService do opts[:recaptcha_verified] = true opts[:spam_log_id] = spam_logs.last.id - expect(AkismetService).not_to receive(:new) + expect(Spam::AkismetService).not_to receive(:new) end it 'does no mark an issue as a spam ' do @@ -392,7 +392,7 @@ describe Issues::CreateService do context 'when akismet detects spam' do before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end @@ -442,7 +442,7 @@ describe Issues::CreateService do context 'when akismet does not detect spam' do before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: false) end end diff --git a/spec/services/notes/update_service_spec.rb b/spec/services/notes/update_service_spec.rb index 73fcdd787aa..ab28e08ec83 100644 --- a/spec/services/notes/update_service_spec.rb +++ b/spec/services/notes/update_service_spec.rb @@ -30,6 +30,12 @@ describe Notes::UpdateService do @note.reload end + it 'does not update the note when params is blank' do + Timecop.freeze(1.day.from_now) do + expect { update_note({}) }.not_to change { note.reload.updated_at } + end + end + context 'suggestions' do it 'refreshes note suggestions' do markdown = <<-MARKDOWN.strip_heredoc diff --git a/spec/services/snippets/create_service_spec.rb b/spec/services/snippets/create_service_spec.rb index 3ada50e80aa..7aa8f0ebf8f 100644 --- a/spec/services/snippets/create_service_spec.rb +++ b/spec/services/snippets/create_service_spec.rb @@ -99,7 +99,7 @@ describe Snippets::CreateService do end before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end diff --git a/spec/services/akismet_service_spec.rb b/spec/services/spam/akismet_service_spec.rb index 355ff1611a0..a496cd1890e 100644 --- a/spec/services/akismet_service_spec.rb +++ b/spec/services/spam/akismet_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AkismetService do +describe Spam::AkismetService do let(:fake_akismet_client) { double(:akismet_client) } let_it_be(:text) { "Would you like to buy some tinned meat product?" } diff --git a/spec/services/spam/spam_check_service_spec.rb b/spec/services/spam/spam_check_service_spec.rb index 5e06d14b8bc..732b64b52a0 100644 --- a/spec/services/spam/spam_check_service_spec.rb +++ b/spec/services/spam/spam_check_service_spec.rb @@ -85,7 +85,7 @@ describe Spam::SpamCheckService do before do issue.closed_at = Time.zone.now - allow(AkismetService).to receive(:new).and_return(double(spam?: true)) + allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: true)) end it 'returns false' do @@ -105,7 +105,7 @@ describe Spam::SpamCheckService do context 'when indicated as spam by akismet' do before do - allow(AkismetService).to receive(:new).and_return(double(spam?: true)) + allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: true)) end context 'when allow_possible_spam feature flag is false' do @@ -135,7 +135,7 @@ describe Spam::SpamCheckService do context 'when not indicated as spam by akismet' do before do - allow(AkismetService).to receive(:new).and_return(double(spam?: false)) + allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: false)) end it 'returns false' do |