shoulda-matchers 3.0.0.rc1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -3
- data/Gemfile.lock +12 -41
- data/NEWS.md +118 -26
- data/README.md +34 -11
- data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +0 -0
- data/doc_config/yard/templates/default/fulldoc/html/css/style.css +4 -0
- data/gemfiles/4.0.0.gemfile +2 -3
- data/gemfiles/4.0.0.gemfile.lock +47 -77
- data/gemfiles/4.0.1.gemfile +2 -3
- data/gemfiles/4.0.1.gemfile.lock +51 -79
- data/gemfiles/4.1.gemfile +2 -3
- data/gemfiles/4.1.gemfile.lock +73 -103
- data/gemfiles/4.2.gemfile +2 -3
- data/gemfiles/4.2.gemfile.lock +90 -124
- data/lib/shoulda/matchers.rb +1 -0
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +6 -8
- data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +1 -3
- data/lib/shoulda/matchers/action_controller/flash_store.rb +1 -8
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +140 -88
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +2 -5
- data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +5 -10
- data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +2 -4
- data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +1 -3
- data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +3 -5
- data/lib/shoulda/matchers/action_controller/route_matcher.rb +5 -7
- data/lib/shoulda/matchers/action_controller/set_flash_matcher.rb +35 -9
- data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model.rb +57 -1
- data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +2 -5
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +162 -54
- data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +5 -2
- data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +1 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +24 -11
- data/lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb +4 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +0 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb +4 -3
- data/lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb +2 -1
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +15 -13
- data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +3 -3
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +4 -4
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +8 -8
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +8 -8
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +12 -14
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +10 -4
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +0 -3
- data/lib/shoulda/matchers/active_model/validator.rb +0 -8
- data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +4 -6
- data/lib/shoulda/matchers/active_record/association_matcher.rb +58 -43
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +2 -2
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +1 -4
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +3 -5
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +7 -7
- data/lib/shoulda/matchers/doublespeak/double.rb +10 -1
- data/lib/shoulda/matchers/doublespeak/double_collection.rb +13 -5
- data/lib/shoulda/matchers/doublespeak/method_call.rb +10 -1
- data/lib/shoulda/matchers/doublespeak/object_double.rb +2 -1
- data/lib/shoulda/matchers/doublespeak/world.rb +10 -0
- data/lib/shoulda/matchers/error.rb +4 -0
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +11 -10
- data/lib/shoulda/matchers/integrations/libraries.rb +1 -0
- data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/active_model.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/active_record.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -1
- data/lib/shoulda/matchers/integrations/libraries/routing.rb +27 -0
- data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/rspec.rb +2 -2
- data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
- data/lib/shoulda/matchers/routing.rb +10 -0
- data/lib/shoulda/matchers/version.rb +1 -1
- data/script/SUPPORTED_VERSIONS +1 -1
- data/spec/acceptance/independent_matchers_spec.rb +103 -42
- data/spec/doublespeak_spec_helper.rb +5 -1
- data/spec/support/acceptance/adds_shoulda_matchers_to_project.rb +34 -11
- data/spec/support/acceptance/helpers/rspec_helpers.rb +9 -13
- data/spec/support/acceptance/helpers/step_helpers.rb +13 -0
- data/spec/support/acceptance/matchers/have_output.rb +1 -1
- data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +1 -1
- data/spec/support/tests/command_runner.rb +5 -1
- data/spec/support/unit/helpers/active_record_versions.rb +0 -4
- data/spec/support/unit/shared_examples/set_session_or_flash.rb +8 -3
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +198 -39
- data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +269 -102
- data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +24 -0
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +118 -101
- data/spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +0 -82
- data/spec/unit/shoulda/matchers/active_model/numericality_matchers/comparison_matcher_spec.rb +148 -121
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +20 -8
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +64 -183
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +14 -0
- data/spec/unit/shoulda/matchers/doublespeak/double_collection_spec.rb +60 -0
- data/spec/unit/shoulda/matchers/doublespeak/double_spec.rb +23 -7
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +242 -0
- data/spec/unit_spec_helper.rb +4 -0
- data/tasks/documentation.rb +35 -0
- metadata +9 -8
- data/Guardfile +0 -5
- data/cucumber.yml +0 -1
- data/lib/shoulda/matchers/active_model/validator_with_captured_range_error.rb +0 -12
@@ -31,15 +31,18 @@ module Shoulda
|
|
31
31
|
self
|
32
32
|
end
|
33
33
|
|
34
|
+
def ignoring_interference_by_writer
|
35
|
+
@allow_matcher.ignoring_interference_by_writer
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
34
39
|
def failure_message
|
35
40
|
@allow_matcher.failure_message_when_negated
|
36
41
|
end
|
37
|
-
alias failure_message_for_should failure_message
|
38
42
|
|
39
43
|
def failure_message_when_negated
|
40
44
|
@allow_matcher.failure_message
|
41
45
|
end
|
42
|
-
alias failure_message_for_should_not failure_message_when_negated
|
43
46
|
|
44
47
|
def strict
|
45
48
|
@allow_matcher.strict
|
@@ -19,7 +19,7 @@ module Shoulda
|
|
19
19
|
# it { should have_secure_password }
|
20
20
|
# end
|
21
21
|
#
|
22
|
-
# #
|
22
|
+
# # Minitest (Shoulda)
|
23
23
|
# class UserTest < ActiveSupport::TestCase
|
24
24
|
# should have_secure_password
|
25
25
|
# end
|
@@ -34,8 +34,6 @@ module Shoulda
|
|
34
34
|
class HaveSecurePasswordMatcher
|
35
35
|
attr_reader :failure_message
|
36
36
|
|
37
|
-
alias failure_message_for_should failure_message
|
38
|
-
|
39
37
|
CORRECT_PASSWORD = "aBcDe12345"
|
40
38
|
INCORRECT_PASSWORD = "password"
|
41
39
|
|
@@ -24,33 +24,42 @@ module Shoulda
|
|
24
24
|
@strict = false
|
25
25
|
end
|
26
26
|
|
27
|
+
def description
|
28
|
+
message = "validate that #{@attribute} is #{comparison_expectation} #{@value}"
|
29
|
+
|
30
|
+
if @strict
|
31
|
+
message << " strictly"
|
32
|
+
end
|
33
|
+
|
34
|
+
message
|
35
|
+
end
|
36
|
+
|
27
37
|
def for(attribute)
|
28
38
|
@attribute = attribute
|
29
39
|
self
|
30
40
|
end
|
31
41
|
|
32
|
-
def matches?(subject)
|
33
|
-
@subject = subject
|
34
|
-
all_bounds_correct?
|
35
|
-
end
|
36
|
-
|
37
42
|
def with_message(message)
|
38
43
|
@message = message
|
44
|
+
self
|
39
45
|
end
|
40
46
|
|
41
|
-
def
|
42
|
-
|
47
|
+
def matches?(subject)
|
48
|
+
@subject = subject
|
49
|
+
all_bounds_correct?
|
43
50
|
end
|
44
51
|
|
45
52
|
def failure_message
|
46
53
|
last_failing_submatcher.failure_message
|
47
54
|
end
|
48
|
-
alias failure_message_for_should failure_message
|
49
55
|
|
50
56
|
def failure_message_when_negated
|
51
57
|
last_failing_submatcher.failure_message_when_negated
|
52
58
|
end
|
53
|
-
|
59
|
+
|
60
|
+
def comparison_description
|
61
|
+
"#{comparison_expectation} #{@value}"
|
62
|
+
end
|
54
63
|
|
55
64
|
private
|
56
65
|
|
@@ -71,7 +80,11 @@ module Shoulda
|
|
71
80
|
def submatchers
|
72
81
|
@_submatchers ||=
|
73
82
|
comparison_combos.map do |diff, submatcher_method_name|
|
74
|
-
matcher = __send__(
|
83
|
+
matcher = __send__(
|
84
|
+
submatcher_method_name,
|
85
|
+
(@value + diff).to_s,
|
86
|
+
nil
|
87
|
+
)
|
75
88
|
matcher.with_message(@message, values: { count: @value })
|
76
89
|
matcher
|
77
90
|
end
|
@@ -118,7 +131,7 @@ module Shoulda
|
|
118
131
|
[-diff, 0, diff]
|
119
132
|
end
|
120
133
|
|
121
|
-
def
|
134
|
+
def comparison_expectation
|
122
135
|
case @operator
|
123
136
|
when :> then "greater than"
|
124
137
|
when :>= then "greater than or equal to"
|
@@ -8,9 +8,10 @@ module Shoulda
|
|
8
8
|
|
9
9
|
def initialize(attribute, options = {})
|
10
10
|
@attribute = attribute
|
11
|
-
@disallow_value_matcher =
|
12
|
-
|
13
|
-
|
11
|
+
@disallow_value_matcher =
|
12
|
+
DisallowValueMatcher.new(NON_EVEN_NUMBER_VALUE.to_s).
|
13
|
+
for(@attribute).
|
14
|
+
with_message(:even)
|
14
15
|
end
|
15
16
|
|
16
17
|
def allowed_type
|
@@ -38,12 +38,10 @@ module Shoulda
|
|
38
38
|
def failure_message
|
39
39
|
@disallow_value_matcher.failure_message
|
40
40
|
end
|
41
|
-
alias failure_message_for_should failure_message
|
42
41
|
|
43
42
|
def failure_message_when_negated
|
44
43
|
@disallow_value_matcher.failure_message_when_negated
|
45
44
|
end
|
46
|
-
alias failure_message_for_should_not failure_message_when_negated
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
@@ -8,9 +8,10 @@ module Shoulda
|
|
8
8
|
|
9
9
|
def initialize(attribute, options = {})
|
10
10
|
@attribute = attribute
|
11
|
-
@disallow_value_matcher =
|
12
|
-
|
13
|
-
|
11
|
+
@disallow_value_matcher =
|
12
|
+
DisallowValueMatcher.new(NON_ODD_NUMBER_VALUE.to_s).
|
13
|
+
for(@attribute).
|
14
|
+
with_message(:odd)
|
14
15
|
end
|
15
16
|
|
16
17
|
def allowed_type
|
@@ -7,7 +7,8 @@ module Shoulda
|
|
7
7
|
NON_INTEGER_VALUE = 0.1
|
8
8
|
def initialize(attribute)
|
9
9
|
@attribute = attribute
|
10
|
-
@disallow_value_matcher =
|
10
|
+
@disallow_value_matcher =
|
11
|
+
DisallowValueMatcher.new(NON_INTEGER_VALUE.to_s).
|
11
12
|
for(attribute).
|
12
13
|
with_message(:not_an_integer)
|
13
14
|
end
|
@@ -16,7 +16,7 @@ module Shoulda
|
|
16
16
|
# it { should validate_absence_of(:arms) }
|
17
17
|
# end
|
18
18
|
#
|
19
|
-
# #
|
19
|
+
# # Minitest (Shoulda)
|
20
20
|
# class ArtilleryTest < ActiveSupport::TestCase
|
21
21
|
# should validate_absence_of(:arms)
|
22
22
|
# end
|
@@ -39,7 +39,7 @@ module Shoulda
|
|
39
39
|
# it { should validate_absence_of(:arms).on(:create) }
|
40
40
|
# end
|
41
41
|
#
|
42
|
-
# #
|
42
|
+
# # Minitest (Shoulda)
|
43
43
|
# class ArtilleryTest < ActiveSupport::TestCase
|
44
44
|
# should validate_absence_of(:arms).on(:create)
|
45
45
|
# end
|
@@ -64,7 +64,7 @@ module Shoulda
|
|
64
64
|
# end
|
65
65
|
# end
|
66
66
|
#
|
67
|
-
# #
|
67
|
+
# # Minitest (Shoulda)
|
68
68
|
# class ArtilleryTest < ActiveSupport::TestCase
|
69
69
|
# should validate_absence_of(:arms).
|
70
70
|
# with_message("We're fresh outta arms here, soldier!")
|
@@ -86,6 +86,7 @@ module Shoulda
|
|
86
86
|
def matches?(subject)
|
87
87
|
super(subject)
|
88
88
|
@expected_message ||= :present
|
89
|
+
|
89
90
|
disallows_value_of(value, @expected_message)
|
90
91
|
end
|
91
92
|
|
@@ -103,21 +104,22 @@ module Shoulda
|
|
103
104
|
else
|
104
105
|
obj
|
105
106
|
end
|
106
|
-
elsif [Fixnum, Float].include?(attribute_class)
|
107
|
-
1
|
108
|
-
elsif attribute_class == BigDecimal
|
109
|
-
BigDecimal.new(1, 0)
|
110
|
-
elsif !attribute_class || attribute_class == String
|
111
|
-
'an arbitrary value'
|
112
107
|
else
|
113
|
-
|
108
|
+
case column_type
|
109
|
+
when :integer, :float then 1
|
110
|
+
when :decimal then BigDecimal.new(1, 0)
|
111
|
+
when :datetime, :time, :timestamp then Time.now
|
112
|
+
when :date then Date.new
|
113
|
+
when :binary then "0"
|
114
|
+
else 'an arbitrary value'
|
115
|
+
end
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
117
|
-
def
|
119
|
+
def column_type
|
118
120
|
@subject.class.respond_to?(:columns_hash) &&
|
119
|
-
@subject.class.columns_hash[@attribute.to_s].respond_to?(:
|
120
|
-
@subject.class.columns_hash[@attribute.to_s].
|
121
|
+
@subject.class.columns_hash[@attribute.to_s].respond_to?(:type) &&
|
122
|
+
@subject.class.columns_hash[@attribute.to_s].type
|
121
123
|
end
|
122
124
|
|
123
125
|
def collection?
|
@@ -16,7 +16,7 @@ module Shoulda
|
|
16
16
|
# it { should validate_acceptance_of(:eula) }
|
17
17
|
# end
|
18
18
|
#
|
19
|
-
# #
|
19
|
+
# # Minitest (Shoulda)
|
20
20
|
# class RegistrationTest < ActiveSupport::TestCase
|
21
21
|
# should validate_acceptance_of(:eula)
|
22
22
|
# end
|
@@ -42,7 +42,7 @@ module Shoulda
|
|
42
42
|
# end
|
43
43
|
# end
|
44
44
|
#
|
45
|
-
# #
|
45
|
+
# # Minitest (Shoulda)
|
46
46
|
# class RegistrationTest < ActiveSupport::TestCase
|
47
47
|
# should validate_acceptance_of(:terms_of_service).on(:create)
|
48
48
|
# end
|
@@ -67,7 +67,7 @@ module Shoulda
|
|
67
67
|
# end
|
68
68
|
# end
|
69
69
|
#
|
70
|
-
# #
|
70
|
+
# # Minitest (Shoulda)
|
71
71
|
# class RegistrationTest < ActiveSupport::TestCase
|
72
72
|
# should validate_acceptance_of(:terms_of_service).
|
73
73
|
# with_message('You must accept the terms of service')
|
@@ -16,7 +16,7 @@ module Shoulda
|
|
16
16
|
# it { should validate_confirmation_of(:email) }
|
17
17
|
# end
|
18
18
|
#
|
19
|
-
# #
|
19
|
+
# # Minitest (Shoulda)
|
20
20
|
# class UserTest < ActiveSupport::TestCase
|
21
21
|
# should validate_confirmation_of(:email)
|
22
22
|
# end
|
@@ -39,7 +39,7 @@ module Shoulda
|
|
39
39
|
# it { should validate_confirmation_of(:password).on(:create) }
|
40
40
|
# end
|
41
41
|
#
|
42
|
-
# #
|
42
|
+
# # Minitest (Shoulda)
|
43
43
|
# class UserTest < ActiveSupport::TestCase
|
44
44
|
# should validate_confirmation_of(:password).on(:create)
|
45
45
|
# end
|
@@ -64,7 +64,7 @@ module Shoulda
|
|
64
64
|
# end
|
65
65
|
# end
|
66
66
|
#
|
67
|
-
# #
|
67
|
+
# # Minitest (Shoulda)
|
68
68
|
# class UserTest < ActiveSupport::TestCase
|
69
69
|
# should validate_confirmation_of(:password).
|
70
70
|
# with_message('Please re-enter your password')
|
@@ -23,7 +23,7 @@ module Shoulda
|
|
23
23
|
# end
|
24
24
|
# end
|
25
25
|
#
|
26
|
-
# #
|
26
|
+
# # Minitest (Shoulda)
|
27
27
|
# class GameTest < ActiveSupport::TestCase
|
28
28
|
# should validate_exclusion_of(:supported_os).
|
29
29
|
# in_array(['Mac', 'Linux'])
|
@@ -46,7 +46,7 @@ module Shoulda
|
|
46
46
|
# end
|
47
47
|
# end
|
48
48
|
#
|
49
|
-
# #
|
49
|
+
# # Minitest (Shoulda)
|
50
50
|
# class GameTest < ActiveSupport::TestCase
|
51
51
|
# should validate_exclusion_of(:floors_with_enemies).
|
52
52
|
# in_range(5..8)
|
@@ -76,7 +76,7 @@ module Shoulda
|
|
76
76
|
# end
|
77
77
|
# end
|
78
78
|
#
|
79
|
-
# #
|
79
|
+
# # Minitest (Shoulda)
|
80
80
|
# class GameTest < ActiveSupport::TestCase
|
81
81
|
# should validate_exclusion_of(:weapon).
|
82
82
|
# in_array(['pistol', 'paintball gun', 'stick']).
|
@@ -105,7 +105,7 @@ module Shoulda
|
|
105
105
|
# end
|
106
106
|
# end
|
107
107
|
#
|
108
|
-
# #
|
108
|
+
# # Minitest (Shoulda)
|
109
109
|
# class GameTest < ActiveSupport::TestCase
|
110
110
|
# should validate_exclusion_of(:weapon).
|
111
111
|
# in_array(['pistol', 'paintball gun', 'stick']).
|
@@ -24,7 +24,7 @@ module Shoulda
|
|
24
24
|
# end
|
25
25
|
# end
|
26
26
|
#
|
27
|
-
# #
|
27
|
+
# # Minitest (Shoulda)
|
28
28
|
# class IssueTest < ActiveSupport::TestCase
|
29
29
|
# should validate_inclusion_of(:state).
|
30
30
|
# in_array(%w(open resolved unresolved))
|
@@ -44,7 +44,7 @@ module Shoulda
|
|
44
44
|
# it { should validate_inclusion_of(:state).in_range(1..5) }
|
45
45
|
# end
|
46
46
|
#
|
47
|
-
# #
|
47
|
+
# # Minitest (Shoulda)
|
48
48
|
# class IssueTest < ActiveSupport::TestCase
|
49
49
|
# should validate_inclusion_of(:state).in_range(1..5)
|
50
50
|
# end
|
@@ -87,7 +87,7 @@ module Shoulda
|
|
87
87
|
# end
|
88
88
|
# end
|
89
89
|
#
|
90
|
-
# #
|
90
|
+
# # Minitest (Shoulda)
|
91
91
|
# class IssueTest < ActiveSupport::TestCase
|
92
92
|
# should validate_inclusion_of(:severity).
|
93
93
|
# in_array(%w(low medium high)).
|
@@ -116,7 +116,7 @@ module Shoulda
|
|
116
116
|
# end
|
117
117
|
# end
|
118
118
|
#
|
119
|
-
# #
|
119
|
+
# # Minitest (Shoulda)
|
120
120
|
# class IssueTest < ActiveSupport::TestCase
|
121
121
|
# should validate_inclusion_of(:severity).
|
122
122
|
# in_array(%w(low medium high)).
|
@@ -152,7 +152,7 @@ module Shoulda
|
|
152
152
|
# end
|
153
153
|
# end
|
154
154
|
#
|
155
|
-
# #
|
155
|
+
# # Minitest (Shoulda)
|
156
156
|
# class PersonTest < ActiveSupport::TestCase
|
157
157
|
# should validate_inclusion_of(:age).
|
158
158
|
# in_range(0..65).
|
@@ -188,7 +188,7 @@ module Shoulda
|
|
188
188
|
# end
|
189
189
|
# end
|
190
190
|
#
|
191
|
-
# #
|
191
|
+
# # Minitest (Shoulda)
|
192
192
|
# class PersonTest < ActiveSupport::TestCase
|
193
193
|
# should validate_inclusion_of(:age).
|
194
194
|
# in_range(0..21).
|
@@ -218,7 +218,7 @@ module Shoulda
|
|
218
218
|
# end
|
219
219
|
# end
|
220
220
|
#
|
221
|
-
# #
|
221
|
+
# # Minitest (Shoulda)
|
222
222
|
# class IssueTest < ActiveSupport::TestCase
|
223
223
|
# should validate_inclusion_of(:state).
|
224
224
|
# in_array(%w(open resolved unresolved)).
|
@@ -248,7 +248,7 @@ module Shoulda
|
|
248
248
|
# end
|
249
249
|
# end
|
250
250
|
#
|
251
|
-
# #
|
251
|
+
# # Minitest (Shoulda)
|
252
252
|
# class IssueTest < ActiveSupport::TestCase
|
253
253
|
# should validate_inclusion_of(:state).
|
254
254
|
# in_array(%w(open resolved unresolved)).
|
@@ -25,7 +25,7 @@ module Shoulda
|
|
25
25
|
# end
|
26
26
|
# end
|
27
27
|
#
|
28
|
-
# #
|
28
|
+
# # Minitest (Shoulda)
|
29
29
|
# class UserTest < ActiveSupport::TestCase
|
30
30
|
# should validate_length_of(:password).
|
31
31
|
# is_at_least(10).
|
@@ -51,7 +51,7 @@ module Shoulda
|
|
51
51
|
# it { should validate_length_of(:bio).is_at_least(15) }
|
52
52
|
# end
|
53
53
|
#
|
54
|
-
# #
|
54
|
+
# # Minitest (Shoulda)
|
55
55
|
#
|
56
56
|
# class UserTest < ActiveSupport::TestCase
|
57
57
|
# should validate_length_of(:bio).is_at_least(15)
|
@@ -75,7 +75,7 @@ module Shoulda
|
|
75
75
|
# it { should validate_length_of(:status_update).is_at_most(140) }
|
76
76
|
# end
|
77
77
|
#
|
78
|
-
# #
|
78
|
+
# # Minitest (Shoulda)
|
79
79
|
# class UserTest < ActiveSupport::TestCase
|
80
80
|
# should validate_length_of(:status_update).is_at_most(140)
|
81
81
|
# end
|
@@ -98,7 +98,7 @@ module Shoulda
|
|
98
98
|
# it { should validate_length_of(:favorite_superhero).is_equal_to(6) }
|
99
99
|
# end
|
100
100
|
#
|
101
|
-
# #
|
101
|
+
# # Minitest (Shoulda)
|
102
102
|
# class UserTest < ActiveSupport::TestCase
|
103
103
|
# should validate_length_of(:favorite_superhero).is_equal_to(6)
|
104
104
|
# end
|
@@ -123,7 +123,7 @@ module Shoulda
|
|
123
123
|
# end
|
124
124
|
# end
|
125
125
|
#
|
126
|
-
# #
|
126
|
+
# # Minitest (Shoulda)
|
127
127
|
# class UserTest < ActiveSupport::TestCase
|
128
128
|
# should validate_length_of(:password).
|
129
129
|
# is_at_least(5).is_at_most(30)
|
@@ -151,7 +151,7 @@ module Shoulda
|
|
151
151
|
# end
|
152
152
|
# end
|
153
153
|
#
|
154
|
-
# #
|
154
|
+
# # Minitest (Shoulda)
|
155
155
|
# class UserTest < ActiveSupport::TestCase
|
156
156
|
# should validate_length_of(:password).
|
157
157
|
# is_at_least(10).
|
@@ -180,7 +180,7 @@ module Shoulda
|
|
180
180
|
# end
|
181
181
|
# end
|
182
182
|
#
|
183
|
-
# #
|
183
|
+
# # Minitest (Shoulda)
|
184
184
|
# class UserTest < ActiveSupport::TestCase
|
185
185
|
# should validate_length_of(:secret_key).
|
186
186
|
# is_at_least(15).
|
@@ -209,7 +209,7 @@ module Shoulda
|
|
209
209
|
# end
|
210
210
|
# end
|
211
211
|
#
|
212
|
-
# #
|
212
|
+
# # Minitest (Shoulda)
|
213
213
|
# class UserTest < ActiveSupport::TestCase
|
214
214
|
# should validate_length_of(:secret_key).
|
215
215
|
# is_at_most(100).
|