shoulda-matchers 4.0.0.rc1 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +72 -40
- data/lib/shoulda/matchers/action_controller.rb +2 -0
- data/lib/shoulda/matchers/active_model.rb +2 -3
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +1 -0
- data/lib/shoulda/matchers/active_record.rb +2 -0
- data/lib/shoulda/matchers/active_record/association_matcher.rb +34 -0
- data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +27 -4
- data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +27 -4
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +1 -1
- data/lib/shoulda/matchers/independent.rb +2 -1
- data/lib/shoulda/matchers/rails_shim.rb +5 -9
- data/lib/shoulda/matchers/version.rb +1 -1
- data/lib/shoulda/matchers/warn.rb +1 -0
- data/shoulda-matchers.gemspec +11 -3
- metadata +13 -340
- data/.gitignore +0 -12
- data/.hound.yml +0 -3
- data/.hound/ruby.yml +0 -1062
- data/.python-version +0 -1
- data/.rubocop.yml +0 -15
- data/.travis.yml +0 -21
- data/.yardopts +0 -10
- data/Appraisals +0 -105
- data/CONTRIBUTING.md +0 -172
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -59
- data/MAINTAINING.md +0 -250
- data/NEWS.md +0 -1235
- data/Rakefile +0 -46
- data/bin/setup +0 -190
- data/custom_plan.rb +0 -104
- data/doc_config/gh-pages/index.html.erb +0 -9
- data/doc_config/yard/setup.rb +0 -22
- data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +0 -5967
- data/doc_config/yard/templates/default/fulldoc/html/css/full_list.css +0 -12
- data/doc_config/yard/templates/default/fulldoc/html/css/global.css +0 -66
- data/doc_config/yard/templates/default/fulldoc/html/css/solarized.css +0 -69
- data/doc_config/yard/templates/default/fulldoc/html/css/style.css +0 -312
- data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +0 -26
- data/doc_config/yard/templates/default/fulldoc/html/full_list_class.erb +0 -1
- data/doc_config/yard/templates/default/fulldoc/html/full_list_method.erb +0 -8
- data/doc_config/yard/templates/default/fulldoc/html/js/app.js +0 -281
- data/doc_config/yard/templates/default/fulldoc/html/js/full_list.js +0 -1
- data/doc_config/yard/templates/default/fulldoc/html/js/jquery.stickyheaders.js +0 -289
- data/doc_config/yard/templates/default/fulldoc/html/js/underscore.min.js +0 -6
- data/doc_config/yard/templates/default/fulldoc/html/setup.rb +0 -35
- data/doc_config/yard/templates/default/layout/html/breadcrumb.erb +0 -14
- data/doc_config/yard/templates/default/layout/html/fonts.erb +0 -1
- data/doc_config/yard/templates/default/layout/html/footer.erb +0 -6
- data/doc_config/yard/templates/default/layout/html/layout.erb +0 -23
- data/doc_config/yard/templates/default/layout/html/search.erb +0 -13
- data/doc_config/yard/templates/default/layout/html/setup.rb +0 -40
- data/doc_config/yard/templates/default/method_details/html/source.erb +0 -10
- data/doc_config/yard/templates/default/module/html/box_info.erb +0 -31
- data/gemfiles/4.2.gemfile +0 -39
- data/gemfiles/4.2.gemfile.lock +0 -246
- data/gemfiles/5.0.gemfile +0 -37
- data/gemfiles/5.0.gemfile.lock +0 -238
- data/gemfiles/5.1.gemfile +0 -38
- data/gemfiles/5.1.gemfile.lock +0 -254
- data/gemfiles/5.2.gemfile +0 -40
- data/gemfiles/5.2.gemfile.lock +0 -273
- data/script/install_gems_in_all_appraisals +0 -16
- data/script/run_all_tests +0 -16
- data/script/supported_ruby_versions +0 -7
- data/script/update_gem_in_all_appraisals +0 -17
- data/script/update_gems_in_all_appraisals +0 -16
- data/spec/acceptance/active_model_integration_spec.rb +0 -23
- data/spec/acceptance/independent_matchers_spec.rb +0 -125
- data/spec/acceptance/multiple_libraries_integration_spec.rb +0 -55
- data/spec/acceptance/rails_integration_spec.rb +0 -156
- data/spec/acceptance_spec_helper.rb +0 -23
- data/spec/doublespeak_spec_helper.rb +0 -2
- data/spec/report_warnings.rb +0 -7
- data/spec/spec_helper.rb +0 -20
- data/spec/support/acceptance/adds_shoulda_matchers_to_project.rb +0 -133
- data/spec/support/acceptance/helpers.rb +0 -33
- data/spec/support/acceptance/helpers/active_model_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/array_helpers.rb +0 -13
- data/spec/support/acceptance/helpers/base_helpers.rb +0 -19
- data/spec/support/acceptance/helpers/command_helpers.rb +0 -68
- data/spec/support/acceptance/helpers/file_helpers.rb +0 -19
- data/spec/support/acceptance/helpers/gem_helpers.rb +0 -31
- data/spec/support/acceptance/helpers/minitest_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/n_unit_helpers.rb +0 -25
- data/spec/support/acceptance/helpers/pluralization_helpers.rb +0 -13
- data/spec/support/acceptance/helpers/rails_migration_helpers.rb +0 -21
- data/spec/support/acceptance/helpers/rails_version_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/rspec_helpers.rb +0 -24
- data/spec/support/acceptance/helpers/ruby_version_helpers.rb +0 -9
- data/spec/support/acceptance/helpers/step_helpers.rb +0 -127
- data/spec/support/acceptance/matchers/have_output.rb +0 -31
- data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +0 -55
- data/spec/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb +0 -103
- data/spec/support/tests/bundle.rb +0 -94
- data/spec/support/tests/command_runner.rb +0 -230
- data/spec/support/tests/current_bundle.rb +0 -55
- data/spec/support/tests/database.rb +0 -28
- data/spec/support/tests/database_adapters/postgresql.rb +0 -25
- data/spec/support/tests/database_adapters/sqlite3.rb +0 -26
- data/spec/support/tests/database_configuration.rb +0 -33
- data/spec/support/tests/database_configuration_registry.rb +0 -28
- data/spec/support/tests/filesystem.rb +0 -100
- data/spec/support/tests/version.rb +0 -45
- data/spec/support/unit/active_record/create_table.rb +0 -54
- data/spec/support/unit/attribute.rb +0 -45
- data/spec/support/unit/capture.rb +0 -46
- data/spec/support/unit/change_value.rb +0 -111
- data/spec/support/unit/create_model_arguments/basic.rb +0 -135
- data/spec/support/unit/create_model_arguments/has_many.rb +0 -15
- data/spec/support/unit/create_model_arguments/uniqueness_matcher.rb +0 -74
- data/spec/support/unit/helpers/action_pack_versions.rb +0 -22
- data/spec/support/unit/helpers/active_model_helpers.rb +0 -27
- data/spec/support/unit/helpers/active_model_versions.rb +0 -32
- data/spec/support/unit/helpers/active_record_versions.rb +0 -44
- data/spec/support/unit/helpers/active_resource_builder.rb +0 -27
- data/spec/support/unit/helpers/allow_value_matcher_helpers.rb +0 -15
- data/spec/support/unit/helpers/class_builder.rb +0 -90
- data/spec/support/unit/helpers/column_type_helpers.rb +0 -26
- data/spec/support/unit/helpers/confirmation_matcher_helpers.rb +0 -17
- data/spec/support/unit/helpers/controller_builder.rb +0 -63
- data/spec/support/unit/helpers/database_helpers.rb +0 -20
- data/spec/support/unit/helpers/i18n_faker.rb +0 -15
- data/spec/support/unit/helpers/mailer_builder.rb +0 -12
- data/spec/support/unit/helpers/message_helpers.rb +0 -19
- data/spec/support/unit/helpers/model_builder.rb +0 -114
- data/spec/support/unit/helpers/rails_versions.rb +0 -42
- data/spec/support/unit/helpers/validation_matcher_scenario_helpers.rb +0 -44
- data/spec/support/unit/i18n.rb +0 -7
- data/spec/support/unit/load_environment.rb +0 -12
- data/spec/support/unit/matchers/deprecate.rb +0 -60
- data/spec/support/unit/matchers/fail_with_message_including_matcher.rb +0 -51
- data/spec/support/unit/matchers/fail_with_message_matcher.rb +0 -64
- data/spec/support/unit/matchers/print_warning_including.rb +0 -67
- data/spec/support/unit/model_creation_strategies/active_model.rb +0 -111
- data/spec/support/unit/model_creation_strategies/active_record.rb +0 -77
- data/spec/support/unit/model_creators.rb +0 -19
- data/spec/support/unit/model_creators/active_model.rb +0 -39
- data/spec/support/unit/model_creators/active_record.rb +0 -42
- data/spec/support/unit/model_creators/active_record/has_and_belongs_to_many.rb +0 -95
- data/spec/support/unit/model_creators/active_record/has_many.rb +0 -67
- data/spec/support/unit/model_creators/active_record/uniqueness_matcher.rb +0 -42
- data/spec/support/unit/model_creators/basic.rb +0 -102
- data/spec/support/unit/rails_application.rb +0 -151
- data/spec/support/unit/record_builder_with_i18n_validation_message.rb +0 -69
- data/spec/support/unit/record_validating_confirmation_builder.rb +0 -54
- data/spec/support/unit/record_with_different_error_attribute_builder.rb +0 -92
- data/spec/support/unit/shared_examples/ignoring_interference_by_writer.rb +0 -79
- data/spec/support/unit/shared_examples/numerical_submatcher.rb +0 -17
- data/spec/support/unit/shared_examples/set_session_or_flash.rb +0 -360
- data/spec/support/unit/validation_matcher_scenario.rb +0 -60
- data/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +0 -82
- data/spec/unit/shoulda/matchers/action_controller/filter_param_matcher_spec.rb +0 -28
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +0 -629
- data/spec/unit/shoulda/matchers/action_controller/redirect_to_matcher_spec.rb +0 -42
- data/spec/unit/shoulda/matchers/action_controller/render_template_matcher_spec.rb +0 -76
- data/spec/unit/shoulda/matchers/action_controller/render_with_layout_matcher_spec.rb +0 -62
- data/spec/unit/shoulda/matchers/action_controller/rescue_from_matcher_spec.rb +0 -90
- data/spec/unit/shoulda/matchers/action_controller/respond_with_matcher_spec.rb +0 -31
- data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +0 -330
- data/spec/unit/shoulda/matchers/action_controller/route_params_spec.rb +0 -30
- data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +0 -67
- data/spec/unit/shoulda/matchers/action_controller/set_session_matcher_spec.rb +0 -17
- data/spec/unit/shoulda/matchers/action_controller/set_session_or_flash_matcher_spec.rb +0 -562
- data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +0 -117
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +0 -829
- data/spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +0 -86
- data/spec/unit/shoulda/matchers/active_model/have_secure_password_matcher_spec.rb +0 -20
- data/spec/unit/shoulda/matchers/active_model/helpers_spec.rb +0 -162
- data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +0 -290
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +0 -109
- data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +0 -172
- data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +0 -264
- data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +0 -1049
- data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +0 -335
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +0 -1865
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +0 -406
- data/spec/unit/shoulda/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb +0 -107
- data/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +0 -1672
- data/spec/unit/shoulda/matchers/active_record/association_matchers/model_reflection_spec.rb +0 -251
- data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +0 -690
- data/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb +0 -111
- data/spec/unit/shoulda/matchers/active_record/have_db_index_matcher_spec.rb +0 -85
- data/spec/unit/shoulda/matchers/active_record/have_readonly_attributes_matcher_spec.rb +0 -41
- data/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb +0 -169
- data/spec/unit/shoulda/matchers/active_record/serialize_matcher_spec.rb +0 -86
- data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +0 -1682
- data/spec/unit/shoulda/matchers/doublespeak/double_collection_spec.rb +0 -190
- data/spec/unit/shoulda/matchers/doublespeak/double_implementation_registry_spec.rb +0 -21
- data/spec/unit/shoulda/matchers/doublespeak/double_spec.rb +0 -271
- data/spec/unit/shoulda/matchers/doublespeak/object_double_spec.rb +0 -77
- data/spec/unit/shoulda/matchers/doublespeak/proxy_implementation_spec.rb +0 -72
- data/spec/unit/shoulda/matchers/doublespeak/stub_implementation_spec.rb +0 -101
- data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +0 -78
- data/spec/unit/shoulda/matchers/doublespeak_spec.rb +0 -27
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher/stubbed_target_spec.rb +0 -43
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +0 -650
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +0 -406
- data/spec/unit/shoulda/matchers/util/word_wrap_spec.rb +0 -252
- data/spec/unit_spec_helper.rb +0 -54
- data/spec/warnings_spy.rb +0 -64
- data/spec/warnings_spy/filesystem.rb +0 -45
- data/spec/warnings_spy/partitioner.rb +0 -36
- data/spec/warnings_spy/reader.rb +0 -53
- data/spec/warnings_spy/reporter.rb +0 -88
- data/tasks/documentation.rb +0 -199
- data/zeus.json +0 -11
data/.python-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.7.15
|
data/.rubocop.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
inherit_from: .hound/ruby.yml
|
2
|
-
AllCops:
|
3
|
-
TargetRubyVersion: 2.4
|
4
|
-
Layout/AlignParameters:
|
5
|
-
EnforcedStyle: with_fixed_indentation
|
6
|
-
Style/CollectionMethods:
|
7
|
-
PreferredMethods:
|
8
|
-
find: detect
|
9
|
-
reduce: inject
|
10
|
-
collect: map
|
11
|
-
find_all: select
|
12
|
-
Style/FrozenStringLiteralComment:
|
13
|
-
Enabled: false
|
14
|
-
Style/StringLiterals:
|
15
|
-
EnforcedStyle: single_quotes
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
script: "bundle exec rake"
|
5
|
-
install: "bundle install --jobs=3 --retry=3"
|
6
|
-
|
7
|
-
env:
|
8
|
-
- DATABASE_ADAPTER=sqlite3
|
9
|
-
- DATABASE_ADAPTER=postgresql
|
10
|
-
|
11
|
-
rvm:
|
12
|
-
- 2.5.1
|
13
|
-
- 2.4.4
|
14
|
-
- 2.3.7
|
15
|
-
- 2.2.8
|
16
|
-
|
17
|
-
gemfile:
|
18
|
-
- gemfiles/4.2.gemfile
|
19
|
-
- gemfiles/5.0.gemfile
|
20
|
-
- gemfiles/5.1.gemfile
|
21
|
-
- gemfiles/5.2.gemfile
|
data/.yardopts
DELETED
data/Appraisals
DELETED
@@ -1,105 +0,0 @@
|
|
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.
|
5
|
-
|
6
|
-
shared_jruby_dependencies = proc do
|
7
|
-
gem 'activerecord-jdbc-adapter', platform: :jruby
|
8
|
-
gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
|
9
|
-
gem 'jdbc-sqlite3', platform: :jruby
|
10
|
-
gem 'jruby-openssl', platform: :jruby
|
11
|
-
gem 'therubyrhino', platform: :jruby
|
12
|
-
end
|
13
|
-
|
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
|
20
|
-
gem 'spring'
|
21
|
-
gem 'spring-commands-rspec'
|
22
|
-
end
|
23
|
-
|
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
|
39
|
-
instance_eval(&shared_dependencies)
|
40
|
-
|
41
|
-
gem 'rails', '~> 4.2.9'
|
42
|
-
gem 'sass-rails', '~> 5.0'
|
43
|
-
gem 'uglifier', '>= 1.3.0'
|
44
|
-
gem 'coffee-rails', '~> 4.1.0'
|
45
|
-
gem 'jquery-rails'
|
46
|
-
gem 'turbolinks'
|
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
|
52
|
-
gem 'activeresource', '4.0.0'
|
53
|
-
gem 'json', '~> 1.4'
|
54
|
-
gem 'protected_attributes', '~> 1.0.6'
|
55
|
-
end
|
56
|
-
|
57
|
-
appraise '5.0' do
|
58
|
-
instance_eval(&shared_dependencies)
|
59
|
-
|
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'
|
70
|
-
end
|
71
|
-
|
72
|
-
appraise '5.1' do
|
73
|
-
instance_eval(&shared_dependencies)
|
74
|
-
|
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'
|
81
|
-
gem 'bcrypt', '~> 3.1.7'
|
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'
|
86
|
-
end
|
87
|
-
|
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
|
96
|
-
gem 'sass-rails', '~> 5.0'
|
97
|
-
gem 'turbolinks', '~> 5'
|
98
|
-
gem 'jbuilder', '~> 2.5'
|
99
|
-
gem 'bcrypt', '~> 3.1.7'
|
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'
|
105
|
-
end
|
data/CONTRIBUTING.md
DELETED
@@ -1,172 +0,0 @@
|
|
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.
|
24
|
-
|
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!
|
30
|
-
|
31
|
-
---
|
32
|
-
|
33
|
-
## Code of Conduct
|
34
|
-
|
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.
|
38
|
-
|
39
|
-
[Code of Conduct]: https://thoughtbot.com/open-source-code-of-conduct
|
40
|
-
|
41
|
-
## Setting up your environment
|
42
|
-
|
43
|
-
The setup script will install all dependencies necessary for working on the
|
44
|
-
project:
|
45
|
-
|
46
|
-
```bash
|
47
|
-
bin/setup
|
48
|
-
```
|
49
|
-
|
50
|
-
## Architecture
|
51
|
-
|
52
|
-
This project follows the typical structure for a gem: code is located in `lib`
|
53
|
-
and tests are in `spec`.
|
54
|
-
|
55
|
-
All of the matchers are broken up by the type of example group they apply to:
|
56
|
-
|
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
|
63
|
-
|
64
|
-
There are other files in the project, of course, but there are likely the ones
|
65
|
-
that you'll be interested in.
|
66
|
-
|
67
|
-
In addition, tests are broken up into two categories:
|
68
|
-
|
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
|
98
|
-
|
99
|
-
## Running tests
|
100
|
-
|
101
|
-
### Unit tests
|
102
|
-
|
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].
|
108
|
-
|
109
|
-
[Zeus]: https://github.com/burke/zeus
|
110
|
-
|
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:
|
114
|
-
|
115
|
-
```
|
116
|
-
bundle exec zeus rspec spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb
|
117
|
-
```
|
118
|
-
|
119
|
-
### Acceptance tests
|
120
|
-
|
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
|
132
|
-
|
133
|
-
```
|
134
|
-
bundle exec rspec spec/acceptance/active_model_integration_spec.rb
|
135
|
-
```
|
136
|
-
|
137
|
-
Instead, you need to say
|
138
|
-
|
139
|
-
```
|
140
|
-
bundle exec appraisal 5.1 rspec spec/acceptance/active_model_integration_spec.rb
|
141
|
-
```
|
142
|
-
|
143
|
-
## Managing your branch
|
144
|
-
|
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.
|
150
|
-
|
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
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'appraisal', '2.2.0'
|
4
|
-
gem 'bundler', '~> 1.1'
|
5
|
-
gem 'pry'
|
6
|
-
gem 'pry-byebug'
|
7
|
-
gem 'rake', '12.3.0'
|
8
|
-
gem 'rspec', '~> 3.6'
|
9
|
-
gem 'zeus', require: false
|
10
|
-
|
11
|
-
# YARD
|
12
|
-
gem 'yard'
|
13
|
-
gem 'redcarpet'
|
14
|
-
gem 'pygments.rb'
|
15
|
-
gem 'fssm'
|
data/Gemfile.lock
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
appraisal (2.2.0)
|
5
|
-
bundler
|
6
|
-
rake
|
7
|
-
thor (>= 0.14.0)
|
8
|
-
byebug (9.1.0)
|
9
|
-
coderay (1.1.2)
|
10
|
-
diff-lcs (1.3)
|
11
|
-
fssm (0.2.10)
|
12
|
-
method_source (0.9.0)
|
13
|
-
multi_json (1.12.1)
|
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)
|
19
|
-
pry (~> 0.10)
|
20
|
-
pygments.rb (1.1.1)
|
21
|
-
multi_json (>= 1.0.0)
|
22
|
-
rake (12.3.0)
|
23
|
-
redcarpet (3.4.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)
|
31
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.6.0)
|
33
|
-
rspec-mocks (3.6.0)
|
34
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
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)
|
40
|
-
method_source (>= 0.6.7)
|
41
|
-
|
42
|
-
PLATFORMS
|
43
|
-
ruby
|
44
|
-
|
45
|
-
DEPENDENCIES
|
46
|
-
appraisal (= 2.2.0)
|
47
|
-
bundler (~> 1.1)
|
48
|
-
fssm
|
49
|
-
pry
|
50
|
-
pry-byebug
|
51
|
-
pygments.rb
|
52
|
-
rake (= 12.3.0)
|
53
|
-
redcarpet
|
54
|
-
rspec (~> 3.6)
|
55
|
-
yard
|
56
|
-
zeus
|
57
|
-
|
58
|
-
BUNDLED WITH
|
59
|
-
1.16.1
|
data/MAINTAINING.md
DELETED
@@ -1,250 +0,0 @@
|
|
1
|
-
# Maintaining Shoulda Matchers
|
2
|
-
|
3
|
-
As maintainers of the gem, this is our guide. Most of the steps and guidelines
|
4
|
-
in the [Contributing](CONTRIBUTING.md) document apply here, including how to set
|
5
|
-
up your environment, write code to fit the code style, run tests, craft commits
|
6
|
-
and manage branches. Beyond this, this document provides some details that would
|
7
|
-
be too low-level for contributors.
|
8
|
-
|
9
|
-
## Communication
|
10
|
-
|
11
|
-
We use a combination of methods to communicate with each other:
|
12
|
-
|
13
|
-
* In planning major releases, it can be helpful to create a **new issue**
|
14
|
-
outlining the changes as well as steps needed to launch the release. This
|
15
|
-
serves both as an announcement to the community as well as an area to keep a
|
16
|
-
checklist.
|
17
|
-
* To track progress for the next release, **GitHub milestones** are useful.
|
18
|
-
* To track progress on the movement of issues, [**labels**](#addendum-labels)
|
19
|
-
are useful.
|
20
|
-
* To communicate small-scale changes, **pull requests** are effective, as
|
21
|
-
mentioned above.
|
22
|
-
* To communicate large-scale changes or explain topics, **email** is best.
|
23
|
-
|
24
|
-
## Managing the community
|
25
|
-
|
26
|
-
As anyone who has played a sim game before, it's important to make your patrons
|
27
|
-
happy. We do this by:
|
28
|
-
|
29
|
-
* Answering questions from members of the community
|
30
|
-
* Closing stale issues and feature requests
|
31
|
-
* Keeping the community informed by ensuring that the changelog is up to date
|
32
|
-
* Ensuring that the inline documentation, as well as the docsite, is kept up to
|
33
|
-
date
|
34
|
-
|
35
|
-
## Workflow
|
36
|
-
|
37
|
-
We generally follow [GitHub Flow]. The `master` branch is the main line, and all
|
38
|
-
branches are cut from and get merged back into this branch. Generally, the
|
39
|
-
workflow is as follows:
|
40
|
-
|
41
|
-
[GitHub Flow]: https://help.github.com/articles/github-flow/
|
42
|
-
|
43
|
-
* Cut a feature or bugfix branch from this branch.
|
44
|
-
* Upon completing a branch, create a PR and ask another maintainer to approve
|
45
|
-
it.
|
46
|
-
* Try to keep the commit history as clean as possible. Before merging, squash
|
47
|
-
"WIP" or related commits together and rebase as needed.
|
48
|
-
* Once your PR is approved and you've cleaned up your branch, you're free to
|
49
|
-
merge it in.
|
50
|
-
|
51
|
-
## Architecture
|
52
|
-
|
53
|
-
Besides the matchers, there are files in `lib` which you may need to reference
|
54
|
-
or update:
|
55
|
-
|
56
|
-
* `lib/shoulda/matchers/doublespeak*` -- a small handrolled mocking library
|
57
|
-
which is used by the `permit` matcher
|
58
|
-
* `lib/shoulda/matchers/util*` -- extra methods which are used in various places
|
59
|
-
to detect library versions, wrap/indent text, and more
|
60
|
-
|
61
|
-
## Updating the changelog
|
62
|
-
|
63
|
-
After every user-facing change makes it into master, we make a note of it in the
|
64
|
-
changelog, which for historical reasons is kept in `NEWS.md`. The changelog is
|
65
|
-
sorted in reverse order by release version, with the topmost version as the next
|
66
|
-
release (tagged as "(Unreleased)").
|
67
|
-
|
68
|
-
Within each version, there are five available categories you can divide changes
|
69
|
-
into. They are all optional but they should appear in this order:
|
70
|
-
|
71
|
-
1. Backward-compatible changes
|
72
|
-
1. Deprecations
|
73
|
-
1. Bug fixes
|
74
|
-
1. Features
|
75
|
-
1. Improvements
|
76
|
-
|
77
|
-
Within each category section, the changes relevant to that category are listed
|
78
|
-
in chronological order.
|
79
|
-
|
80
|
-
For each change, provide a human-readable description of the change as well as a
|
81
|
-
linked reference to the PR where that change emerged (or the commit ID if no
|
82
|
-
such PR is available). This helps users cross-reference changes if they need to.
|
83
|
-
|
84
|
-
## Documentation
|
85
|
-
|
86
|
-
### Generating documentation
|
87
|
-
|
88
|
-
As mentioned in the Contributing document, we use YARD for documentation. YARD
|
89
|
-
is configured via `.yardopts` to process the Ruby files in `lib/` as well as
|
90
|
-
`NEWS.md` and the Markdown files in `docs/` and write the documentation in HTML
|
91
|
-
form to `doc`. This command will do exactly that:
|
92
|
-
|
93
|
-
```bash
|
94
|
-
bundle exec yard doc
|
95
|
-
```
|
96
|
-
|
97
|
-
However, if you're actively updating the documentation, it's more helpful to
|
98
|
-
launch a process that will watch the aforementioned source files for changes and
|
99
|
-
generate the HTML for you automatically:
|
100
|
-
|
101
|
-
```bash
|
102
|
-
bundle exec rake docs:autogenerate
|
103
|
-
```
|
104
|
-
|
105
|
-
Whichever approach you take, you can view the generated docs locally by running:
|
106
|
-
|
107
|
-
```bash
|
108
|
-
open doc/index.html
|
109
|
-
```
|
110
|
-
|
111
|
-
### About the docsite
|
112
|
-
|
113
|
-
The docfiles that YARD generates are published to the docsite, which is located
|
114
|
-
at:
|
115
|
-
|
116
|
-
<https://matchers.shoulda.io/docs>
|
117
|
-
|
118
|
-
The docsite is hosted on GitHub Pages*. As such, the `gh-pages` branch hosts the
|
119
|
-
code for the docsite. This branch is written to automatically by the
|
120
|
-
`docs:publish` and `docs:publish_latest` tasks.
|
121
|
-
|
122
|
-
The URL above actually links to a bare-bones HTML page which merely serves to
|
123
|
-
automatically redirect the visitor to the docs for the latest published version
|
124
|
-
of the gem. This version is hardcoded in the HTML page, but is also updated
|
125
|
-
automatically by the `docs:publish` and `docs:publish_latest` tasks.
|
126
|
-
|
127
|
-
*\* thoughtbot owns <https://shoulda.io>, and
|
128
|
-
they've got `matchers.shoulda.io` set up on the DNS level as an alias for
|
129
|
-
`thoughtbot.github.io/shoulda-matchers`.*
|
130
|
-
|
131
|
-
## Versioning
|
132
|
-
|
133
|
-
### Naming a new version
|
134
|
-
|
135
|
-
As designated in the README, we follow [SemVer 2.0][semver]. This offers a
|
136
|
-
meaningful baseline for deciding how to name versions. Generally speaking:
|
137
|
-
|
138
|
-
[semver]: https://semver.org/spec/v2.0.0.html
|
139
|
-
|
140
|
-
* We bump the "major" part of the version if we're introducing
|
141
|
-
backward-incompatible changes (e.g. changing the API or core behavior,
|
142
|
-
removing parts of the API, or dropping support for a version of Ruby).
|
143
|
-
* We bump the "minor" part if we're adding a new feature (e.g. adding a new
|
144
|
-
matcher or adding a new qualifier to a matcher).
|
145
|
-
* We bump the "patch" part if we're merely including bugfixes.
|
146
|
-
|
147
|
-
In addition to major, minor, and patch levels, you can also append a
|
148
|
-
suffix to the version for pre-release versions. We usually use this to issue
|
149
|
-
release candidates prior to an actual release. A version number in this case
|
150
|
-
might look like `4.0.0.rc1`.
|
151
|
-
|
152
|
-
### Releasing a new version
|
153
|
-
|
154
|
-
Releasing a new version is very simple:
|
155
|
-
|
156
|
-
1. First, you'll want to be given ownership permissions for the Ruby gem itself.
|
157
|
-
If you want to give someone else these rights, you can use:
|
158
|
-
|
159
|
-
```bash
|
160
|
-
gem owner shoulda-matchers -a <email address>
|
161
|
-
```
|
162
|
-
1. Next, you'll want to update the `VERSION` constant in
|
163
|
-
`lib/shoulda/matchers/version.rb`. This constant is referenced in the gemspec
|
164
|
-
and is used in the Rake tasks to publish the gem on RubyGems as well as
|
165
|
-
generate documentation.
|
166
|
-
1. Finally, you'll want to run:
|
167
|
-
|
168
|
-
```bash
|
169
|
-
rake release
|
170
|
-
```
|
171
|
-
|
172
|
-
This will not only push the gem to RubyGems, but also update the docsite.
|
173
|
-
|
174
|
-
### Re-publishing docs
|
175
|
-
|
176
|
-
In general you'll use the `release` task to update the docsite, but there may be
|
177
|
-
a situation where you'll need to do it manually.
|
178
|
-
|
179
|
-
You can re-publish the docs for the latest version (as governed by
|
180
|
-
`lib/shoulda/matchers/version.rb`) by running:
|
181
|
-
|
182
|
-
```bash
|
183
|
-
bundle exec rake docs:publish_latest
|
184
|
-
```
|
185
|
-
|
186
|
-
This will update the version to which the docsite auto-redirects to the latest
|
187
|
-
version. For instance, if the latest version were 4.0.0, this command would
|
188
|
-
publish the docs at <https://matchers.shoulda.io/docs/v4.0.0> but redirect
|
189
|
-
<https://matchers.shoulda.io/docs> to this location.
|
190
|
-
|
191
|
-
However, if you want to publish the docs for a version and at the same
|
192
|
-
time manually set the auto-redirected version, you can run this instead:
|
193
|
-
|
194
|
-
```bash
|
195
|
-
bundle exec rake docs:publish[version, latest_version]
|
196
|
-
```
|
197
|
-
|
198
|
-
Here, `version` and `latest_version` are both version strings. For instance, you
|
199
|
-
might say:
|
200
|
-
|
201
|
-
```bash
|
202
|
-
bundle exec rake docs:publish[4.0.0, 3.7.2]
|
203
|
-
```
|
204
|
-
|
205
|
-
This would publish the docs for 4.0.0 at
|
206
|
-
<https://matchers.shoulda.io/docs/v4.0.0>, but redirect
|
207
|
-
<https://matchers.shoulda.io/docs> to <https://matchers.shoulda.io/docs/v3.7.2>.
|
208
|
-
|
209
|
-
## Addendum: Labels
|
210
|
-
|
211
|
-
In order to corral the issue and PR backlog, we've found
|
212
|
-
[labels] to be useful for cataloguing and tracking progress purposes. Over time
|
213
|
-
we've added quite a collection of labels. Here's a quick list:
|
214
|
-
|
215
|
-
[labels]: https://github.com/thoughtbot/shoulda-matchers/labels
|
216
|
-
|
217
|
-
### Labels for issues
|
218
|
-
|
219
|
-
* **Issue: Bug**
|
220
|
-
* **Issue: Feature Request**
|
221
|
-
* **Issue: Need to Investigate** -- if we don't know whether a bug is legitimate
|
222
|
-
or not
|
223
|
-
* **Issue: PR Needed** -- perhaps unnecessary, but it does signal to the
|
224
|
-
community that we'd love a PR
|
225
|
-
|
226
|
-
### Labels for PRs
|
227
|
-
|
228
|
-
* **PR: Bugfix**
|
229
|
-
* **PR: Feature**
|
230
|
-
* **PR: Good to Merge** -- most of the time not necessary, but can be helpful in
|
231
|
-
a code freeze before a release to mark PRs that we will include in the next
|
232
|
-
release
|
233
|
-
* **PR: In Progress** -- used to mark PRs that are still being worked on by the
|
234
|
-
PR author
|
235
|
-
* **PR: Needs Documentation**
|
236
|
-
* **PR: Needs Review**
|
237
|
-
* **PR: Needs Tests**
|
238
|
-
* **PR: Needs Updates Before Merge** -- along the same lines as the other
|
239
|
-
"Needs" tags, but more generic
|
240
|
-
|
241
|
-
### Generic labels
|
242
|
-
|
243
|
-
* **Blocked**
|
244
|
-
* **Documentation**
|
245
|
-
* **Needs Decision**
|
246
|
-
* **Needs Revisiting**
|
247
|
-
* **Question**
|
248
|
-
* **Rails X**
|
249
|
-
* **Ruby X.Y**
|
250
|
-
* **UX**
|