shoulda-matchers 4.3.0 → 5.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/{MIT-LICENSE → LICENSE} +1 -1
  3. data/README.md +170 -90
  4. data/lib/shoulda/matchers/action_controller/callback_matcher.rb +4 -89
  5. data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +3 -2
  6. data/lib/shoulda/matchers/action_controller/flash_store.rb +2 -4
  7. data/lib/shoulda/matchers/action_controller/permit_matcher.rb +29 -27
  8. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +6 -8
  9. data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +6 -8
  10. data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +16 -13
  11. data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +2 -1
  12. data/lib/shoulda/matchers/action_controller/route_matcher.rb +5 -6
  13. data/lib/shoulda/matchers/action_controller/route_params.rb +1 -1
  14. data/lib/shoulda/matchers/action_controller/set_session_or_flash_matcher.rb +19 -13
  15. data/lib/shoulda/matchers/active_model.rb +0 -1
  16. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +29 -27
  17. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb +1 -1
  18. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +5 -5
  19. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb +2 -2
  20. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb +1 -1
  21. data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb +1 -1
  22. data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +1 -1
  23. data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +51 -25
  24. data/lib/shoulda/matchers/active_model/helpers.rb +1 -1
  25. data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +32 -30
  26. data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +1 -1
  27. data/lib/shoulda/matchers/active_model/qualifiers/ignoring_interference_by_writer.rb +1 -1
  28. data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +10 -2
  29. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +2 -2
  30. data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +8 -7
  31. data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +28 -46
  32. data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +33 -9
  33. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +72 -27
  34. data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +4 -4
  35. data/lib/shoulda/matchers/active_model/validation_matcher.rb +31 -6
  36. data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +2 -4
  37. data/lib/shoulda/matchers/active_model/validation_message_finder.rb +2 -4
  38. data/lib/shoulda/matchers/active_model/validator.rb +4 -9
  39. data/lib/shoulda/matchers/active_record.rb +26 -24
  40. data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +6 -3
  41. data/lib/shoulda/matchers/active_record/association_matcher.rb +119 -50
  42. data/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb +5 -2
  43. data/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb +4 -4
  44. data/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb +1 -1
  45. data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +11 -6
  46. data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +14 -15
  47. data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +30 -8
  48. data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +23 -5
  49. data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +3 -3
  50. data/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb +1 -1
  51. data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +4 -4
  52. data/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb +3 -2
  53. data/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb +7 -5
  54. data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +18 -9
  55. data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +185 -0
  56. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +39 -17
  57. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +1 -1
  58. data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
  59. data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +12 -10
  60. data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +11 -7
  61. data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +30 -9
  62. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +13 -9
  63. data/lib/shoulda/matchers/active_record/uniqueness.rb +1 -1
  64. data/lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb +1 -3
  65. data/lib/shoulda/matchers/active_record/uniqueness/test_models.rb +0 -2
  66. data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +80 -73
  67. data/lib/shoulda/matchers/doublespeak.rb +2 -1
  68. data/lib/shoulda/matchers/doublespeak/double.rb +1 -1
  69. data/lib/shoulda/matchers/doublespeak/double_collection.rb +3 -3
  70. data/lib/shoulda/matchers/doublespeak/double_implementation_registry.rb +8 -5
  71. data/lib/shoulda/matchers/doublespeak/object_double.rb +1 -1
  72. data/lib/shoulda/matchers/doublespeak/stub_implementation.rb +1 -5
  73. data/lib/shoulda/matchers/doublespeak/world.rb +2 -2
  74. data/lib/shoulda/matchers/error.rb +1 -1
  75. data/lib/shoulda/matchers/independent.rb +0 -1
  76. data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +14 -13
  77. data/lib/shoulda/matchers/integrations/configuration.rb +1 -1
  78. data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
  79. data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -2
  80. data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
  81. data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
  82. data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
  83. data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
  84. data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
  85. data/lib/shoulda/matchers/rails_shim.rb +7 -40
  86. data/lib/shoulda/matchers/util.rb +16 -4
  87. data/lib/shoulda/matchers/util/word_wrap.rb +8 -8
  88. data/lib/shoulda/matchers/version.rb +1 -1
  89. data/lib/shoulda/matchers/warn.rb +3 -3
  90. data/shoulda-matchers.gemspec +12 -9
  91. metadata +15 -15
  92. data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +0 -159
  93. data/lib/shoulda/matchers/independent/delegate_method_matcher/stubbed_target.rb +0 -37
