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.
- checksums.yaml +4 -4
- data/.hound/ruby.yml +336 -316
- data/.python-version +1 -0
- data/.rubocop.yml +3 -1
- data/.travis.yml +7 -6
- data/Appraisals +76 -44
- data/CONTRIBUTING.md +137 -66
- data/Gemfile +5 -5
- data/Gemfile.lock +30 -35
- data/MAINTAINING.md +250 -0
- data/MIT-LICENSE +1 -1
- data/NEWS.md +176 -4
- data/README.md +138 -200
- data/Rakefile +7 -0
- data/bin/setup +190 -0
- data/doc_config/yard/templates/default/fulldoc/html/css/global.css +4 -0
- data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +0 -6
- data/doc_config/yard/templates/default/fulldoc/html/js/app.js +0 -17
- data/doc_config/yard/templates/default/fulldoc/html/setup.rb +27 -0
- data/gemfiles/4.2.gemfile +21 -20
- data/gemfiles/4.2.gemfile.lock +143 -140
- data/gemfiles/5.0.gemfile +37 -0
- data/gemfiles/5.0.gemfile.lock +238 -0
- data/gemfiles/5.1.gemfile +38 -0
- data/gemfiles/5.1.gemfile.lock +254 -0
- data/gemfiles/5.2.gemfile +40 -0
- data/gemfiles/5.2.gemfile.lock +273 -0
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +18 -6
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +6 -1
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +1 -1
- data/lib/shoulda/matchers/action_controller/route_matcher.rb +87 -27
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +1 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +0 -4
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +5 -0
- data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +5 -0
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +26 -11
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +39 -4
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +116 -47
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +127 -38
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +55 -37
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +30 -1
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +11 -4
- data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +11 -6
- data/lib/shoulda/matchers/active_record.rb +3 -0
- data/lib/shoulda/matchers/active_record/association_matcher.rb +172 -22
- data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +11 -6
- data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +46 -0
- data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +51 -0
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +268 -38
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +111 -0
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +207 -79
- data/lib/shoulda/matchers/doublespeak/object_double.rb +5 -1
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +100 -21
- data/lib/shoulda/matchers/rails_shim.rb +133 -52
- data/lib/shoulda/matchers/routing.rb +2 -2
- data/lib/shoulda/matchers/util.rb +23 -1
- data/lib/shoulda/matchers/util/word_wrap.rb +6 -2
- data/lib/shoulda/matchers/version.rb +1 -1
- data/script/install_gems_in_all_appraisals +3 -1
- data/script/run_all_tests +3 -1
- data/script/supported_ruby_versions +7 -0
- data/script/update_gem_in_all_appraisals +3 -1
- data/script/update_gems_in_all_appraisals +3 -1
- data/shoulda-matchers.gemspec +3 -3
- data/spec/acceptance/independent_matchers_spec.rb +2 -2
- data/spec/acceptance/multiple_libraries_integration_spec.rb +1 -1
- data/spec/acceptance/rails_integration_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -3
- data/spec/support/acceptance/helpers.rb +2 -0
- data/spec/support/acceptance/helpers/command_helpers.rb +17 -4
- data/spec/support/acceptance/helpers/rails_migration_helpers.rb +21 -0
- data/spec/support/acceptance/helpers/step_helpers.rb +1 -1
- data/spec/support/tests/current_bundle.rb +3 -9
- data/spec/support/tests/filesystem.rb +2 -2
- data/spec/support/unit/attribute.rb +0 -2
- data/spec/support/unit/capture.rb +9 -3
- data/spec/support/unit/helpers/action_pack_versions.rb +22 -0
- data/spec/support/unit/helpers/active_model_versions.rb +4 -0
- data/spec/support/unit/helpers/active_record_versions.rb +22 -2
- data/spec/support/unit/helpers/active_resource_builder.rb +2 -2
- data/spec/support/unit/helpers/controller_builder.rb +1 -1
- data/spec/support/unit/helpers/message_helpers.rb +19 -0
- data/spec/support/unit/helpers/rails_versions.rb +14 -0
- data/spec/support/unit/matchers/fail_with_message_matcher.rb +7 -5
- data/spec/support/unit/matchers/print_warning_including.rb +21 -13
- data/spec/support/unit/model_creation_strategies/active_record.rb +1 -1
- data/spec/support/unit/model_creators/active_record.rb +0 -1
- data/spec/support/unit/model_creators/basic.rb +7 -2
- data/spec/support/unit/rails_application.rb +25 -0
- data/spec/support/unit/record_validating_confirmation_builder.rb +5 -2
- data/spec/support/unit/validation_matcher_scenario.rb +0 -2
- data/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +18 -18
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +33 -5
- data/spec/unit/shoulda/matchers/action_controller/render_template_matcher_spec.rb +1 -1
- data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +80 -78
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +7 -9
- data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +28 -4
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +19 -1
- data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +27 -4
- data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +62 -5
- data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +52 -18
- data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +51 -4
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +99 -71
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +41 -15
- data/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +445 -15
- data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +615 -93
- data/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb +169 -0
- data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +167 -97
- data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +2 -4
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +152 -19
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +258 -94
- data/spec/unit_spec_helper.rb +9 -1
- data/zeus.json +1 -1
- metadata +31 -16
- data/gemfiles/4.0.0.gemfile +0 -38
- data/gemfiles/4.0.0.gemfile.lock +0 -223
- data/gemfiles/4.0.1.gemfile +0 -38
- data/gemfiles/4.0.1.gemfile.lock +0 -225
- data/gemfiles/4.1.gemfile +0 -38
- data/gemfiles/4.1.gemfile.lock +0 -220
- data/script/SUPPORTED_VERSIONS +0 -1
data/.python-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.15
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -9,12 +9,13 @@ env:
|
|
9
9
|
- DATABASE_ADAPTER=postgresql
|
10
10
|
|
11
11
|
rvm:
|
12
|
-
- 2.
|
13
|
-
- 2.
|
14
|
-
- 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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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.
|
44
|
+
gem 'coffee-rails', '~> 4.1.0'
|
25
45
|
gem 'jquery-rails'
|
26
46
|
gem 'turbolinks'
|
27
|
-
gem '
|
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
|
-
|
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
|
-
|
37
|
-
|
38
|
-
gem '
|
39
|
-
gem '
|
40
|
-
gem '
|
41
|
-
gem '
|
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 '
|
45
|
-
instance_eval(&
|
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
|
-
|
53
|
-
|
54
|
-
gem '
|
55
|
-
gem '
|
56
|
-
gem '
|
57
|
-
gem '
|
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 '
|
60
|
-
gem '
|
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
|
-
|
64
|
-
|
65
|
-
|
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 '
|
68
|
-
gem 'jbuilder', '~> 2.
|
69
|
-
gem 'sdoc', '~> 0.4.0'
|
97
|
+
gem 'turbolinks', '~> 5'
|
98
|
+
gem 'jbuilder', '~> 2.5'
|
70
99
|
gem 'bcrypt', '~> 3.1.7'
|
71
|
-
gem '
|
72
|
-
gem '
|
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
|
data/CONTRIBUTING.md
CHANGED
@@ -1,101 +1,172 @@
|
|
1
|
-
# Contributing to
|
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
|
-
|
4
|
-
|
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
|
-
|
7
|
-
Conduct].
|
31
|
+
---
|
8
32
|
|
9
|
-
|
33
|
+
## Code of Conduct
|
10
34
|
|
11
|
-
|
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
|
-
|
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
|
-
|
21
|
-
|
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
|
-
|
28
|
-
|
46
|
+
```bash
|
47
|
+
bin/setup
|
48
|
+
```
|
29
49
|
|
30
|
-
|
50
|
+
## Architecture
|
31
51
|
|
32
|
-
|
33
|
-
|
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
|
-
|
41
|
-
|
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
|
-
|
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
|
-
|
48
|
-
|
49
|
-
```
|
50
|
-
bundle exec rake
|
51
|
-
```
|
67
|
+
In addition, tests are broken up into two categories:
|
52
68
|
|
53
|
-
|
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
|
-
|
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
|
-
|
101
|
+
### Unit tests
|
62
102
|
|
63
|
-
|
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
|
-
|
109
|
+
[Zeus]: https://github.com/burke/zeus
|
66
110
|
|
67
|
-
|
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
|
-
|
116
|
+
bundle exec zeus rspec spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb
|
71
117
|
```
|
72
118
|
|
73
|
-
|
119
|
+
### Acceptance tests
|
74
120
|
|
75
|
-
|
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
|
-
|
134
|
+
bundle exec rspec spec/acceptance/active_model_integration_spec.rb
|
79
135
|
```
|
80
136
|
|
81
|
-
|
82
|
-
instance, to install node.js:
|
137
|
+
Instead, you need to say
|
83
138
|
|
84
139
|
```
|
85
|
-
|
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
|
-
|
143
|
+
## Managing your branch
|
91
144
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
-
[
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
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', '
|
3
|
+
gem 'appraisal', '2.2.0'
|
4
4
|
gem 'bundler', '~> 1.1'
|
5
|
-
gem 'pry'
|
5
|
+
gem 'pry'
|
6
6
|
gem 'pry-byebug'
|
7
|
-
gem 'rake', '
|
8
|
-
gem 'rspec', '~> 3.
|
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'
|
data/Gemfile.lock
CHANGED
@@ -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.
|
4
|
+
appraisal (2.2.0)
|
13
5
|
bundler
|
14
6
|
rake
|
15
7
|
thor (>= 0.14.0)
|
16
|
-
byebug (9.0
|
17
|
-
coderay (1.1.
|
18
|
-
diff-lcs (1.
|
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.
|
12
|
+
method_source (0.9.0)
|
21
13
|
multi_json (1.12.1)
|
22
|
-
pry
|
23
|
-
|
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 (
|
22
|
+
rake (12.3.0)
|
28
23
|
redcarpet (3.4.0)
|
29
|
-
rspec (3.
|
30
|
-
rspec-core (~> 3.
|
31
|
-
rspec-expectations (~> 3.
|
32
|
-
rspec-mocks (~> 3.
|
33
|
-
rspec-core (3.
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-expectations (3.
|
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.
|
38
|
-
rspec-mocks (3.
|
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.
|
41
|
-
rspec-support (3.
|
42
|
-
thor (0.
|
43
|
-
yard (0.9.
|
44
|
-
zeus (0.15.
|
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 (
|
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 (
|
52
|
+
rake (= 12.3.0)
|
58
53
|
redcarpet
|
59
|
-
rspec (~> 3.
|
54
|
+
rspec (~> 3.6)
|
60
55
|
yard
|
61
56
|
zeus
|
62
57
|
|
63
58
|
BUNDLED WITH
|
64
|
-
1.
|
59
|
+
1.16.1
|