shoulda-matchers 1.4.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. data/.travis.yml +11 -3
  2. data/Appraisals +3 -3
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +69 -70
  5. data/MIT-LICENSE +1 -1
  6. data/NEWS.md +22 -4
  7. data/README.md +3 -1
  8. data/Rakefile +9 -5
  9. data/features/step_definitions/rails_steps.rb +7 -7
  10. data/features/support/env.rb +1 -1
  11. data/gemfiles/3.0.gemfile +1 -1
  12. data/gemfiles/3.0.gemfile.lock +25 -22
  13. data/gemfiles/3.1.gemfile +1 -1
  14. data/gemfiles/3.1.gemfile.lock +27 -24
  15. data/gemfiles/3.2.gemfile +1 -1
  16. data/gemfiles/3.2.gemfile.lock +56 -52
  17. data/lib/shoulda/matchers/action_controller.rb +3 -2
  18. data/lib/shoulda/matchers/action_controller/assign_to_matcher.rb +10 -8
  19. data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +2 -4
  20. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +3 -4
  21. data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +3 -4
  22. data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +6 -6
  23. data/lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb +5 -2
  24. data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +2 -2
  25. data/lib/shoulda/matchers/action_controller/route_matcher.rb +12 -12
  26. data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +3 -4
  27. data/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb +10 -11
  28. data/lib/shoulda/matchers/action_controller/strong_parameters_matcher.rb +121 -0
  29. data/lib/shoulda/matchers/action_mailer/have_sent_email_matcher.rb +7 -4
  30. data/lib/shoulda/matchers/active_model.rb +1 -1
  31. data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +8 -8
  32. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +5 -4
  33. data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +3 -3
  34. data/lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb +2 -2
  35. data/lib/shoulda/matchers/active_model/exception_message_finder.rb +0 -1
  36. data/lib/shoulda/matchers/active_model/helpers.rb +16 -7
  37. data/lib/shoulda/matchers/active_model/only_integer_matcher.rb +3 -3
  38. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +8 -6
  39. data/lib/shoulda/matchers/active_model/validate_format_of_matcher.rb +19 -10
  40. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +4 -4
  41. data/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb +19 -21
  42. data/lib/shoulda/matchers/active_model/validation_matcher.rb +7 -7
  43. data/lib/shoulda/matchers/active_model/validation_message_finder.rb +1 -1
  44. data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +5 -5
  45. data/lib/shoulda/matchers/active_record/association_matcher.rb +3 -3
  46. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +11 -7
  47. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +2 -2
  48. data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +5 -5
  49. data/lib/shoulda/matchers/active_record/query_the_database_matcher.rb +5 -2
  50. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +3 -3
  51. data/lib/shoulda/matchers/assertion_error.rb +4 -1
  52. data/lib/shoulda/matchers/independent/delegate_matcher.rb +17 -7
  53. data/lib/shoulda/matchers/integrations/rspec.rb +19 -33
  54. data/lib/shoulda/matchers/version.rb +1 -1
  55. data/shoulda-matchers.gemspec +6 -4
  56. data/spec/shoulda/matchers/action_controller/assign_to_matcher_spec.rb +66 -0
  57. data/spec/shoulda/matchers/action_controller/filter_param_matcher_spec.rb +22 -0
  58. data/spec/shoulda/matchers/action_controller/redirect_to_matcher_spec.rb +42 -0
  59. data/spec/shoulda/matchers/action_controller/render_template_matcher_spec.rb +78 -0
  60. data/spec/shoulda/matchers/action_controller/render_with_layout_matcher_spec.rb +58 -0
  61. data/spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb +31 -0
  62. data/spec/shoulda/matchers/action_controller/respond_with_matcher_spec.rb +31 -0
  63. data/spec/shoulda/matchers/action_controller/route_matcher_spec.rb +65 -0
  64. data/spec/shoulda/matchers/action_controller/set_session_matcher_spec.rb +51 -0
  65. data/spec/shoulda/matchers/action_controller/set_the_flash_matcher_spec.rb +153 -0
  66. data/spec/shoulda/matchers/action_controller/strong_parameters_matcher_spec.rb +142 -0
  67. data/spec/shoulda/matchers/action_mailer/have_sent_email_spec.rb +324 -0
  68. data/spec/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +111 -0
  69. data/spec/shoulda/matchers/active_model/allow_value_matcher_spec.rb +124 -0
  70. data/spec/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +43 -0
  71. data/spec/shoulda/matchers/active_model/ensure_exclusion_of_matcher_spec.rb +74 -0
  72. data/spec/shoulda/matchers/active_model/ensure_inclusion_of_matcher_spec.rb +171 -0
  73. data/spec/shoulda/matchers/active_model/ensure_length_of_matcher_spec.rb +113 -0
  74. data/spec/shoulda/{active_model → matchers/active_model}/exception_message_finder_spec.rb +2 -2
  75. data/spec/shoulda/matchers/active_model/helpers_spec.rb +158 -0
  76. data/spec/shoulda/matchers/active_model/only_integer_matcher_spec.rb +52 -0
  77. data/spec/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +41 -0
  78. data/spec/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +41 -0
  79. data/spec/shoulda/matchers/active_model/validate_format_of_matcher_spec.rb +75 -0
  80. data/spec/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +73 -0
  81. data/spec/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +127 -0
  82. data/spec/shoulda/matchers/active_model/validate_uniqueness_of_matcher_spec.rb +175 -0
  83. data/spec/shoulda/{active_model → matchers/active_model}/validation_message_finder_spec.rb +0 -1
  84. data/spec/shoulda/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb +106 -0
  85. data/spec/shoulda/matchers/active_record/association_matcher_spec.rb +534 -0
  86. data/spec/shoulda/matchers/active_record/have_db_column_matcher_spec.rb +111 -0
  87. data/spec/shoulda/matchers/active_record/have_db_index_matcher_spec.rb +78 -0
  88. data/spec/shoulda/matchers/active_record/have_readonly_attributes_matcher_spec.rb +41 -0
  89. data/spec/shoulda/{active_record → matchers/active_record}/query_the_database_matcher_spec.rb +10 -10
  90. data/spec/shoulda/matchers/active_record/serialize_matcher_spec.rb +86 -0
  91. data/spec/shoulda/{independent → matchers/independent}/delegate_matcher_spec.rb +55 -34
  92. data/spec/spec_helper.rb +1 -2
  93. data/spec/support/active_model_versions.rb +4 -0
  94. data/spec/support/activemodel_helpers.rb +19 -0
  95. data/spec/support/controller_builder.rb +38 -12
  96. data/spec/support/model_builder.rb +8 -2
  97. metadata +106 -98
  98. data/spec/fixtures/addresses.yml +0 -3
  99. data/spec/fixtures/friendships.yml +0 -0
  100. data/spec/fixtures/posts.yml +0 -5
  101. data/spec/fixtures/products.yml +0 -0
  102. data/spec/fixtures/taggings.yml +0 -0
  103. data/spec/fixtures/tags.yml +0 -9
  104. data/spec/fixtures/users.yml +0 -6
  105. data/spec/shoulda/action_controller/assign_to_matcher_spec.rb +0 -63
  106. data/spec/shoulda/action_controller/filter_param_matcher_spec.rb +0 -20
  107. data/spec/shoulda/action_controller/redirect_to_matcher_spec.rb +0 -40
  108. data/spec/shoulda/action_controller/render_template_matcher_spec.rb +0 -69
  109. data/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb +0 -55
  110. data/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb +0 -28
  111. data/spec/shoulda/action_controller/respond_with_matcher_spec.rb +0 -83
  112. data/spec/shoulda/action_controller/route_matcher_spec.rb +0 -65
  113. data/spec/shoulda/action_controller/set_session_matcher_spec.rb +0 -46
  114. data/spec/shoulda/action_controller/set_the_flash_matcher_spec.rb +0 -130
  115. data/spec/shoulda/action_mailer/have_sent_email_spec.rb +0 -333
  116. data/spec/shoulda/active_model/allow_mass_assignment_of_matcher_spec.rb +0 -115
  117. data/spec/shoulda/active_model/allow_value_matcher_spec.rb +0 -131
  118. data/spec/shoulda/active_model/disallow_value_matcher_spec.rb +0 -65
  119. data/spec/shoulda/active_model/ensure_exclusion_of_matcher_spec.rb +0 -79
  120. data/spec/shoulda/active_model/ensure_inclusion_of_matcher_spec.rb +0 -181
  121. data/spec/shoulda/active_model/ensure_length_of_matcher_spec.rb +0 -138
  122. data/spec/shoulda/active_model/helpers_spec.rb +0 -129
  123. data/spec/shoulda/active_model/only_integer_matcher_spec.rb +0 -69
  124. data/spec/shoulda/active_model/validate_acceptance_of_matcher_spec.rb +0 -43
  125. data/spec/shoulda/active_model/validate_confirmation_of_matcher_spec.rb +0 -48
  126. data/spec/shoulda/active_model/validate_format_of_matcher_spec.rb +0 -79
  127. data/spec/shoulda/active_model/validate_numericality_of_matcher_spec.rb +0 -112
  128. data/spec/shoulda/active_model/validate_presence_of_matcher_spec.rb +0 -135
  129. data/spec/shoulda/active_model/validate_uniqueness_of_matcher_spec.rb +0 -154
  130. data/spec/shoulda/active_record/accept_nested_attributes_for_matcher_spec.rb +0 -84
  131. data/spec/shoulda/active_record/association_matcher_spec.rb +0 -642
  132. data/spec/shoulda/active_record/have_db_column_matcher_spec.rb +0 -185
  133. data/spec/shoulda/active_record/have_db_index_matcher_spec.rb +0 -105
  134. data/spec/shoulda/active_record/have_readonly_attributes_matcher_spec.rb +0 -46
  135. data/spec/shoulda/active_record/serialize_matcher_spec.rb +0 -81