@@ -19,7 +19,10 @@ module Shoulda
19
19
  def matches?(subject)
20
20
  self.subject = ModelReflector.new(subject, name)
21
21
 
22
- if option_verifier.correct_for_string?(:counter_cache, counter_cache)
22
+ if option_verifier.correct_for_string?(
23
+ :counter_cache,
24
+ counter_cache,
25
+ )
23
26
  true
24
27
  else
25
28
  self.missing_option = "#{name} should have #{description}"
@@ -32,7 +35,7 @@ module Shoulda
32
35
  attr_accessor :subject, :counter_cache, :name
33
36
 
34
37
  def option_verifier
35
- @option_verifier ||= OptionVerifier.new(subject)
38
+ @_option_verifier ||= OptionVerifier.new(subject)
36
39
  end
37
40
  end
38
41
  end
@@ -34,7 +34,7 @@ module Shoulda
34
34
  private
35
35
 
36
36
  def option_verifier
37
- @option_verifier ||= OptionVerifier.new(subject)
37
+ @_option_verifier ||= OptionVerifier.new(subject)
38
38
  end
39
39
 
40
40
  def option_matches?
@@ -43,8 +43,8 @@ module Shoulda
43
43
 
44
44
  def option_type
45
45
  case dependent
46
- when true, false then :boolean
47
- else :string
46
+ when true, false then :boolean
47
+ else :string
48
48
  end
49
49
  end
50
50
 
@@ -52,7 +52,7 @@ module Shoulda
52
52
  [
53
53
  "#{name} should have",
54
54
  (dependent == true ? 'a' : dependent),
55
- 'dependency'
55
+ 'dependency',
56
56
  ].join(' ')
57
57
  end
58
58
  end
@@ -32,7 +32,7 @@ module Shoulda
32
32
  attr_accessor :subject, :inverse_of, :name
33
33
 
34
34
  def option_verifier
35
- @option_verifier ||= OptionVerifier.new(subject)
35
+ @_option_verifier ||= OptionVerifier.new(subject)
36
36
  end
37
37
  end
38
38
  end
@@ -18,7 +18,7 @@ module Shoulda
18
18
  @reflector = reflector
19
19
  end
20
20
 
21
- def matches?(subject)
21
+ def matches?(_subject)
22
22
  join_table_option_correct? &&
23
23
  join_table_exists? &&
24
24
  join_table_has_correct_columns?
@@ -26,10 +26,14 @@ module Shoulda
26
26
 
27
27
  def join_table_option_correct?
28
28
  if options.key?(:join_table_name)
29
- if option_verifier.correct_for_string?(:join_table, options[:join_table_name])
29
+ if option_verifier.correct_for_string?(
30
+ :join_table,
31
+ options[:join_table_name],
32
+ )
30
33
  true
31
34
  else
32
- @failure_message = "#{name} should use '#{options[:join_table_name]}' for :join_table option"
35
+ @failure_message = "#{name} should use"\
36
+ " #{options[:join_table_name].inspect} for :join_table option"
33
37
  false
34
38
  end
35
39
  else
@@ -38,7 +42,8 @@ module Shoulda
38
42
  end
39
43
 
40
44
  def join_table_exists?
41
- if RailsShim.tables_and_views(connection).include?(join_table_name)
45
+ if connection.data_sources.
46
+ include?(join_table_name.to_s)
42
47
  true
43
48
  else
44
49
  @failure_message = missing_table_message
@@ -64,8 +69,8 @@ module Shoulda
64
69
  delegate :foreign_key, :association_foreign_key, to: :reflector
65
70
 
66
71
  def missing_columns
67
- @missing_columns ||= expected_join_table_columns.select do |key|
68
- !actual_join_table_columns.include?(key.to_s)
72
+ @_missing_columns ||= expected_join_table_columns.reject do |key|
73
+ actual_join_table_columns.include?(key.to_s)
69
74
  end
70
75
  end
71
76
 
@@ -26,21 +26,16 @@ module Shoulda
26
26
 
27
27
  def join_table_name
28
28
  join_table_name =
29
- if has_and_belongs_to_many_name_table_name
30
- has_and_belongs_to_many_name_table_name
31
- else
32
- reflection.join_table
33
- end
34
-
29
+ has_and_belongs_to_many_name_table_name || reflection.join_table
35
30
  join_table_name.to_s
