~ubuntu-branches/ubuntu/raring/ruby-validatable/raring

« back to all changes in this revision

Viewing changes to test/unit/validates_presence_of_test.rb

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier
  • Date: 2012-05-19 17:34:34 UTC
  • Revision ID: package-import@ubuntu.com-20120519173434-o3pdvc5suz2jzbv4
Tags: upstream-1.6.7
Import upstream version 1.6.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
 
2
 
 
3
Expectations do
 
4
  
 
5
  expect false do
 
6
    validation = Validatable::ValidatesPresenceOf.new stub_everything, :name
 
7
    validation.valid?(stub_everything)
 
8
  end
 
9
  
 
10
  expect true do
 
11
    validation = Validatable::ValidatesPresenceOf.new stub_everything, :name
 
12
    validation.valid?(stub(:name=>"book"))
 
13
  end
 
14
  
 
15
  expect true do
 
16
    validation = Validatable::ValidatesPresenceOf.new stub_everything, :employee
 
17
    validation.valid?(stub(:employee => stub(:nil? => false)))
 
18
  end
 
19
  
 
20
  expect true do
 
21
    options = {:message => nil, :if => nil, :times => nil, :level => nil, :groups => nil}
 
22
    Validatable::ValidatesPresenceOf.new(stub_everything, :test).must_understand(options)
 
23
  end
 
24
  
 
25
end
 
 
b'\\ No newline at end of file'