@@ -1,13 +1,12 @@
1
+ script: "bundle exec rake spec cucumber"
2
+
1
3
  rvm:
2
4
  - 1.8.7
3
5
  - 1.9.2
4
6
  - 1.9.3
5
- - ree
6
7
  - rbx-18mode
7
8
  - jruby
8
9
 
9
- script: "bundle exec rake spec cucumber"
10
-
11
10
  gemfile:
12
11
  - gemfiles/3.0.gemfile
13
12
  - gemfiles/3.1.gemfile
@@ -17,3 +16,12 @@ matrix:
17
16
  allow_failures:
18
17
  - rvm: rbx-18mode
19
18
  - rvm: jruby
19
+ exclude:
20
+ - rvm: rbx-18mode
21
+ gemfile: gemfiles/3.0.gemfile
22
+ - rvm: rbx-18mode
23
+ gemfile: gemfiles/3.1.gemfile
24
+ - rvm: jruby
25
+ gemfile: gemfiles/3.0.gemfile
26
+ - rvm: jruby
27
+ gemfile: gemfiles/3.1.gemfile
data/Appraisals CHANGED
@@ -1,15 +1,15 @@
1
1
  appraise '3.0' do
2
- gem 'rails', '3.0.17'
2
+ gem 'rails', '~> 3.0.17'
3
3
  end