36
31
  end
37
32
 
38
- def association_relation
33
+ def association_relation(related_instance)
39
34
  relation = associated_class.all
40
35
 
41
36
  if reflection.scope
42
37
  # Source: AR::Associations::AssociationScope#eval_scope
43
- relation.instance_exec(subject, &reflection.scope)
38
+ relation.instance_exec(related_instance, &reflection.scope)
44
39
  else
45
40
  relation
46
41
  end
@@ -65,20 +60,24 @@ module Shoulda
65
60
  end
66
61
  end
67
62
 
63
+ def validate_inverse_of_through_association!
64
+ if through?
65
+ reflection.check_validity!
66
+ end
67
+ end
68
+
69
+ def has_and_belongs_to_many_name
70
+ reflection.options[:through]
71
+ end
72
+
68
73
  protected
69
74
 
70
75
  attr_reader :reflection, :subject
71
76
 
72
77
  private
73
78
 
74
- def has_and_belongs_to_many_name
75
- reflection.options[:through]
76
- end
77
-
78
79
  def has_and_belongs_to_many_name_table_name
79
- if has_and_belongs_to_many_reflection
80
- has_and_belongs_to_many_reflection.table_name
81
- end
80
+ has_and_belongs_to_many_reflection&.table_name
82
81
  end
83
82
 
84
83
  def has_and_belongs_to_many_reflection
@@ -4,17 +4,34 @@ module Shoulda
4
4
  module AssociationMatchers
5
5
  # @private
6
6
  class ModelReflector
7
- delegate :associated_class, :through?, :join_table_name,
8
- :association_relation, :polymorphic?, :foreign_key,
9
- :association_foreign_key, to: :reflection
7
+ delegate(
8
+ :associated_class,
9
+ :association_foreign_key,
10
+ :foreign_key,
11
+ :has_and_belongs_to_many_name,
12
+ :join_table_name,
13
+ :polymorphic?,
14
+ :validate_inverse_of_through_association!,
15
+ to: :reflection,
16
+ )
17
+
18
+ delegate(
19
+ :through?,
20
+ to: :reflection,
21
+ allow_nil: true,
22
+ )
10
23
 
11
24
  def initialize(subject, name)
12
25
  @subject = subject
13
26
  @name = name
14
27
  end
15
28
 
29
+ def association_relation
30
+ reflection.association_relation(subject)
31
+ end
32
+
16
33
  def reflection
17
- @reflection ||= reflect_on_association(name)
34
+ @_reflection ||= reflect_on_association(name)
18
35
  end
19
36
 
20
37
  def reflect_on_association(name)
@@ -31,9 +48,12 @@ module Shoulda
31
48
 
32
49
  def build_relation_with_clause(name, value)
33
50
  case name
34
- when :conditions then associated_class.where(value)
35
- when :order then associated_class.order(value)
36
- else raise ArgumentError, "Unknown clause '#{name}'"
51
+ when :conditions
52
+ associated_class.where(value)
53
+ when :order
54
+ associated_class.order(value)
55
+ else
56
+ raise ArgumentError, "Unknown clause '#{name}'"
37
57
  end
38
58
  end
39
59
 
@@ -42,7 +62,9 @@ module Shoulda
42
62
  when :conditions
43
63
  relation.where_values_hash
44
64
  when :order
45
- relation.order_values.map { |value| value_as_sql(value) }.join(', ')
65
+ relation.order_values.map do |value|
66
+ value_as_sql(value)
67
+ end.join(', ')
46
68
  else
47
69
  raise ArgumentError, "Unknown clause '#{name}'"
48
70
  end
@@ -6,7 +6,12 @@ module Shoulda
6
6
  class OptionVerifier
7
7
  delegate :reflection, to: :reflector
8
8
 
9
- RELATION_OPTIONS = [:conditions, :order]
9
+ DEFAULT_VALUE_OF_OPTIONS = {
10
+ has_many: {
11
+ validate: true,
12
+ },
13
+ }.freeze
14
+ RELATION_OPTIONS = [:conditions, :order].freeze
10
15
 
11
16
  def initialize(reflector)
12
17
  @reflector = reflector
@@ -40,7 +45,7 @@ module Shoulda
40
45
  else
