Module: StripAttributes::Shoulda::Macros

Defined in:
lib/strip_attributes/shoulda/macros.rb

Instance Method Summary collapse

Instance Method Details

#should_not_strip_attributes(*attributes) ⇒ Object

Deprecated. Use ‘should_not strip_attribute :attribute` instead.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/strip_attributes/shoulda/macros.rb', line 21

def should_not_strip_attributes(*attributes)
  warn "[DEPRECATION] should_not_strip_attributes is deprecated. " <<
       "Use `should_not strip_attribute :attribute` instead."
  attributes.each do |attribute|
    attribute = attribute.to_sym
    should "not strip whitespace from #{attribute}" do
      subject.send("#{attribute}=", " string ")
      subject.valid?
      assert_equal " string ", subject.send(attribute)
    end
  end
end

#should_strip_attributes(*attributes) ⇒ Object

Deprecated. Use ‘should strip_attribute :attribute` instead.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/strip_attributes/shoulda/macros.rb', line 7

def should_strip_attributes(*attributes)
  warn "[DEPRECATION] should_strip_attributes is deprecated. " <<
       "Use `should strip_attribute :attribute` instead."
  attributes.each do |attribute|
    attribute = attribute.to_sym
    should "strip whitespace from #{attribute}" do
      subject.send("#{attribute}=", " string ")
      subject.valid?
      assert_equal "string", subject.send(attribute)
    end
  end
end