shoulda-context 1.2.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +190 -0
  5. data/.ruby-version +1 -1
  6. data/.travis.yml +36 -2
  7. data/Appraisals +100 -29
  8. data/CHANGELOG.md +29 -0
  9. data/Gemfile +15 -1
  10. data/Gemfile.lock +70 -0
  11. data/MIT-LICENSE +1 -1
  12. data/README.md +140 -29
  13. data/Rakefile +20 -15
  14. data/bin/install_gems_in_all_appraisals +16 -0
  15. data/bin/run_all_tests +16 -0
  16. data/bin/setup +190 -0
  17. data/bin/supported_ruby_versions +7 -0
  18. data/bin/update_gem_in_all_appraisals +17 -0
  19. data/bin/update_gems_in_all_appraisals +16 -0
  20. data/{bin → exe}/convert_to_should_syntax +0 -0
  21. data/gemfiles/rails_4_2.gemfile +35 -0
  22. data/gemfiles/rails_4_2.gemfile.lock +234 -0
  23. data/gemfiles/rails_5_0.gemfile +33 -0
  24. data/gemfiles/rails_5_0.gemfile.lock +226 -0
  25. data/gemfiles/rails_5_1.gemfile +34 -0
  26. data/gemfiles/rails_5_1.gemfile.lock +242 -0
  27. data/gemfiles/rails_5_2.gemfile +36 -0
  28. data/gemfiles/rails_5_2.gemfile.lock +261 -0
  29. data/gemfiles/rails_6_0.gemfile +38 -0
  30. data/gemfiles/rails_6_0.gemfile.lock +286 -0
  31. data/lib/shoulda/context.rb +13 -16
  32. data/lib/shoulda/context/assertions.rb +16 -13
  33. data/lib/shoulda/context/configuration.rb +19 -0
  34. data/lib/shoulda/context/context.rb +33 -307
  35. data/lib/shoulda/context/dsl.rb +279 -0
  36. data/lib/shoulda/context/rails_test_unit_reporter_patch.rb +21 -0
  37. data/lib/shoulda/context/railtie.rb +14 -0
  38. data/lib/shoulda/context/test_framework_detection.rb +4 -5
  39. data/lib/shoulda/context/version.rb +1 -1
  40. data/lib/shoulda/context/world.rb +22 -0
  41. data/shoulda-context.gemspec +11 -18
  42. data/test/fake_rails_root/test/shoulda_macros/custom_macro.rb +1 -1
  43. data/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +1 -2
  44. data/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +1 -2
  45. data/test/shoulda/autoload_macro_test.rb +1 -1
  46. data/test/shoulda/context_test.rb +92 -53
  47. data/test/shoulda/convert_to_should_syntax_test.rb +5 -7
  48. data/test/shoulda/helpers_test.rb +24 -59
  49. data/test/shoulda/railtie_test.rb +43 -0
  50. data/test/shoulda/rerun_snippet_test.rb +45 -0
  51. data/test/shoulda/should_test.rb +163 -24
  52. data/test/shoulda/test_framework_detection_test.rb +64 -71
  53. data/test/support/current_bundle.rb +61 -0
  54. data/test/support/rails_application_with_shoulda_context.rb +46 -0
  55. data/test/support/snowglobe.rb +5 -0
  56. data/test/test_helper.rb +43 -11
  57. metadata +46 -142
  58. data/gemfiles/minitest_4_x.gemfile +0 -7
  59. data/gemfiles/minitest_4_x.gemfile.lock +0 -96
  60. data/gemfiles/minitest_5_x.gemfile +0 -7
  61. data/gemfiles/minitest_5_x.gemfile.lock +0 -102
  62. data/gemfiles/rails_3_0.gemfile +0 -8
  63. data/gemfiles/rails_3_0.gemfile.lock +0 -93
  64. data/gemfiles/rails_3_1.gemfile +0 -10
  65. data/gemfiles/rails_3_1.gemfile.lock +0 -114
  66. data/gemfiles/rails_3_2.gemfile +0 -10
  67. data/gemfiles/rails_3_2.gemfile.lock +0 -112
  68. data/gemfiles/rails_4_0.gemfile +0 -10
  69. data/gemfiles/rails_4_0.gemfile.lock +0 -107
  70. data/gemfiles/rails_4_1.gemfile +0 -10
  71. data/gemfiles/rails_4_1.gemfile.lock +0 -119
  72. data/gemfiles/test_unit.gemfile +0 -7
  73. data/gemfiles/test_unit.gemfile.lock +0 -95
  74. data/init.rb +0 -1
  75. data/rails/init.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8f5e8f0cc83d3b44bd9eddf2193085c1b9fea968
