Skip to content

Commit

Permalink
Update shoulda-matchers to version 4.0.0
Browse files Browse the repository at this point in the history
We use a custom validation error message for the kiwi repository model. With the
new gem release the error message shoulda matchers would expect wasn't matching
our custom message and the test failed.
To solve this we explicitly set the validation message in the test.

Co-authored-by: Björn Geuken <bgeuken@suse.de>
  • Loading branch information
depfu[bot] and bgeuken committed Feb 20, 2019
1 parent 4c73605 commit dbcce47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/api/Gemfile
Expand Up @@ -132,7 +132,7 @@ group :test do
# for mocking and stubbing
gem 'mocha', '> 0.13.0', require: false
# for testing common Rails functionality with simple one-liners
gem 'shoulda-matchers', '~> 3.1'
gem 'shoulda-matchers', '~> 4.0'
# assigns has been extracted to a gem
gem 'rails-controller-testing'
# To generate random data
Expand Down
6 changes: 3 additions & 3 deletions src/api/Gemfile.lock
Expand Up @@ -388,8 +388,8 @@ GEM
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
sexp_processor (4.11.0)
shoulda-matchers (3.1.3)
activesupport (>= 4.0.0)
shoulda-matchers (4.0.0)
activesupport (>= 4.2.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -534,7 +534,7 @@ DEPENDENCIES
sanitize
sassc-rails
selenium-webdriver
shoulda-matchers (~> 3.1)
shoulda-matchers (~> 4.0)
simplecov
single_test
sprite-factory (>= 1.5.2)
Expand Down
5 changes: 4 additions & 1 deletion src/api/spec/models/kiwi/repository_spec.rb
Expand Up @@ -111,7 +111,10 @@

# We specific the context of the inclusion validation because of a bug in shoulda_matcher.
# Remove `.on(:save)` when it's solved.
it { is_expected.to validate_inclusion_of(:repo_type).in_array(Kiwi::Repository::REPO_TYPES).on(:save) }
it do
expect(subject).to validate_inclusion_of(:repo_type).in_array(Kiwi::Repository::REPO_TYPES).on(:save)
.with_message(/is not included in the list/)
end
it do
expect(subject).to validate_numericality_of(:priority).is_greater_than_or_equal_to(0).is_less_than(100)
.with_message(/must be between 0 and 99/)
Expand Down

0 comments on commit dbcce47

Please sign in to comment.