diff options
Diffstat (limited to 'spec/support/matchers')
-rw-r--r-- | spec/support/matchers/json/match_json_schema.rb | 2 | ||||
-rw-r--r-- | spec/support/matchers/model/model_have_error_on_field.rb | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/spec/support/matchers/json/match_json_schema.rb b/spec/support/matchers/json/match_json_schema.rb index 5d9c9a618..3a275199e 100644 --- a/spec/support/matchers/json/match_json_schema.rb +++ b/spec/support/matchers/json/match_json_schema.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec::Matchers.define :match_json_schema do |schema| match do |input_json| schema_path = Rails.root.join('spec', 'support', 'schema', "#{schema}.json").to_s diff --git a/spec/support/matchers/model/model_have_error_on_field.rb b/spec/support/matchers/model/model_have_error_on_field.rb index 85bdd8215..0f9c81a47 100644 --- a/spec/support/matchers/model/model_have_error_on_field.rb +++ b/spec/support/matchers/model/model_have_error_on_field.rb @@ -1,10 +1,10 @@ +# frozen_string_literal: true + RSpec::Matchers.define :model_have_error_on_field do |expected| match do |record| - if record.errors.empty? - record.valid? - end + record.valid? if record.errors.empty? - record.errors.has_key?(expected) + record.errors.key?(expected) end failure_message do |record| |