4
- data.tar.gz: 7c8a322dea7cfb60550eb4a199a01346f86bfaa3
2
+ SHA256:
3
+ metadata.gz: e8e22c3d4b11c133a4712ce73ad1a8e2801f07e3a33fa5e77ec522195a557995
4
+ data.tar.gz: aaeabb3b6941a9146c1960e675342cc485e7f9f1ac1e559de51a58a714d3a44c
5
5
  SHA512:
6
- metadata.gz: b441e5a21877364af355eb9a431fbd05be5065cd3c646c3335d397b87a1eb857e71c11a7f9b6884896c18c4dceb83ffcdde80773ed71ae31575b3d2a12c643e2
7
- data.tar.gz: 5893017828229249e980f1f4c67c08a04ec3619942a8b9dd455727be8d71525a39927ea764a3f8b3ba3fa90069bc99c77d92694b978329a60c64277ce3036ca8
6
+ metadata.gz: e5901a02ba82b904a523f8d42101933967b152fe72611f227bc7babf320b30eac79613481291e3083a710f942927fd42813ad4ae3959c623e8821e73e48d711f
7
+ data.tar.gz: efa32fcbf497339ffbda8d4dcda6ab164abc3b5d3ec421e09f9a5c5b57f2ed1af94a122631cc54e9005f210085d67185f7474b04cb49fd1b7ed9196904263fdf
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  .bundle
2
- Gemfile.lock
3
2
  vendor/ruby
4
3
  vendor/cache
5
4
  doc
