Module: ElabsMatchers::Matchers::BeValidWith

Defined in:
lib/elabs_matchers/matchers/be_valid_with.rb

Defined Under Namespace

Classes: BeValidWithMatcher

Instance Method Summary collapse

Instance Method Details

#be_valid_with(*values) ⇒ Object

Asserts if a sample value is valid on a given attribute

Example: post.should be_valid_with(“Elabs”).as(:title) post.should_not be_valid_with(“”).as(:title)

post.should be_valid_with(“Elabs”).as(:title, :body) post.should_not be_valid_with(“”).as(:title, :body)

post.should be_valid_with(“Elabs”, “Sweden”).as(:title) post.should_not be_valid_with(“”, nil).as(:title)

post.should be_valid_with(“Elabs”, “Sweden”).as(:title, :body) post.should_not be_valid_with(“”, nil).as(:title, :body)

Parameters:

  • values (*Array)

    Sample value(s) to check the validation against



130
131
132
# File 'lib/elabs_matchers/matchers/be_valid_with.rb', line 130

def be_valid_with(*values)
  BeValidWithMatcher.new(values)
end