4
4
 
5
5
  appraise '3.1' do
6
- gem 'rails', '3.1.8'
6
+ gem 'rails', '~> 3.1.8'
7
7
  gem 'jquery-rails'
8
8
  gem 'sass-rails'
9
9
  end
10
10
 
11
11
  appraise '3.2' do
12
- gem 'rails', '3.2.8'
12
+ gem 'rails', '~> 3.2.8'
13
13
  gem 'jquery-rails'
14
14
  gem 'sass-rails'
15
15
  end
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
@@ -1,106 +1,100 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shoulda-matchers (1.4.2)
4
+ shoulda-matchers (1.5.0)
5
5
  activesupport (>= 3.0.0)
6
- bourne (~> 1.1.2)
6
+ bourne (~> 1.2.0)
7
7
 
8
8
  GEM
9
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
10
10
  specs:
11
- actionmailer (3.2.3)
12
- actionpack (= 3.2.3)
11
+ actionmailer (3.2.9)
12
+ actionpack (= 3.2.9)
13
13
  mail (~> 2.4.4)
14
- actionpack (3.2.3)
15
- activemodel (= 3.2.3)
16
- activesupport (= 3.2.3)
14
+ actionpack (3.2.9)
15
+ activemodel (= 3.2.9)
16
+ activesupport (= 3.2.9)
17
17
  builder (~> 3.0.0)