@@ -0,0 +1,3 @@
1
+ rubocop:
2
+ version: 0.64.0
3
+ config_file: .rubocop.yml
@@ -0,0 +1,190 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ Exclude:
4
+ - '*.gemspec'
5
+ Layout/AlignParameters:
6
+ EnforcedStyle: with_fixed_indentation
7
+ Layout/ConditionPosition:
8
+ Enabled: false
9
+ Layout/DotPosition:
10
+ EnforcedStyle: trailing
11
+ Layout/MultilineMethodCallIndentation:
12
+ EnforcedStyle: indented
13
+ Lint/AmbiguousOperator:
14
+ Enabled: false
15
+ Lint/AmbiguousRegexpLiteral:
16
+ Enabled: false
17
+ Lint/AssignmentInCondition:
18
+ Enabled: false
19
+ Lint/DeprecatedClassMethods:
20
+ Enabled: false
21
+ Lint/ElseLayout:
22
+ Enabled: false
23
+ Lint/HandleExceptions:
24
+ Enabled: false
25
+ Lint/IndentHeredoc:
26
+ Enabled: false
27
+ Lint/LiteralInInterpolation:
28
+ Enabled: false
29
+ Lint/Loop:
30
+ Enabled: false
31
+ Lint/ParenthesesAsGroupedExpression:
32
+ Enabled: false
33
+ Lint/RequireParentheses:
34
+ Enabled: false
35
+ Lint/UnderscorePrefixedVariableName:
36
+ Enabled: false
37
+ Lint/Void:
38
+ Enabled: false
39
+ Metrics/BlockLength:
40
+ Enabled: false
41
+ Metrics/ClassLength:
42
+ Enabled: false
43
+ Metrics/LineLength:
44
+ IgnoredPatterns:
45
+ - "^[ ]*describe.+$"
46
+ - "^[ ]*context.+$"
47
+ - "^[ ]*shared_context.+$"
48
+ - "^[ ]*shared_examples_for.+$"
49
+ - "^[ ]*it.+$"
50
+ - "^[ ]*'.+?' => '.+?',?$"
51
+ - "^[ ]*\".+?\" => \".+?\",?$"
52
+ - "^[ ]*.+?: .+?$"
53
+ Metrics/MethodLength:
54
+ Max: 30
55
+ Naming/AccessorMethodName:
56
+ Enabled: false
57
+ Naming/AsciiIdentifiers:
58
+ Enabled: false
59
+ Naming/BinaryOperatorParameterName:
60
+ Enabled: false
61
+ Naming/MemoizedInstanceVariableName:
62
+ EnforcedStyleForLeadingUnderscores: required
63
+ Style/ClassVars:
64
+ Enabled: false
65
+ Style/ColonMethodCall:
66
+ Enabled: false
67
+ Naming/FileName:
68
+ Enabled: false
69
+ Rails:
70
+ Enabled: true
71
+ Rails/Delegate:
72
+ Enabled: false
73
+ Rails/HttpPositionalArguments:
74
+ Enabled: false
75
+ Style/Alias:
76
+ Enabled: false
77
+ Style/ArrayJoin:
78
+ Enabled: false
79
+ Style/AsciiComments:
80
+ Enabled: false
81
+ Style/Attr:
82
+ Enabled: false
83
+ Style/CaseEquality:
84
+ Enabled: false
85
+ Style/CharacterLiteral:
86
+ Enabled: false
87
+ Style/ClassAndModuleChildren:
88
+ Enabled: false
89
+ Style/CollectionMethods:
90
+ PreferredMethods:
91
+ find: detect
92
+ reduce: inject
93
+ collect: map
94
+ find_all: select
95
+ Style/CommentAnnotation:
96
+ Enabled: false
97
+ Style/Documentation:
98
+ Enabled: false
99
+ Style/DoubleNegation:
100
+ Enabled: false
101
+ Style/EachWithObject:
102
+ Enabled: false
103
+ Style/EmptyLiteral:
104
+ Enabled: false
105
+ Style/Encoding:
106
+ Enabled: false
107
+ Style/EvenOdd:
108
+ Enabled: false
109
+ Style/ExpandPathArguments:
110
+ Enabled: false
111
+ Style/FlipFlop:
112
+ Enabled: false
113
+ Style/FormatString:
114
+ Enabled: false
115
+ Style/FrozenStringLiteralComment:
116
+ Enabled: false
117
+ Style/GlobalVars:
118
+ Enabled: false
119
+ Style/GuardClause:
120
+ Enabled: false
121
+ Style/IfUnlessModifier:
122
+ Enabled: false
123
+ Style/IfWithSemicolon:
124
+ Enabled: false
125
+ Style/InlineComment:
126
+ Enabled: false
127
+ Style/Lambda:
128
+ Enabled: false
129
+ Style/LambdaCall:
130
+ Enabled: false
131
+ Style/LineEndConcatenation:
132
+ Enabled: false
133
+ Style/MethodCalledOnDoEndBlock:
134
+ Enabled: false
135
+ Style/ModuleFunction:
136
+ Enabled: false
137
+ Style/NegatedIf:
138
+ Enabled: false
139
+ Style/NegatedWhile:
140
+ Enabled: false
141
+ Style/Next:
142
+ Enabled: false
143
+ Style/NilComparison:
144
+ Enabled: false
145
+ Style/Not:
146
+ Enabled: false
147
+ Style/NumericLiterals:
148
+ Enabled: false
149
+ Style/NumericPredicate:
150
+ Enabled: false
151
+ Style/OneLineConditional:
152
+ Enabled: false
153
+ Style/PercentLiteralDelimiters:
154
+ Enabled: false
155
+ Style/PerlBackrefs:
156
+ Enabled: false
157
+ Style/PreferredHashMethods:
158
+ Enabled: false
159
+ Style/Proc:
160
+ Enabled: false
161
+ Style/RaiseArgs:
162
+ Enabled: false
163
+ Style/RegexpLiteral:
164
+ Enabled: false
165
+ Style/RescueStandardError:
166
+ Enabled: false
167
+ Style/SelfAssignment:
168
+ Enabled: false
169
+ Style/SignalException:
170
+ Enabled: false
171
+ Style/SingleLineBlockParams:
172
+ Enabled: false
173
+ Style/SingleLineMethods:
174
+ Enabled: false
175
+ Style/SpecialGlobalVars:
176
+ Enabled: false
177
+ Style/StringLiterals:
178
+ EnforcedStyle: double_quotes
179
+ Style/SymbolArray:
180
+ Enabled: false
181
+ Style/TrivialAccessors:
182
+ Enabled: false
183
+ Style/WhenThen:
184
+ Enabled: false
185
+ Style/WhileUntilModifier:
186
+ Enabled: false
187
+ Style/WordArray:
188
+ Enabled: false
189
+ Style/VariableInterpolation:
190
+ Enabled: false
@@ -1 +1 @@
1
- 2.0.0-p247
1
+ 2.7.1
@@ -1,3 +1,37 @@
1
+ language: ruby
2
+ dist: xenial
3
+ os: linux
4
+ cache:
5
+ directories:
6
+ - vendor/bundle
7
+ # Source: <https://docs.travis-ci.com/user/languages/ruby/#bundler-20>
8
+ before_install:
9
+ - gem update --system '3.1.2' --no-document
10
+ - gem uninstall -v '< 2' -i $(rvm gemdir)@global -ax bundler || true
11
+ - gem install bundler -v '< 2' --no-document
12
+ - nvm use v11.0.0
13
+ - bundle config set path vendor/bundle
14
+ install: "bundle install --jobs=3 --retry=3"
15
+ script: "bundle exec rake"
1
16
  rvm:
2
- - 1.9.3
3
- - 2.0.0
17
+ - 2.4.9
18
+ - 2.5.8
19
+ - 2.6.6
20
+ - 2.7.1
21
+ env:
22
+ - TEST_FRAMEWORK=minitest
23
+ - TEST_FRAMEWORK=test_unit
24
+ gemfile:
25
+ - gemfiles/rails_4_2.gemfile
26
+ - gemfiles/rails_5_0.gemfile
27
+ - gemfiles/rails_5_1.gemfile
28
+ - gemfiles/rails_5_2.gemfile
29
+ - gemfiles/rails_6_0.gemfile
30
+ matrix:
31
+ exclude:
32
+ - rvm: 2.4.9
33
+ gemfile: gemfiles/rails_6_0.gemfile
34
+ - rvm: 2.6.6
35
+ gemfile: gemfiles/rails_4_2.gemfile
36
+ - rvm: 2.7.1
37
+ gemfile: gemfiles/rails_4_2.gemfile
data/Appraisals CHANGED
@@ -1,44 +1,115 @@
1
- appraise 'rails_3_0' do
2
- gem 'rails', '~> 3.0.0'
3
- gem 'sqlite3'
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_rails_dependencies = proc do
7
+ gem "sqlite3", "~> 1.3.6"
4
8
  end
5
9
 
6
- appraise 'rails_3_1' do
7
- gem 'rails', '~> 3.1.0'
8
- gem 'jquery-rails'
9
- gem 'sass-rails'
10
- gem 'sqlite3'
10
+ shared_spring_dependencies = proc do
11
+ gem "spring"
12
+ gem "spring-commands-rspec"
11
13
  end
