test/mock/dummy_class.rb in rubyless-0.3.2 vs test/mock/dummy_class.rb in rubyless-0.3.3
- old
+ new
@@ -1,40 +1,41 @@
require File.dirname(__FILE__) + '/active_record_mock'
class Dummy < RubyLess::ActiveRecordMock
attr_reader :name
include RubyLess::SafeClass
-
+
safe_method [:ancestor?, Dummy] => Boolean
safe_method :parent => {:class => 'Dummy', :special_option => 'foobar'},
:children => ['Dummy'],
:project => 'Dummy',
:id => {:class => Number, :method => :zip},
- :name => String
+ :name => String,
+ :foo => :bar
safe_method :defaults => {:nil => true},
:spouse => 'Dummy',
:husband => {:class => 'Dummy'}
-
+
safe_attribute :age, :friend_id, :log_at, :format
-
+
def initialize(name = 'dummy')
@name = name
end
-
+
# This method returns pseudo-nil and does not need to be declared with :nil => true
def project
Dummy.new('project')
end
-
+
# This method can return nil and must be declared with :nil => true
def spouse
nil
end
-
+
def husband
nil
end
-
+
def zip
10
end
end
\ No newline at end of file