shoulda-matchers 3.1.3 → 4.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/.hound/ruby.yml +336 -316
  3. data/.python-version +1 -0
  4. data/.rubocop.yml +3 -1
  5. data/.travis.yml +7 -6
  6. data/Appraisals +76 -44
  7. data/CONTRIBUTING.md +137 -66
  8. data/Gemfile +5 -5
  9. data/Gemfile.lock +30 -35
  10. data/MAINTAINING.md +250 -0
  11. data/MIT-LICENSE +1 -1
  12. data/NEWS.md +176 -4
  13. data/README.md +138 -200
  14. data/Rakefile +7 -0
  15. data/bin/setup +190 -0
  16. data/doc_config/yard/templates/default/fulldoc/html/css/global.css +4 -0
  17. data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +0 -6
  18. data/doc_config/yard/templates/default/fulldoc/html/js/app.js +0 -17
  19. data/doc_config/yard/templates/default/fulldoc/html/setup.rb +27 -0
  20. data/gemfiles/4.2.gemfile +21 -20
  21. data/gemfiles/4.2.gemfile.lock +143 -140
  22. data/gemfiles/5.0.gemfile +37 -0
  23. data/gemfiles/5.0.gemfile.lock +238 -0
  24. data/gemfiles/5.1.gemfile +38 -0
  25. data/gemfiles/5.1.gemfile.lock +254 -0
  26. data/gemfiles/5.2.gemfile +40 -0
  27. data/gemfiles/5.2.gemfile.lock +273 -0
  28. data/lib/shoulda/matchers/action_controller/callback_matcher.rb +18 -6
  29. data/lib/shoulda/matchers/action_controller/permit_matcher.rb +6 -1
  30. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +1 -1
  31. data/lib/shoulda/matchers/action_controller/route_matcher.rb +87 -27
  32. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +1 -0
  33. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +0 -4
  34. data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +5 -0
  35. data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +5 -0
  36. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +26 -11
  37. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +39 -4
  38. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +116 -47
  39. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +127 -38
  40. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +55 -37
  41. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +30 -1
  42. data/lib/shoulda/matchers/active_model/validation_matcher.rb +11 -4
  43. data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +11 -6
  44. data/lib/shoulda/matchers/active_record.rb +3 -0
  45. data/lib/shoulda/matchers/active_record/association_matcher.rb +172 -22
  46. data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +1 -1
  47. data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +11 -6
  48. data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +46 -0
  49. data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +51 -0
  50. data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +268 -38
  51. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
  52. data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +111 -0
  53. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +207 -79
  54. data/lib/shoulda/matchers/doublespeak/object_double.rb +5 -1
  55. data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +100 -21
  56. data/lib/shoulda/matchers/rails_shim.rb +133 -52
  57. data/lib/shoulda/matchers/routing.rb +2 -2
  58. data/lib/shoulda/matchers/util.rb +23 -1
  59. data/lib/shoulda/matchers/util/word_wrap.rb +6 -2
  60. data/lib/shoulda/matchers/version.rb +1 -1
  61. data/script/install_gems_in_all_appraisals +3 -1
  62. data/script/run_all_tests +3 -1
  63. data/script/supported_ruby_versions +7 -0
  64. data/script/update_gem_in_all_appraisals +3 -1
  65. data/script/update_gems_in_all_appraisals +3 -1
  66. data/shoulda-matchers.gemspec +3 -3
  67. data/spec/acceptance/independent_matchers_spec.rb +2 -2
  68. data/spec/acceptance/multiple_libraries_integration_spec.rb +1 -1
  69. data/spec/acceptance/rails_integration_spec.rb +2 -2
  70. data/spec/spec_helper.rb +2 -3
  71. data/spec/support/acceptance/helpers.rb +2 -0
  72. data/spec/support/acceptance/helpers/command_helpers.rb +17 -4
  73. data/spec/support/acceptance/helpers/rails_migration_helpers.rb +21 -0
  74. data/spec/support/acceptance/helpers/step_helpers.rb +1 -1
  75. data/spec/support/tests/current_bundle.rb +3 -9
  76. data/spec/support/tests/filesystem.rb +2 -2
  77. data/spec/support/unit/attribute.rb +0 -2
  78. data/spec/support/unit/capture.rb +9 -3
  79. data/spec/support/unit/helpers/action_pack_versions.rb +22 -0
  80. data/spec/support/unit/helpers/active_model_versions.rb +4 -0
  81. data/spec/support/unit/helpers/active_record_versions.rb +22 -2
  82. data/spec/support/unit/helpers/active_resource_builder.rb +2 -2
  83. data/spec/support/unit/helpers/controller_builder.rb +1 -1
  84. data/spec/support/unit/helpers/message_helpers.rb +19 -0
  85. data/spec/support/unit/helpers/rails_versions.rb +14 -0
  86. data/spec/support/unit/matchers/fail_with_message_matcher.rb +7 -5
  87. data/spec/support/unit/matchers/print_warning_including.rb +21 -13
  88. data/spec/support/unit/model_creation_strategies/active_record.rb +1 -1
  89. data/spec/support/unit/model_creators/active_record.rb +0 -1
  90. data/spec/support/unit/model_creators/basic.rb +7 -2
  91. data/spec/support/unit/rails_application.rb +25 -0
  92. data/spec/support/unit/record_validating_confirmation_builder.rb +5 -2
  93. data/spec/support/unit/validation_matcher_scenario.rb +0 -2
  94. data/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +18 -18
  95. data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +33 -5
  96. data/spec/unit/shoulda/matchers/action_controller/render_template_matcher_spec.rb +1 -1
  97. data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +80 -78
  98. data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +7 -9
  99. data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +28 -4
  100. data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +19 -1
  101. data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +27 -4
  102. data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +62 -5
  103. data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +52 -18
  104. data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +51 -4
  105. data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +99 -71
  106. data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +41 -15
  107. data/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +445 -15
  108. data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +615 -93
  109. data/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb +169 -0
  110. data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +167 -97
  111. data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +2 -4
  112. data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +152 -19
  113. data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +258 -94
  114. data/spec/unit_spec_helper.rb +9 -1
  115. data/zeus.json +1 -1
  116. metadata +31 -16
  117. data/gemfiles/4.0.0.gemfile +0 -38
  118. data/gemfiles/4.0.0.gemfile.lock +0 -223
  119. data/gemfiles/4.0.1.gemfile +0 -38
  120. data/gemfiles/4.0.1.gemfile.lock +0 -225
  121. data/gemfiles/4.1.gemfile +0 -38
  122. data/gemfiles/4.1.gemfile.lock +0 -220
  123. data/script/SUPPORTED_VERSIONS +0 -1
