diff options
author | Bundlerbot <bot@bundler.io> | 2019-02-18 01:11:40 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-02-18 01:11:40 +0000 |
commit | 5dc368b07c407702a485ed53d8fd8a8ab40fa9ef (patch) | |
tree | 6cb450bd0a19d41f76e63200f35daded2fbfd621 | |
parent | 5565aa416e46192dcec4a0717833df05eb44d6dc (diff) | |
parent | e15af522dfb899fc49044f008ce70759935de6ac (diff) | |
download | bundler-5dc368b07c407702a485ed53d8fd8a8ab40fa9ef.tar.gz |
Merge #6969
6969: Fix redefinition warning r=hsbt a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that the test suite spits some warnings
```
/home/deivid/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/matchers/dsl.rb:72: warning: method redefined; discarding old be_well_formed
/home/deivid/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/matchers/dsl.rb:72: warning: previous definition of be_well_formed was here
```
### What was your diagnosis of the problem?
My diagnosis was that we are redefining an RSpec matcher.
### What is your fix for the problem, implemented in this PR?
My fix is to define the matcher just once.
### Why did you choose this fix out of the possible options?
I chose this fix because moving it to the centralized place where custom matchers are defined made sense to me.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
-rw-r--r-- | spec/quality_es_spec.rb | 8 | ||||
-rw-r--r-- | spec/quality_spec.rb | 8 | ||||
-rw-r--r-- | spec/support/matchers.rb | 8 |
3 files changed, 8 insertions, 16 deletions
diff --git a/spec/quality_es_spec.rb b/spec/quality_es_spec.rb index 20df9912a3..d837b88f78 100644 --- a/spec/quality_es_spec.rb +++ b/spec/quality_es_spec.rb @@ -43,14 +43,6 @@ RSpec.describe "La biblioteca si misma" do failing_line_message unless failing_line_message.empty? end - RSpec::Matchers.define :be_well_formed do - match(&:empty?) - - failure_message do |actual| - actual.join("\n") - end - end - it "mantiene la calidad de lenguaje de la documentación" do included = /ronn/ error_messages = [] diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 64590befdf..f800ceeebd 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -96,14 +96,6 @@ RSpec.describe "The library itself" do failing_line_message unless failing_line_message.empty? end - RSpec::Matchers.define :be_well_formed do - match(&:empty?) - - failure_message do |actual| - actual.join("\n") - end - end - it "has no malformed whitespace" do exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|LICENSE|vcr_cassettes/ error_messages = [] diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index c56aa56a00..18ccf38fb1 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -121,6 +121,14 @@ module Spec end end + RSpec::Matchers.define :be_well_formed do + match(&:empty?) + + failure_message do |actual| + actual.join("\n") + end + end + define_compound_matcher :read_as, [exist] do |file_contents| diffable |