Module: StripAttributes::Matchers

Defined in:
lib/strip_attributes/matchers.rb

Defined Under Namespace

Classes: StripAttributeMatcher

Instance Method Summary collapse

Instance Method Details

#strip_attribute(*attributes) ⇒ Object Also known as: strip_attributes

Whitespace is stripped from the beginning and end of the attribute

RSpec Examples:

it { is_expected.to strip_attribute(:first_name) }
it { is_expected.to strip_attributes(:first_name, :last_name) }
it { is_expected.not_to strip_attribute(:password) }
it { is_expected.not_to strip_attributes(:password, :encrypted_password) }

Minitest Matchers Examples:

must { strip_attribute :first_name }
must { strip_attributes(:first_name, :last_name) }
wont { strip_attribute :password }
wont { strip_attributes(:password, :encrypted_password) }

19
20
21
# File 'lib/strip_attributes/matchers.rb', line 19

def strip_attribute(*attributes)
  StripAttributeMatcher.new(attributes)
end