@@ -0,0 +1 @@
1
+ 2.7.15
@@ -1,5 +1,7 @@
1
1
  inherit_from: .hound/ruby.yml
2
- Style/AlignParameters:
2
+ AllCops:
3
+ TargetRubyVersion: 2.4
4
+ Layout/AlignParameters:
3
5
  EnforcedStyle: with_fixed_indentation
4
6
  Style/CollectionMethods:
5
7
  PreferredMethods:
@@ -9,12 +9,13 @@ env:
9
9
  - DATABASE_ADAPTER=postgresql
10
10
 
11
11
  rvm:
12
- - 2.0
13
- - 2.1
14
- - 2.2
12
+ - 2.5.1
13
+ - 2.4.4
14
+ - 2.3.7
15
+ - 2.2.8
15
16
 
16
17
  gemfile:
17
- - gemfiles/4.0.0.gemfile
18
- - gemfiles/4.0.1.gemfile
19
- - gemfiles/4.1.gemfile
20
18
  - gemfiles/4.2.gemfile
19
+ - gemfiles/5.0.gemfile
20
+ - gemfiles/5.1.gemfile
21
+ - gemfiles/5.2.gemfile
data/Appraisals CHANGED
@@ -1,10 +1,9 @@
1
- ruby_version = Gem::Version.new(RUBY_VERSION + '')
1
+ # Note: All of the dependencies here were obtained by running `rails new` with
2
+ # various versions of Rails and copying lines from the generated Gemfile. It's
3
+ # best to keep the gems here in the same order as they're listed there so you
4
+ # can compare them more easily.
2
5
 
3
- shared_dependencies = proc do
4
- gem 'rspec-rails', '>= 3.2.0', '< 4'
5
- gem 'shoulda-context', '~> 1.2.0'
6
- gem 'sqlite3', platform: :ruby
7
- gem 'pg', platform: :ruby
6
+ shared_jruby_dependencies = proc do
8
7
  gem 'activerecord-jdbc-adapter', platform: :jruby