18
18
  erubis (~> 2.7.0)
19
- journey (~> 1.0.1)
19
+ journey (~> 1.0.4)
20
20
  rack (~> 1.4.0)
21
21
  rack-cache (~> 1.2)
22
22
  rack-test (~> 0.6.1)
23
- sprockets (~> 2.1.2)
24
- activemodel (3.2.3)
25
- activesupport (= 3.2.3)
23
+ sprockets (~> 2.2.1)
24
+ activemodel (3.2.9)
25
+ activesupport (= 3.2.9)
26
26
  builder (~> 3.0.0)
27
- activerecord (3.2.3)
28
- activemodel (= 3.2.3)
29
- activesupport (= 3.2.3)
27
+ activerecord (3.2.9)
28
+ activemodel (= 3.2.9)
29
+ activesupport (= 3.2.9)
30
30
  arel (~> 3.0.2)
31
31
  tzinfo (~> 0.3.29)
32
- activeresource (3.2.3)
33
- activemodel (= 3.2.3)
34
- activesupport (= 3.2.3)
35
- activesupport (3.2.3)
32
+ activeresource (3.2.9)
33
+ activemodel (= 3.2.9)
34
+ activesupport (= 3.2.9)
35
+ activesupport (3.2.9)
36
36
  i18n (~> 0.6)
37
37
  multi_json (~> 1.0)
38
- appraisal (0.4.1)
38
+ appraisal (0.5.1)
39
39
  bundler
40
40
  rake
41
41
  arel (3.0.2)
42
- aruba (0.4.6)
43
- bcat (>= 0.6.1)
44
- childprocess (>= 0.2.0)
45
- cucumber (>= 1.0.2)
46
- rdiscount (>= 1.6.8)
47
- rspec (>= 2.6.0)
48
- bcat (0.6.2)
49
- rack (~> 1.0)
50
- bourne (1.1.2)
51
- mocha (= 0.10.5)
52
- builder (3.0.0)
53
- childprocess (0.3.1)
54
- ffi (~> 1.0.6)
55
- cucumber (1.1.9)
42
+ aruba (0.5.1)
43
+ childprocess (~> 0.3.6)
44
+ cucumber (>= 1.1.1)
45
+ rspec-expectations (>= 2.7.0)
46
+ bourne (1.2.1)
47
+ mocha (= 0.12.7)
48
+ builder (3.0.4)
49
+ childprocess (0.3.6)
50
+ ffi (~> 1.0, >= 1.0.6)
51
+ cucumber (1.2.1)
56
52
  builder (>= 2.1.2)
57
- diff-lcs (>= 1.1.2)
58
- gherkin (~> 2.9.0)
53
+ diff-lcs (>= 1.1.3)
54
+ gherkin (~> 2.11.0)
59
55
  json (>= 1.4.6)
60
- term-ansicolor (>= 1.0.6)
61
56
  diff-lcs (1.1.3)
62
57
  erubis (2.7.0)
63
- ffi (1.0.11)
64
- gherkin (2.9.3)
58
+ ffi (1.2.0)
59
+ gherkin (2.11.5)
65
60
  json (>= 1.4.6)
66
61
  hike (1.2.1)