12
14
 
13
- appraise 'rails_3_2' do
14
- gem 'rails', '~> 3.2.0'
15
- gem 'jquery-rails'
16
- gem 'sass-rails'
17
- gem 'sqlite3'
15
+ shared_test_dependencies = proc do
16
+ gem "minitest-reporters"
18
17
  end
19
18
 
20
- appraise 'rails_4_0' do
21
- gem 'rails', '~> 4.0.0'
22
- gem 'jquery-rails'
23
- gem 'sass-rails'
24
- gem 'sqlite3'
19
+ shared_dependencies = proc do
20
+ instance_eval(&shared_rails_dependencies)
21
+ instance_eval(&shared_spring_dependencies)
22
+ instance_eval(&shared_test_dependencies)
25
23
  end
26
24
 
27
- appraise 'rails_4_1' do
28
- gem 'rails', github: 'rails/rails', branch: '4-1-stable'
29
- gem 'jquery-rails'
30
- gem 'sass-rails'
31
- gem 'sqlite3'
25
+ appraise "rails_4_2" do
26
+ instance_eval(&shared_dependencies)
27
+
28
+ gem "rails", "~> 4.2.10"
29
+ gem "sass-rails", "~> 5.0"
30
+ gem "uglifier", ">= 1.3.0"
31
+ gem "coffee-rails", "~> 4.1.0"
32
+ gem "jquery-rails"
33
+ gem "turbolinks"
34
+ gem "jbuilder", "~> 2.0"
35
+ gem "sdoc", "~> 0.4.0", group: :doc
36
+ gem "bcrypt", "~> 3.1.7"
37
+
38
+ # Other dependencies we use
39
+ gem "activeresource", "4.0.0"
40
+ gem "json", "~> 1.4"
41
+ gem "protected_attributes", "~> 1.0.6"
32
42
  end
33
43
 
34
- appraise 'minitest_4_x' do
35
- gem 'minitest', '~> 4.0'
44
+ appraise "rails_5_0" do
45
+ instance_eval(&shared_dependencies)
46
+
47
+ gem "rails", "~> 5.0.7"
48
+ gem "rails-controller-testing", ">= 1.0.1"
49
+ gem "puma", "~> 3.0"
50
+ gem "sass-rails", "~> 5.0"
51
+ gem "jquery-rails"
52
+ gem "turbolinks", "~> 5"
53
+ gem "jbuilder", "~> 2.5"
54
+ gem "bcrypt", "~> 3.1.7"
55
+ gem "listen", "~> 3.0.5"
56
+ gem "spring-watcher-listen", "~> 2.0.0"
36
57
  end
37
58
 
38
- appraise 'minitest_5_x' do
39
- gem 'minitest', '~> 5.0'
59
+ appraise "rails_5_1" do
60
+ instance_eval(&shared_dependencies)
61
+ gem "rails", "~> 5.1.6"
62
+ gem "rails-controller-testing", ">= 1.0.1"
63
+ gem "puma", "~> 3.7"
64
+ gem "sass-rails", "~> 5.0"
65
+ gem "turbolinks", "~> 5"
66
+ gem "jbuilder", "~> 2.5"
67
+ gem "bcrypt", "~> 3.1.7"
68
+ gem "capybara", "~> 2.13"
69
+ gem "selenium-webdriver"
70
+ gem "listen", ">= 3.0.5", "< 3.2"
71
+ gem "spring-watcher-listen", "~> 2.0.0"
40
72
  end
41
73
 