9
8
  gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
10
9
  gem 'jdbc-sqlite3', platform: :jruby
@@ -12,62 +11,95 @@ shared_dependencies = proc do
12
11
  gem 'therubyrhino', platform: :jruby
13
12
  end
14
13
 
15
- spring = proc do
14
+ shared_rails_dependencies = proc do
15
+ gem 'sqlite3', platform: :ruby
16
+ gem 'pg', platform: :ruby
17
+ end
18
+
19
+ shared_spring_dependencies = proc do
16
20
  gem 'spring'
17
21
  gem 'spring-commands-rspec'
18
22
  end
19
23
 
20
- rails_4 = proc do
24
+ shared_test_dependencies = proc do
25
+ gem 'minitest-reporters'
26
+ # gem 'nokogiri', '~> 1.8'
27
+ gem 'rspec-rails', '~> 3.6'
28
+ gem 'shoulda-context', '~> 1.2.0'
29
+ end
30
+
31
+ shared_dependencies = proc do
32
+ instance_eval(&shared_jruby_dependencies)
33
+ instance_eval(&shared_rails_dependencies)
34
+ instance_eval(&shared_spring_dependencies)
35
+ instance_eval(&shared_test_dependencies)
36
+ end
37
+
38
+ appraise '4.2' do
21
39
  instance_eval(&shared_dependencies)
22
- instance_eval(&spring)
40
+
41
+ gem 'rails', '~> 4.2.9'
42
+ gem 'sass-rails', '~> 5.0'
23
43
  gem 'uglifier', '>= 1.3.0'
24
- gem 'coffee-rails', '~> 4.0.0'
44
+ gem 'coffee-rails', '~> 4.1.0'
25
45
  gem 'jquery-rails'
26
46
  gem 'turbolinks'
27
- gem 'sdoc'
47
+ gem 'jbuilder', '~> 2.0'
48
+ gem 'sdoc', '~> 0.4.0', group: :doc
49
+ gem 'bcrypt', '~> 3.1.7'
50
+
51
+ # Other dependencies we use
28
52
  gem 'activeresource', '4.0.0'
29
- # Test suite makes heavy use of attr_accessible
30
- gem 'protected_attributes'
31
- gem 'minitest-reporters'
53
+ gem 'json', '~> 1.4'
54
+ gem 'protected_attributes', '~> 1.0.6'
32
55
  end
33
56
 
34
- #---
57
+ appraise '5.0' do
58
+ instance_eval(&shared_dependencies)
35
59
 
36
- appraise '4.0.0' do
37
- instance_eval(&rails_4)
38
- gem 'rails', '4.0.0'
39
- gem 'jbuilder', '~> 1.2'
40
- gem 'sass-rails', '~> 4.0.0'
41
- gem 'bcrypt-ruby', '~> 3.0.0'
60
+ gem 'rails', '~> 5.0.6'
61
+ gem 'rails-controller-testing', '>= 1.0.1'
62
+ gem 'puma', '~> 3.0'
63
+ gem 'sass-rails', '~> 5.0'
64
+ gem 'jquery-rails'
65
+ gem 'turbolinks', '~> 5'
66
+ gem 'jbuilder', '~> 2.5'
67
+ gem 'bcrypt', '~> 3.1.7'
68
+ gem 'listen', '~> 3.0.5'
69
+ gem 'spring-watcher-listen', '~> 2.0.0'
42
70
  end
43
71
 
44
- appraise '4.0.1' do
45
- instance_eval(&rails_4)
46
- gem 'rails', '4.0.1'
47
- gem 'jbuilder', '~> 1.2'
48
- gem 'sass-rails', '~> 4.0.0'
49
- gem 'bcrypt-ruby', '~> 3.1.2'
50
- end
72
+ appraise '5.1' do
73
+ instance_eval(&shared_dependencies)
51
74
 