41
46
  type_cast_expected_value = type_cast(
42
47
  type,
43
- expected_value_for(type, name, expected_value)
48
+ expected_value_for(type, name, expected_value),
44
49
  )
45
50
  actual_value = type_cast(type, actual_value_for(name))
46
51
  type_cast_expected_value == actual_value
@@ -55,7 +60,7 @@ module Shoulda
55
60
  if respond_to?(method_name, true)
56
61
  __send__(method_name)
57
62
  else
58
- reflection.options[name]
63
+ actual_value_for_option(name)
59
64
  end
60
65
  end
61
66
  end
@@ -94,7 +99,7 @@ module Shoulda
94
99
 
95
100
  def expected_value_for_constant(name)
96
101
  namespace = Shoulda::Matchers::Util.deconstantize(
97
- reflector.model_class.to_s
102
+ reflector.model_class.to_s,
98
103
  )
99
104
 
100
105
  ["#{namespace}::#{name}", name].each do |path|
@@ -107,12 +112,25 @@ module Shoulda
107
112
  end
108
113
 
109
114
  def actual_value_for_relation_clause(name)
110
- reflector.extract_relation_clause_from(reflector.association_relation, name)
115
+ reflector.extract_relation_clause_from(
116
+ reflector.association_relation,
117
+ name,
118
+ )
111
119
  end
112
120
 
113
121
  def actual_value_for_class_name
114
122
  reflector.associated_class
115
123
  end
124
+
125
+ def actual_value_for_option(name)
126
+ option_value = reflection.options[name]
127
+
128
+ if option_value.nil?
129
+ DEFAULT_VALUE_OF_OPTIONS.dig(reflection.macro, name)
130
+ else
131
+ option_value
132
+ end
133
+ end
116
134
  end
117
135
  end
118
136
  end
@@ -32,9 +32,9 @@ module Shoulda
32
32
  end
33
33
 
34
34
  missing_option << (
35
- 'fail validation if ' +
36
- ":#{attribute_name} is unset; i.e., either the association " +
37
- 'should have been defined with `optional: ' +
35
+ 'fail validation if '\
36
+ ":#{attribute_name} is unset; i.e., either the association "\
37
+ 'should have been defined with `optional: '\
38
38
  "#{optional.inspect}`, or there "
39
39
  )
40
40
 
@@ -32,7 +32,7 @@ module Shoulda
32
32
  attr_accessor :subject, :order, :name
33
33
 
34
34
  def option_verifier
35
- @option_verifier ||= OptionVerifier.new(subject)
35
+ @_option_verifier ||= OptionVerifier.new(subject)
36
36
  end
37
37
  end
38
38
  end
@@ -33,9 +33,9 @@ module Shoulda
33
33
  end
34
34
 
35
35
  missing_option << (
36
- 'fail validation if ' +
37
- ":#{attribute_name} is unset; i.e., either the association " +
38
- 'should have been defined with `required: ' +
36
+ 'fail validation if '\
37
+ ":#{attribute_name} is unset; i.e., either the association "\
38
+ 'should have been defined with `required: '\
39
39
  "#{required.inspect}`, or there "
40
40
  )
41
41
 
@@ -65,7 +65,7 @@ module Shoulda
65
65
  end
66
66
 
67
67
  def validation_message_key
68
- RailsShim.validation_message_key_for_association_required_option
68
+ :required
69
69
  end
70
70
  end
71
71
  end
@@ -22,7 +22,8 @@ module Shoulda
22
22
  if option_verifier.correct_for_string?(:source, source)
23
23
  true
24
24
  else
25
- self.missing_option = "#{name} should have #{source} as source option"
25
+ self.missing_option =
26
+ "#{name} should have #{source} as source option"
26
27
  false
27
28
  end
28
29
  end
@@ -32,7 +33,7 @@ module Shoulda
32
33
  attr_accessor :subject, :source, :name
33
34
 
34
35
  def option_verifier
35
- @option_verifier ||= OptionVerifier.new(subject)
36
+ @_option_verifier ||= OptionVerifier.new(subject)
36
37
  end
37
38
  end
38
39
  end
@@ -29,13 +29,14 @@ module Shoulda
29
29
  if through_reflection.present?
30
30
  true
31
31
  else
32
- self.missing_option = "#{name} does not have any relationship to #{through}"
32
+ self.missing_option =
33
+ "#{name} does not have any relationship to #{through}"
33
34
  false
