Sha256: 35ae591057c10cb42302d6f90068c5b034b68cf380f232415bff24133e6b2314

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

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
  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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubyless-0.3.2 test/mock/dummy_class.rb
rubyless-0.3.1 test/mock/dummy_class.rb
rubyless-0.3.0 test/mock/dummy_class.rb