52
- appraise '4.1' do
53
- instance_eval(&rails_4)
54
- gem 'rails', '~> 4.1.0'
55
- gem 'jbuilder', '~> 2.0'
56
- gem 'sass-rails', '~> 4.0.3'
57
- gem 'sdoc', '~> 0.4.0'
75
+ gem 'rails', '~> 5.1.6'
76
+ gem 'rails-controller-testing', '>= 1.0.1'
77
+ gem 'puma', '~> 3.7'
78
+ gem 'sass-rails', '~> 5.0'
79
+ gem 'turbolinks', '~> 5'
80
+ gem 'jbuilder', '~> 2.5'
58
81
  gem 'bcrypt', '~> 3.1.7'
59
- gem 'protected_attributes', "~> 1.0.6"
60
- gem 'spring'
82
+ gem 'capybara', '~> 2.13'
83
+ gem 'selenium-webdriver'
84
+ gem 'listen', '>= 3.0.5', '< 3.2'
85
+ gem 'spring-watcher-listen', '~> 2.0.0'
61
86
  end
62
87
 
63
- appraise '4.2' do
64
- instance_eval(&rails_4)
65
- gem 'rails', '~> 4.2.0'
88
+
89
+ appraise '5.2' do
90
+ instance_eval(&shared_dependencies)
91
+
92
+ gem 'rails', '~> 5.2.1'
93
+ gem 'rails-controller-testing', '>= 1.0.1'
94
+ gem 'puma', '~> 3.11'
95
+ gem 'bootsnap', '>= 1.1.0', require: false
66
96
  gem 'sass-rails', '~> 5.0'
67
- gem 'coffee-rails', '~> 4.1.0'
68
- gem 'jbuilder', '~> 2.0'
69
- gem 'sdoc', '~> 0.4.0'
97
+ gem 'turbolinks', '~> 5'
98
+ gem 'jbuilder', '~> 2.5'
70
99
  gem 'bcrypt', '~> 3.1.7'
71
- gem 'spring'
72
- gem 'protected_attributes', "~> 1.0.6"
100
+ gem 'capybara', '~> 3.1.1'
101
+ gem 'selenium-webdriver'
102
+ gem 'chromedriver-helper'
103
+ gem 'listen', '>= 3.0.5', '< 3.2'
104
+ gem 'spring-watcher-listen', '~> 2.0.0'
73
105
  end
