Sha256: deaf5cd3439d1f1401b994662865e0af81d8311903192b7486e274deb0bc37ec

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require File.dirname(__FILE__) + '/active_record_mock'

class Dummy < RubyLess::ActiveRecordMock
  attr_reader :name
  include RubyLess::SafeClass
  
  safe_method [:ancestor?, Dummy]  => RubyLess::Boolean
  safe_method :parent              => {:class => 'Dummy', :special_option => 'foobar'},
              :children            => ['Dummy'],
              :project             => 'Dummy',
              :spouse              => {:class => 'Dummy', :nil => true},
              :husband             => {:class => 'Dummy', :nil => true},
              :id                  => {:class => RubyLess::Number, :method => :zip},
              :name                => String
             
  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

1 entries across 1 versions & 1 rubygems

Version Path
rubyless-0.2.0 test/mock/dummy_class.rb