From 236876f27823953138bb212db284782032d117d4 Mon Sep 17 00:00:00 2001 From: blackst0ne Date: Tue, 18 Dec 2018 10:21:30 +1100 Subject: [PATCH] Update specs to exclude possible false positive pass --- .../unreleased/blackst0ne-improve-encoding-helper-spec.yml | 5 +++++ spec/lib/gitlab/encoding_helper_spec.rb | 2 +- spec/lib/gitlab/gpg_spec.rb | 2 +- spec/models/concerns/chronic_duration_attribute_spec.rb | 4 ++-- spec/models/merge_request_spec.rb | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/blackst0ne-improve-encoding-helper-spec.yml diff --git a/changelogs/unreleased/blackst0ne-improve-encoding-helper-spec.yml b/changelogs/unreleased/blackst0ne-improve-encoding-helper-spec.yml new file mode 100644 index 00000000000..09480499b87 --- /dev/null +++ b/changelogs/unreleased/blackst0ne-improve-encoding-helper-spec.yml @@ -0,0 +1,5 @@ +--- +title: Update specs to exclude possible false positive pass +merge_request: 23893 +author: "@blackst0ne" +type: other diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index a5bf2f2b3df..429816efec3 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -124,7 +124,7 @@ describe Gitlab::EncodingHelper do end it 'returns empty string on conversion errors' do - expect { ext_class.encode_utf8('') }.not_to raise_error(ArgumentError) + expect { ext_class.encode_utf8('') }.not_to raise_error end context 'with strings that can be forcefully encoded into utf8' do diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb index 39d09c49989..48bbd7f854c 100644 --- a/spec/lib/gitlab/gpg_spec.rb +++ b/spec/lib/gitlab/gpg_spec.rb @@ -137,7 +137,7 @@ describe Gitlab::Gpg do described_class.using_tmp_keychain do end end - end.not_to raise_error(ThreadError) + end.not_to raise_error end end end diff --git a/spec/models/concerns/chronic_duration_attribute_spec.rb b/spec/models/concerns/chronic_duration_attribute_spec.rb index b14b773b653..51221e07ca3 100644 --- a/spec/models/concerns/chronic_duration_attribute_spec.rb +++ b/spec/models/concerns/chronic_duration_attribute_spec.rb @@ -43,7 +43,7 @@ shared_examples 'ChronicDurationAttribute writer' do end it "doesn't raise exception" do - expect { subject.send("#{virtual_field}=", '-10m') }.not_to raise_error(ChronicDuration::DurationParseError) + expect { subject.send("#{virtual_field}=", '-10m') }.not_to raise_error end it "doesn't change value" do @@ -87,7 +87,7 @@ shared_examples 'ChronicDurationAttribute writer' do end it "doesn't raise exception" do - expect { subject.send("#{virtual_field}=", nil) }.not_to raise_error(NoMethodError) + expect { subject.send("#{virtual_field}=", nil) }.not_to raise_error end end end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index bf4117fbcaf..7fd5307b906 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -1358,7 +1358,7 @@ describe MergeRequest do it 'does not raises a NameError exception' do allow_any_instance_of(service_class_name.constantize).to receive(:execute).and_return(nil) - expect { subject }.not_to raise_error(NameError) + expect { subject }.not_to raise_error end end end