34
35
  end
35
36
  end
36
37
 
37
38
  def through_reflection
38
- @through_reflection ||= subject.reflect_on_association(through)
39
+ @_through_reflection ||= subject.reflect_on_association(through)
39
40
  end
40
41
 
41
42
  def through_association_correct?
@@ -43,8 +44,9 @@ module Shoulda
43
44
  true
44
45
  else
45
46
  self.missing_option =
46
- "Expected #{name} to have #{name} through #{through}, " +
47
- "but got it through #{option_verifier.actual_value_for(:through)}"
47
+ "Expected #{name} to have #{name} through #{through}, "\
48
+ 'but got it through ' +
49
+ option_verifier.actual_value_for(:through).to_s
48
50
  false
49
51
  end
50
52
  end
@@ -54,7 +56,7 @@ module Shoulda
54
56
  attr_accessor :through, :name, :subject
55
57
 
56
58
  def option_verifier
57
- @option_verifier ||= OptionVerifier.new(subject)
59
+ @_option_verifier ||= OptionVerifier.new(subject)
58
60
  end
59
61
  end
60
62
  end
@@ -6,16 +6,22 @@ module Shoulda
6
6
  #
7
7
  # class Process < ActiveRecord::Base
8
8
  # enum status: [:running, :stopped, :suspended]
9
+ #
10
+ # alias_attribute :kind, :SomeLegacyField
11
+ #
12
+ # enum kind: [:foo, :bar]
9
13
  # end
10
14
  #
11
15
  # # RSpec
12
16
  # RSpec.describe Process, type: :model do
13
17
  # it { should define_enum_for(:status) }
18
+ # it { should define_enum_for(:kind) }
14
19
  # end
15
20
  #
16
21
  # # Minitest (Shoulda)
17
22
  # class ProcessTest < ActiveSupport::TestCase
18
23
  # should define_enum_for(:status)
24
+ # should define_enum_for(:kind)
19
25
  # end
20
26
  #
21
27
  # #### Qualifiers
@@ -237,7 +243,7 @@ module Shoulda
237
243
  "Expected #{model} to #{expectation}, but "
238
244
  end
239
245
 
240
- message << failure_message_continuation + '.'
246
+ message << "#{failure_message_continuation}."
241
247
 
242
248
  Shoulda::Matchers.word_wrap(message)
243
249
  end
@@ -252,7 +258,7 @@ module Shoulda
252
258
  attr_reader :attribute_name, :options, :record,
253
259
  :failure_message_continuation
254
260
 
255
- def expectation
261
+ def expectation # rubocop:disable Metrics/MethodLength
256
262
  if enum_defined?
257
263
  expectation = "#{simple_description} backed by "
258
264
  expectation << Shoulda::Matchers::Util.a_or_an(expected_column_type)
@@ -358,8 +364,8 @@ module Shoulda
358
364
  true
359
365
  else
360
366
  @failure_message_continuation =
361
- "However, #{attribute_name.inspect} is " +
362
- Shoulda::Matchers::Util.a_or_an(column.type) +
367
+ "However, #{attribute_name.inspect} is "\
368
+ "#{Shoulda::Matchers::Util.a_or_an(column.type)}"\
363
369
  ' column'
364
370
  false
365
371
  end
@@ -370,7 +376,10 @@ module Shoulda
370
376
  end
371
377
 
372
378
  def column
373
- model.columns_hash[attribute_name.to_s]
379
+ key = attribute_name.to_s
380
+ column_name = model.attribute_alias(key) || key
381
+
382
+ model.columns_hash[column_name]
374
383
  end
375
384
 
376
385
  def model
@@ -421,9 +430,9 @@ module Shoulda
421
430
  def expected_prefix
422
431
  if options.include?(:prefix)
423
432
  if options[:prefix] == true
424
- attribute_name#.to_sym
433
+ attribute_name
425
434
  else
426
- options[:prefix]#.to_sym
435
+ options[:prefix]
427
436
  end
428
437
  end
429
438
  end
@@ -431,9 +440,9 @@ module Shoulda
431
440
  def expected_suffix
432
441
  if options.include?(:suffix)
433
442
  if options[:suffix] == true
434
- attribute_name#.to_sym
443
+ attribute_name
435
444
  else
436
- options[:suffix]#.to_sym
445
+ options[:suffix]
437
446
  end
438
447
  end
439
448
  end