67
- i18n (0.6.0)
68
- journey (1.0.3)
69
- json (1.6.6)
62
+ i18n (0.6.1)
63
+ journey (1.0.4)
64
+ json (1.7.6)
70
65
  mail (2.4.4)
71
66
  i18n (>= 0.4.0)
72
67
  mime-types (~> 1.16)
73
68
  treetop (~> 1.4.8)
74
69
  metaclass (0.0.1)
75
- mime-types (1.18)
76
- mocha (0.10.5)
70
+ mime-types (1.19)
71
+ mocha (0.12.7)
77
72
  metaclass (~> 0.0.1)
78
- multi_json (1.3.2)
73
+ multi_json (1.5.0)
79
74
  polyglot (0.3.3)
80
- rack (1.4.1)
75
+ rack (1.4.4)
81
76
  rack-cache (1.2)
82
77
  rack (>= 0.4)
83
78
  rack-ssl (1.3.2)
84
79
  rack
85
- rack-test (0.6.1)
80
+ rack-test (0.6.2)
86
81
  rack (>= 1.0)
87
- rails (3.2.3)
88
- actionmailer (= 3.2.3)
89
- actionpack (= 3.2.3)
90
- activerecord (= 3.2.3)
91
- activeresource (= 3.2.3)
92
- activesupport (= 3.2.3)
82
+ rails (3.2.9)
83
+ actionmailer (= 3.2.9)
84
+ actionpack (= 3.2.9)
85
+ activerecord (= 3.2.9)
86
+ activeresource (= 3.2.9)
87
+ activesupport (= 3.2.9)
93
88
  bundler (~> 1.0)
94
- railties (= 3.2.3)
95
- railties (3.2.3)
96
- actionpack (= 3.2.3)
97
- activesupport (= 3.2.3)
89
+ railties (= 3.2.9)
90
+ railties (3.2.9)
91
+ actionpack (= 3.2.9)
92
+ activesupport (= 3.2.9)
98
93
  rack-ssl (~> 1.3.2)
99
94
  rake (>= 0.8.7)
100
95
  rdoc (~> 3.4)
101
- thor (~> 0.14.6)
102
- rake (0.9.2.2)
103
- rdiscount (1.6.8)
96
+ thor (>= 0.14.6, < 2.0)
97
+ rake (10.0.3)
104
98
  rdoc (3.12)
105
99
  json (~> 1.4)
106
100
  rspec (2.8.0)
@@ -116,19 +110,23 @@ GEM
116
110
  activesupport (>= 3.0)
117
111
  railties (>= 3.0)
118
112
  rspec (~> 2.8.0)
119
- shoulda-context (1.0.0)
120
- sprockets (2.1.2)
113
+ shoulda-context (1.0.1)
114
+ sprockets (2.2.2)
121
115
  hike (~> 1.2)
116
+ multi_json (~> 1.0)
122
117
  rack (~> 1.0)
123
118
  tilt (~> 1.1, != 1.3.0)
124
- sqlite3 (1.3.5)
125
- term-ansicolor (1.0.7)
126
- thor (0.14.6)
119
+ sqlite3 (1.3.6)
120
+ strong_parameters (0.1.5)
121
+ actionpack (~> 3.1)
122
+ activemodel (~> 3.1)
123
+ railties (~> 3.1)
124
+ thor (0.16.0)
127
125
  tilt (1.3.3)
128
- treetop (1.4.10)
126
+ treetop (1.4.12)
129
127
  polyglot
130
128
  polyglot (>= 0.3.1)
131
- tzinfo (0.3.33)
129
+ tzinfo (0.3.35)
132
130
 
133
131
  PLATFORMS
134
132
  ruby
@@ -136,16 +134,17 @@ PLATFORMS
136
134
  DEPENDENCIES
137
135
  activerecord-jdbc-adapter
138
136
  activerecord-jdbcsqlite3-adapter
139
- appraisal (~> 0.4.0)
137
+ appraisal (~> 0.4)
140
138
  aruba
