diff options
author | Vitali Tatarintev <vtatarintev@gitlab.com> | 2019-08-23 11:05:50 +0200 |
---|---|---|
committer | Vitali Tatarintev <vtatarintev@gitlab.com> | 2019-08-28 08:43:47 +0200 |
commit | b61d26f496a2041d7124fd3280031deda3cf5a43 (patch) | |
tree | d8a8ffdc6e40b68aa814d41536bb304250ee8037 /spec | |
parent | 23da356dd1a048ca86c95960fb0b76df914f9087 (diff) | |
download | gitlab-ce-b61d26f496a2041d7124fd3280031deda3cf5a43.tar.gz |
Add support of not_to/to_not to BeSuccessMatcher
BeSuccessMatcher now supports following examples:
```
expect(response).to be_success
expect(response).to_not be_success
expect(response).not_to be_success
is_expected.to be_success
is_expected.to_not be_success
is_expected.not_to be_success
```
Diffstat (limited to 'spec')
-rw-r--r-- | spec/rubocop/cop/rspec/be_success_matcher_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb index 9965b8ddf86..95f08a61557 100644 --- a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb +++ b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb @@ -16,10 +16,26 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do good: %(expect(response).to be_successful).freeze }, { + bad: %(expect(response).to_not be_success).freeze, + good: %(expect(response).to_not be_successful).freeze + }, + { + bad: %(expect(response).not_to be_success).freeze, + good: %(expect(response).not_to be_successful).freeze + }, + { bad: %(is_expected.to be_success).freeze, good: %(is_expected.to be_successful).freeze + }, + { + bad: %(is_expected.to_not be_success).freeze, + good: %(is_expected.to_not be_successful).freeze + }, + { + bad: %(is_expected.not_to be_success).freeze, + good: %(is_expected.not_to be_successful).freeze } - ] + ].freeze let(:source_file) { 'spec/foo_spec.rb' } @@ -55,7 +71,7 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do end context "using #{code_example[:good]} call" do - it "does not register an offense" do + it 'does not register an offense' do inspect_source(code_example[:good]) expect(cop.offenses.size).to eq(0) |