42
- appraise 'test_unit' do
43
- gem 'test-unit'
74
+ appraise "rails_5_2" do
75
+ instance_eval(&shared_dependencies)
76
+
77
+ gem "rails", "~> 5.2.2"
78
+ gem "rails-controller-testing", ">= 1.0.1"
79
+ gem "puma", "~> 3.11"
80
+ gem "bootsnap", ">= 1.1.0", require: false
81
+ gem "sass-rails", "~> 5.0"
82
+ gem "turbolinks", "~> 5"
83
+ gem "jbuilder", "~> 2.5"
84
+ gem "bcrypt", "~> 3.1.7"
85
+ gem "capybara", "~> 3.1.1"
86
+ gem "selenium-webdriver"
87
+ gem "chromedriver-helper"
88
+ gem "listen", ">= 3.0.5", "< 3.2"
89
+ gem "spring-watcher-listen", "~> 2.0.0"
90
+ end
91
+
92
+ if Gem::Requirement.new('>= 2.5.0').satisfied_by?(Gem::Version.new(RUBY_VERSION))
93
+ appraise "rails_6_0" do
94
+ instance_eval(&shared_dependencies)
95
+
96
+ gem "rails", "~> 6.0.2"
97
+ gem "puma", "~> 4.1"
98
+ gem "sass-rails", ">= 6"
99
+ gem "webpacker", "~> 4.0"
100
+ gem "turbolinks", "~> 5"
101
+ gem "jbuilder", "~> 2.7"
102
+ gem "bcrypt", "~> 3.1.7"
103
+ gem "bootsnap", ">= 1.4.2", require: false
104
+ gem "listen", ">= 3.0.5", "< 3.2"
105
+ gem "spring-watcher-listen", "~> 2.0.0"
106
+ gem "capybara", ">= 2.15"
107
+ gem "selenium-webdriver"
108
+ gem "sqlite3", "~> 1.4.0"
109
+ gem "webdrivers"
110
+
111
+ # Other dependencies
112
+ gem "rails-controller-testing", ">= 1.0.4"
113
+ gem "pg", "~> 1.1", platform: :ruby
114
+ end
44
115
  end
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0 (2020-06-13)
4
+
5
+ ### Backward-incompatible changes
6
+
7
+ * Drop support for RSpec 2 matchers. Matchers passed to `should` must conform
8
+ to RSpec 3's API (`failure_message` and `failure_message_when_negated`).
9
+ * Drop support for older versions of Rails. Rails 4.x-6.x are the
10
+ only versions supported now.
11
+ * Drop support for older versions of Ruby. Ruby 2.4.x-2.7.x are the only
12
+ versions supported now.
13
+
14
+ ### Bug fixes
15
+
16
+ * Fix how test names are generated so that when including the name of the
17
+ outermost test class, "Test" is not removed from the class name if it does not
18
+ fall at the end.
19
+ * Remove warning from Ruby about `context` not being used when using the gem
20
+ with warnings enabled.
21
+ * Fix macro autoloading code. Files intended to hold custom macros which are
22
+ located in either `test/shoulda_macros`, `vendor/gems/*/shoulda_macros`, or
23
+ `vendor/plugins/*/shoulda_macros` are now loaded and mixed into your test
24
+ framework's automatically.
25
+ * Restore compatibility with Shoulda Matchers, starting from 3.0.
26
+ * Fix some compatibility issues with Minitest 5.
27
+ * Fix running tests within a Rails < 5.2 environment so that when tests fail, an
28
+ error is not produced claiming that Minitest::Result cannot find a test
29
+ method.
data/Gemfile CHANGED
@@ -1,3 +1,17 @@
1
- source 'http://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem "appraisal"
6
+ gem "bundler", "~> 1.0"
7
+ gem "byebug"
8
+ gem "m"
9
+ gem "minitest"
10
+ gem "mocha"
11
+ gem "pry", "~> 0.12.0"
12
+ gem "pry-byebug", "~> 3.6.0"
13
+ gem "rake"
14
+ gem "rubocop", "0.71.0"
15
+ gem "snowglobe", ">= 0.3.0"
16
+ gem "test-unit"
17
+ gem "warnings_logger"