@@ -1,101 +1,172 @@
1
- # Contributing to shoulda-matchers
1
+ # Contributing to Shoulda Matchers
2
+
3
+ We've put a lot of work into making improvements to Shoulda Matchers, but we
4
+ always welcome changes and improvements from the community!
5
+
6
+ If you'd like to propose a change to the gem, whether it's a fix for a problem
7
+ you've been running into or an idea for a new feature you think would be useful,
8
+ here's how the process works:
9
+
10
+ 1. [Read and understand the Code of Conduct](#code-of-conduct).
11
+ 1. Fork this repo and clone your fork to somewhere on your machine.
12
+ 1. [Ensure that you have a working environment](#setting-up-your-environment).
13
+ 1. Read up on the [architecture of the gem](#architecture), [how to run
14
+ tests](#running-tests), and [the code style we use in this
15
+ project](#code-style).
16
+ 1. Cut a new branch and write a failing test for the feature or bugfix you plan
17
+ on implementing.
18
+ 1. [Make sure your branch is well managed as you go
19
+ along](#managing-your-branch).
20
+ 1. [Update the inline documentation if you're making a change to the
21
+ API](#documentation).
22
+ 1. [Refrain from updating the changelog.](#a-word-on-the-changelog)
23
+ 1. Finally, push to your fork and submit a pull request.
2
24
 
3
- We love contributions from the community! Here's a quick guide to making a pull
4
- request.
25
+ Although we maintain the gem in our free time, we try to respond within a day or
26
+ so. After submitting your PR, we may give you feedback. For instance, we may
27
+ suggest some changes to make to your code to fit within the project style or
28
+ discuss alternate ways of addressing the issue in question. Assuming we're happy
29
+ with everything, we'll bring your changes into master!
5
30
 
6
- 1. If you haven't contributed before, please read and understand the [Code of
7
- Conduct].
31
+ ---
8
32
 
9
- 1. Ensure that you have a [working Ruby environment].
33
+ ## Code of Conduct
10
34
 
11
- 1. Fork the repo on GitHub, then clone it to your machine.
35
+ If this is your first time contributing, please read the [Code of Conduct]. We
36
+ want to create a space in which everyone is allowed to contribute, and we
37
+ enforce the policies outline in this document.
12
38
 
13
- 1. Now that you've cloned the repo, navigate to it and install dependencies by
14
- running:
39
+ [Code of Conduct]: https://thoughtbot.com/open-source-code-of-conduct
15
40
 
16
- ```
17
- bundle install
18
- ```
41
+ ## Setting up your environment
19
42
 
20
- 1. All tests should be passing, but it's a good idea to run them anyway
21
- before starting any work:
22
-
23
- ```
24
- bundle exec rake
25
- ```
43
+ The setup script will install all dependencies necessary for working on the
44
+ project:
26
45
 
27
- 1. If you're adding functionality or fixing a bug, you'll want to add a
28
- failing test for the issue first.
46
+ ```bash
47
+ bin/setup
48
+ ```
29
49
 
30
- 1. Now you can implement the feature or bugfix.
50
+ ## Architecture
31
51
 
32
- 1. Since we only accept pull requests with passing tests, it's a good idea to
33
- run the tests again. Since you're probably working on a single file, you can
34
- run the tests for that file with the following command:
52
+ This project follows the typical structure for a gem: code is located in `lib`
53
+ and tests are in `spec`.
35
54
 
36
- ```
37
- appraisal 4.2 rspec <path of test file to run>
38
- ```
55
+ All of the matchers are broken up by the type of example group they apply to:
39
56
 
40
- You can also run unit tests by running `zeus start` in one shell, and then
41
- running the following in another:
57
+ * `{lib,spec/unit}/shoulda/matchers/action_controller*` for ActionController
58
+ matchers
59
+ * `{lib,spec/unit}/shoulda/matchers/active_model*` for ActiveModel matchers
60
+ * `{lib,spec/unit}/shoulda/matchers/active_record*` for ActiveRecord matchers
61
+ * `{lib,spec/unit}/shoulda/matchers/independent*` for matchers that can be used
62
+ in any example group
42
63
 
43
- ```
44
- zeus rspec <path of test file to run>
45
- ```
64
+ There are other files in the project, of course, but there are likely the ones
65
+ that you'll be interested in.
46
66
 
47
- And to run the entire test suite again:
48
-
49
- ```
50
- bundle exec rake
51
- ```
67
+ In addition, tests are broken up into two categories:
52
68
 
53
- 1. Finally, push to your fork and submit a pull request.
69
+ * `spec/unit`
70
+ * `spec/acceptance`
71
+
72
+ A word about the tests, by the way: they're admittedly the most complicated part
73
+ of this gem, and there are a few different strategies that we've introduced at
74
+ various points in time to set up objects for tests across all specs, some of
75
+ which are old and some of which are new. The best approach for writing tests is
76
+ probably to copy an existing test in the same file as where you want to add a
77
+ new test.
78
+
79
+ ## Code style
80
+
81
+ We follow a derivative of the [unofficial Ruby style guide] created by the
82
+ Rubocop developers. You can view our Rubocop configuration [here], but here are
83
+ some key differences:
84
+
85
+ * Use single quotes for strings.
86
+ * When breaking up methods across multiple lines, place the `.` at the end of
87
+ the line instead of the beginning.
88
+ * Don't use conditional modifiers (i.e. `x if y`); place the beginning and
89
+ ending of conditionals on their own lines.
90
+ * Use an 80-character line-length except for `describe`, `context`, `it`, and
91
+ `specify` lines in tests.
92
+ * For arrays, hashes, and method arguments that span multiple lines, place a
93
+ trailing comma at the end of the last item.
94
+ * Collection methods are spelled `detect`, `inject`, `map`, and `select`.
95
+
96
+ [unofficial Ruby style guide]: https://github.com/rubocop-hq/ruby-style-guide
97
+ [here]: .rubocop.yml
54
98
 
55
- At this point you're waiting on us. We try to respond to issues and pull
56
- requests within a few business days. We may suggest some changes to make to your
57
- code to fit with our [code style] or the project style, or discuss alternate
58
- ways of addressing the issue in question. When we're happy with everything,
59
- we'll bring your changes into master. Now you're a contributor!
99
+ ## Running tests
60
100
 
61
- ## Addendum: Setting up your environment
101
+ ### Unit tests
62
102
 
63
- ### Installing dependencies (Linux only)
103
+ Unit tests are the most common kind of tests in the gem. They exercise matcher
104
+ code file by file in the context of a real Rails application. This application
105
+ is created and loaded every time you run `rspec`. Because of this, it can be
106
+ expensive to run individual tests. To save time, the best way to run unit tests
107
+ is by using [Zeus].
64
108
 
65
- #### Debian/Ubuntu
109
+ [Zeus]: https://github.com/burke/zeus
66
110
 
67
- Run this command to install necessary dependencies:
111
+ You'll want to start by running `zeus start` in one shell. Then in another
112
+ shell, instead of using `bundle exec rspec` to run tests, you'll use `bundle
113
+ exec zeus rspec`. So for instance, you might say:
68
114
 
69
115
  ```
70
- sudo apt-get install -y ruby-dev libpq-dev libsqlite3-dev nodejs
116
+ bundle exec zeus rspec spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb
71
117
  ```
72
118
 
73
- #### RedHat
119
+ ### Acceptance tests
74
120
 
75
- Run this command to install necessary dependencies:
121
+ The acceptance tests exercise matchers in the context of a real Ruby or Rails
122
+ application. Unlike unit tests, this application is set up and torn down for
123
+ each test.
124
+
125
+ Whereas you make use of Zeus to run unit tests, you make use of Appraisal for
126
+ acceptance tests. [Appraisal] lets you run tests against multiple versions of
127
+ Rails and Ruby, and in fact, this is baked into the test suite. This means that
128
+ if you're trying to run a single test file, you'll need to specify which
129
+ appraisal to use. For instance, you can't simply say:
130
+
131
+ [Appraisal]: https://github.com/thoughtbot/appraisal
76
132
 
77
133
  ```
78
- sudo yum install -y ruby-devel postgresql-devel sqlite-devel zlib-devel
134
+ bundle exec rspec spec/acceptance/active_model_integration_spec.rb
79
135
  ```
80
136
 
81
- Then, install one of the JavaScript runtimes supported by [execjs]. For
82
- instance, to install node.js:
137
+ Instead, you need to say
83
138
 
84
139
  ```
85
- sudo su
86
- curl -sL https://rpm.nodesource.com/setup | bash -
87
- yum install -y nodejs
140
+ bundle exec appraisal 5.1 rspec spec/acceptance/active_model_integration_spec.rb
88
141
  ```
89
142
 
90
- ### Installing Ruby (all platforms)
143
+ ## Managing your branch
91
144
 
92
- shoulda-matchers is only compatible with Ruby 2.x. A `.ruby-version` is included
93
- in the repo, so if you're using one of the Ruby version manager tools, then you
94
- should be using (or have been prompted to install) the latest version of Ruby.
95
- If not, you'll want to do that.
145
+ * Use well-crafted commit messages, providing context if possible. [tpope's
146
+ guide] was a wonderful piece on this topic when it came out and we still find
147
+ it to be helpful even today.
148
+ * Squash "WIP" commits and remove merge commits by rebasing. We try to keep our
149
+ commit history as clean as possible.
96
150
 
97
- [working Ruby environment]: #addendum-setting-up-your-environment
98
- [Code of Conduct]: https://thoughtbot.com/open-source-code-of-conduct
99
- [code style]: https://github.com/thoughtbot/guides/tree/master/style
100
- [execjs]: https://github.com/sstephenson/execjs
101
- [install rvm]: https://rvm.io/rvm/install
151
+ [tpope's guide]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
152
+
153
+ ## Documentation
154
+
155
+ As you navigate the codebase, you may notice that each class and method in the
156
+ public API is prefaced with inline documentation, which can be viewed
157
+ [online][rubydocs]. This documentation is written and generated using
158
+ [YARD][yard].
159
+
160
+ [rubydocs]: https://matchers.shoulda.io/docs
161
+ [yard]: https://github.com/lsegal/yard
162
+
163
+ We ensure that the documentation is up to date before we issue a release, but
164
+ sometimes we don't catch everything. So if your changes end up extending or
165
+ updating the API, it's a big help if you can update the documentation to match
166
+ and submit those changes in your PR.
167
+
168
+ ## A word on the changelog
169
+
170
+ You may also notice that we have a changelog in the form of [NEWS.md](NEWS.md).
171
+ You may be tempted to include changes to this in your branch, but don't worry
172
+ about this -- we'll take care of it!
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'appraisal', '~> 2.0'
3
+ gem 'appraisal', '2.2.0'
4
4
  gem 'bundler', '~> 1.1'
5
- gem 'pry', git: 'https://github.com/pry/pry.git'
5
+ gem 'pry'
6
6
  gem 'pry-byebug'
7
- gem 'rake', '>= 10.5.0', '< 11'
8
- gem 'rspec', '~> 3.2'
9
- gem 'zeus'
7
+ gem 'rake', '12.3.0'
8
+ gem 'rspec', '~> 3.6'
9
+ gem 'zeus', require: false
10
10
 
11
11
  # YARD
12
12
  gem 'yard'
@@ -1,64 +1,59 @@
1
- GIT
2
- remote: https://github.com/pry/pry.git
3
- revision: 1f64463184e0a160d0b41d1a1f92b8e2f230278c
4
- specs:
5
- pry (0.10.4)
6
- coderay (~> 1.1.0)
7
- method_source (~> 0.8.1)
8
-
9
1
  GEM
10
2
  remote: https://rubygems.org/
11
3
  specs:
12
- appraisal (2.1.0)
4
+ appraisal (2.2.0)
13
5
  bundler
14
6
  rake
15
7
  thor (>= 0.14.0)
16
- byebug (9.0.6)
17
- coderay (1.1.1)
18
- diff-lcs (1.2.5)
8
+ byebug (9.1.0)
9
+ coderay (1.1.2)
10
+ diff-lcs (1.3)
19
11
  fssm (0.2.10)
20
- method_source (0.8.2)
12
+ method_source (0.9.0)
21
13
  multi_json (1.12.1)
22
- pry-byebug (3.4.2)
23
- byebug (~> 9.0)
14
+ pry (0.11.3)
15
+ coderay (~> 1.1.0)
16
+ method_source (~> 0.9.0)
17
+ pry-byebug (3.5.1)
18
+ byebug (~> 9.1)
24
19
  pry (~> 0.10)
25
20
  pygments.rb (1.1.1)
26
21
  multi_json (>= 1.0.0)
27
- rake (10.5.0)
22
+ rake (12.3.0)
28
23
  redcarpet (3.4.0)
29
- rspec (3.5.0)
30
- rspec-core (~> 3.5.0)
31
- rspec-expectations (~> 3.5.0)
32
- rspec-mocks (~> 3.5.0)
33
- rspec-core (3.5.4)
34
- rspec-support (~> 3.5.0)
35
- rspec-expectations (3.5.0)
24
+ rspec (3.6.0)
25
+ rspec-core (~> 3.6.0)
26
+ rspec-expectations (~> 3.6.0)
27
+ rspec-mocks (~> 3.6.0)
28
+ rspec-core (3.6.0)
29
+ rspec-support (~> 3.6.0)
30
+ rspec-expectations (3.6.0)
36
31
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.5.0)
38
- rspec-mocks (3.5.0)
32
+ rspec-support (~> 3.6.0)
33
+ rspec-mocks (3.6.0)
39
34
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.5.0)
41
- rspec-support (3.5.0)
42
- thor (0.19.4)
43
- yard (0.9.6)
44
- zeus (0.15.12)
35
+ rspec-support (~> 3.6.0)
36
+ rspec-support (3.6.0)
37
+ thor (0.20.0)
38
+ yard (0.9.12)
39
+ zeus (0.15.14)
45
40
  method_source (>= 0.6.7)
46
41
 
47
42
  PLATFORMS
48
43
  ruby
49
44
 
50
45
  DEPENDENCIES
51
- appraisal (~> 2.0)
46
+ appraisal (= 2.2.0)
52
47
  bundler (~> 1.1)
53
48
  fssm
54
- pry!
49
+ pry
55
50
  pry-byebug
56
51
  pygments.rb
57
- rake (>= 10.5.0, < 11)
52
+ rake (= 12.3.0)
58
53
  redcarpet
59
- rspec (~> 3.2)
54
+ rspec (~> 3.6)
60
55
  yard
61
56
  zeus
62
57
 
63
58
  BUNDLED WITH
64
- 1.13.6
59
+ 1.16.1