141
139
  bundler (~> 1.1)
142
- cucumber (~> 1.1.9)
140
+ cucumber (~> 1.1)
143
141
  jdbc-sqlite3
144
142
  jruby-openssl
145
143
  rails (~> 3.0)
146
- rake (~> 0.9.2)
144
+ rake (>= 0.9.2)
147
145
  rspec-rails (~> 2.8.1)
148
146
  shoulda-context (~> 1.0.0)
149
147
  shoulda-matchers!
150
148
  sqlite3
149
+ strong_parameters
151
150
  therubyrhino
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc.
1
+ Copyright (c) 2006-2013, Tammer Saleh, thoughtbot, inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/NEWS.md CHANGED
@@ -1,10 +1,28 @@
1
+ # HEAD
2
+
3
+ # v 1.5.0
4
+ * Deprecate the following matchers:
5
+ * assign_to
6
+ * respond_with_content_type
7
+ * query_the_database
8
+ * validate_format_of
9
+ * have_sent_email
10
+ * strong_parameters_matcher
11
+ * delegate_method
12
+
13
+ * Use RSpec's native `configure.include` syntax for including matchers into
14
+ RSpec (#204)
15
+
16
+ * Do not force minitest loading when test-unit is available (this was fixed
17
+ before 1.3.0 then reverted in 1.3.0) (#181)
18
+
1
19
  # v1.4.2
2
- * Added a new delegate_method matcher.
20
+ * Added a new `delegate_method` matcher.
3
21
 
4
22
  # v1.4.1
5
23
  * Fixes an issue when used with Test::Unit on the allow value matcher.
6
24
 
7
- * Fixes an issue with using ensure_inclusion_of(:attr) given an array of true or false values.
25
+ * Fixes an issue with using `ensure_inclusion_of(:attr)` given an array of true or false values.
8
26
 
9
27
  # v1.4.0
10
28
 
@@ -16,7 +34,7 @@
16
34
 
17
35
  * You can now pass an array to `ensure_exclusion_of` using `in_array`.
18
36
 
19
- * Allow testing of :foreign_key option for has_one relationships using the association matcher.
37
+ * Allow testing of `:foreign_key` option for `has_one` relationships using the association matcher.
20
38
 
21
39
  * Fix bug where `ensure_length_of` would pass if the given string was too long.
22
40
 
@@ -24,7 +42,7 @@
24
42
 
25
43
  * Test outside values for `ensure_inclusion_of` when given an array.
26
44
 
27
- * Fixed the output of the set_the_flash matcher.
45
+ * Fixed the output of the `set_the_flash` matcher.
28
46
 
29
47
  # v1.3.0
30
48
 
data/README.md CHANGED
@@ -51,6 +51,8 @@ Matchers to test common patterns:
51
51
 
52
52
  ```ruby
53
53
  describe PostsController, "#show" do
54
+ it { should permit(:title, :body).for(:create) }
55
+
54
56
  context "for a fictional user" do
55
57
  before do
56
58
  get :show, :id => 1
@@ -99,5 +101,5 @@ Thank you to all the [contributors](https://github.com/thoughtbot/shoulda-matche
99
101
 
100
102
  ## License
101
103
 
102
- Shoulda is Copyright © 2006-2012 thoughtbot, inc.
104
+ Shoulda is Copyright © 2006-2013 thoughtbot, inc.
103
105
  It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
data/Rakefile CHANGED
@@ -15,10 +15,14 @@ Cucumber::Rake::Task.new do |t|
15
15
  t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
16
16
  end
17
17
 
18
- desc 'Test the plugin under all supported Rails versions.'
19
- task :all => ["appraisal:cleanup", "appraisal:install"] do
20
- exec('rake appraisal spec cucumber')
18
+ task :default do |t|
19
+ if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
20
+ exec 'rake spec cucumber'
21
+ else
22
+ Rake::Task['appraise'].execute
23
+ end
21
24
  end
22
25
 
23
- desc 'Default: run specs and cucumber features'
24
- task :default => [:all]
26
+ task :appraise => ['appraisal:install'] do |t|
27
+ exec 'rake appraisal'
28
+ end
@@ -25,8 +25,8 @@ When 'I generate a new rails application' do
25
25
  And I set the "BUNDLE_GEMFILE" environment variable to "Gemfile"
26
26
  And I successfully run `bundle install --local`
27
27
  }
28
- if RUBY_VERSION >= "1.9.3"
29
- append_to_gemfile %(gem "rake", "~> 0.9.3.beta.1")
28
+ if RUBY_VERSION >= '1.9.3'
29
+ append_to_gemfile %(gem 'rake', '~> 0.9.3.beta.1')
30
30
  step %(I successfully run `bundle update rake`)
31
31
  end
32
32
  end
@@ -52,7 +52,7 @@ When 'I run the rspec generator' do
52
52
  end
53
53
 
54
54
  When 'I configure the application to use rspec-rails' do
55
- append_to_gemfile "gem 'rspec-rails', '~> 2.8.1'"
55
+ append_to_gemfile %q(gem 'rspec-rails', '~> 2.8.1')
56
56
  steps %{And I run `bundle install --local`}
57
57
  end
58
58
 
@@ -66,7 +66,7 @@ When 'I configure the application to use rspec-rails in test and development' do
66
66
  end
67
67
 
68
68
  When 'I configure the application to use shoulda-context' do
69
- append_to_gemfile "gem 'shoulda-context', '~> 1.0.0'"
69
+ append_to_gemfile %q(gem 'shoulda-context', '~> 1.0.0')
70
70
  steps %{And I run `bundle install --local`}
71
71
  end
72
72
 
@@ -106,7 +106,7 @@ end
106
106
  module FileHelpers
107
107
  def append_to(path, contents)
108
108
  in_current_dir do
109
- File.open(path, "a") do |file|
109
+ File.open(path, 'a') do |file|
110
110
  file.puts
111
111
  file.puts contents
112
112
  end
@@ -119,9 +119,9 @@ module FileHelpers
119
119
 
120
120
  def comment_out_gem_in_gemfile(gemname)
121
121
  in_current_dir do
122
- gemfile = File.read("Gemfile")
122
+ gemfile = File.read('Gemfile')
123
123
  gemfile.sub!(/^(\s*)(gem\s*['"]#{gemname})/, "\\1# \\2")
124
- File.open("Gemfile", 'w'){ |file| file.write(gemfile) }
124
+ File.open('Gemfile', 'w'){ |file| file.write(gemfile) }
125
125
  end
126
126
  end
127
127
  end
@@ -1,5 +1,5 @@
1
1
  require 'aruba/cucumber'
2
2
 
3
3
  Before do
4
- @aruba_timeout_seconds = 120
4
+ @aruba_timeout_seconds = 60 * 2
5
5
  end
@@ -9,6 +9,6 @@ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
9
9
  gem "jdbc-sqlite3", :platform=>:jruby
10
10
  gem "jruby-openssl", :platform=>:jruby
11
11
  gem "therubyrhino", :platform=>:jruby
12
- gem "rails", "3.0.17"
12
+ gem "rails", "~> 3.0.17"
13
13
 
14
14
  gemspec :path=>"../"
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: /Users/draper/Dropbox/Development/shoulda-matchers
3
3
  specs:
4
- shoulda-matchers (1.4.1)
4
+ shoulda-matchers (1.5.0)
5
5
  activesupport (>= 3.0.0)
6
- bourne (~> 1.1.2)
6
+ bourne (~> 1.2.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
@@ -35,7 +35,7 @@ GEM
35
35
  activemodel (= 3.0.17)
36
36
  activesupport (= 3.0.17)
37
37
  activesupport (3.0.17)
38
- appraisal (0.4.1)
38
+ appraisal (0.5.1)
39
39
  bundler
40
40
  rake
41
41
  arel (2.0.10)
@@ -43,25 +43,24 @@ GEM
43
43
  childprocess (~> 0.3.6)
44
44
  cucumber (>= 1.1.1)
45
45
  rspec-expectations (>= 2.7.0)
46
- bourne (1.1.2)
47
- mocha (= 0.10.5)
46
+ bourne (1.2.1)
47
+ mocha (= 0.12.7)
48
48
  builder (2.1.2)
49
49
  childprocess (0.3.6)
50
50
  ffi (~> 1.0, >= 1.0.6)
51
- cucumber (1.1.9)
51
+ cucumber (1.2.1)
52
52
  builder (>= 2.1.2)
53
- diff-lcs (>= 1.1.2)
54
- gherkin (~> 2.9.0)
53
+ diff-lcs (>= 1.1.3)
54
+ gherkin (~> 2.11.0)
55
55
  json (>= 1.4.6)
56
- term-ansicolor (>= 1.0.6)
57
56
  diff-lcs (1.1.3)
58
57
  erubis (2.6.6)
59
58
  abstract (>= 1.0.0)
60
- ffi (1.2.0)
61
- gherkin (2.9.3)
59
+ ffi (1.3.1)
60
+ gherkin (2.11.5)
62
61
  json (>= 1.4.6)
63
62
  i18n (0.5.0)
64
- json (1.7.5)
63
+ json (1.7.6)
65
64
  mail (2.2.19)
66
65
  activesupport (>= 2.3.6)
67
66
  i18n (>= 0.4.0)
@@ -69,10 +68,10 @@ GEM
69
68
  treetop (~> 1.4.8)
70
69
  metaclass (0.0.1)
71
70
  mime-types (1.19)
72
- mocha (0.10.5)
71
+ mocha (0.12.7)
73
72
  metaclass (~> 0.0.1)
74
73
  polyglot (0.3.3)
75
- rack (1.2.5)
74
+ rack (1.2.7)
76
75
  rack-mount (0.6.14)
77
76
  rack (>= 1.0.0)
78
77
  rack-test (0.5.7)
@@ -91,7 +90,7 @@ GEM
91
90
  rake (>= 0.8.7)
92
91
  rdoc (~> 3.4)
93
92
  thor (~> 0.14.4)
94
- rake (0.9.5)
93
+ rake (10.0.3)
95
94
  rdoc (3.12)
96
95
  json (~> 1.4)
97
96
  rspec (2.8.0)
@@ -107,9 +106,12 @@ GEM
107
106
  activesupport (>= 3.0)
108
107
  railties (>= 3.0)
109
108
  rspec (~> 2.8.0)
110
- shoulda-context (1.0.1)
111
- sqlite3 (1.3.6)
112
- term-ansicolor (1.0.7)
109
+ shoulda-context (1.0.2)
110
+ sqlite3 (1.3.7)
111
+ strong_parameters (0.1.6)
112
+ actionpack (~> 3.0)
113
+ activemodel (~> 3.0)
114
+ railties (~> 3.0)
113
115
  thor (0.14.6)
114
116
  treetop (1.4.12)
115
117
  polyglot
@@ -122,16 +124,17 @@ PLATFORMS
122
124
  DEPENDENCIES
123
125
  activerecord-jdbc-adapter
124
126
  activerecord-jdbcsqlite3-adapter
125
- appraisal (~> 0.4.0)
127
+ appraisal (~> 0.4)
126
128
  aruba
127
129
  bundler (~> 1.1)
128
- cucumber (~> 1.1.9)
130
+ cucumber (~> 1.1)
129
131
  jdbc-sqlite3
130
132
  jruby-openssl
131
- rails (= 3.0.17)
132
- rake (~> 0.9.2)
133
+ rails (~> 3.0.17)
134
+ rake (>= 0.9.2)
133
135
  rspec-rails (~> 2.8.1)
134
136
  shoulda-context (~> 1.0.0)
135
137
  shoulda-matchers!
136
138
  sqlite3
139
+ strong_parameters
137
140
  therubyrhino