Sha256: 42b5ca645460fadcb202f120812942ca31809b706734af876b3976dd8328898b

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

$TESTING=true
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
require 'rubygems'
require 'merb'
# require 'merb/test/rspec'

class FakeModel
  def self.columns
    [FakeColumn.new(:foo, :string), 
     FakeColumn.new(:foobad, :string),       
     FakeColumn.new(:bar, :integer), 
     FakeColumn.new(:barbad, :integer),      
     FakeColumn.new(:baz, :boolean),
     FakeColumn.new(:bazbad, :boolean),
     FakeColumn.new(:bat, :boolean),
     FakeColumn.new(:batbad, :boolean)
     ]     
  end
  
  def valid?
    false
  end
  
  def new_record?
    false
  end
  
  def errors
    FakeErrors.new(self)
  end
  
  def foo
    "foowee"
  end
  
  alias_method :foobad, :foo
  
  def bar
    7
  end
  alias_method :barbad, :bar
  
  def baz
    true
  end
  alias_method :bazbad, :baz
  
  def bat
    false
  end
  alias_method :batbad, :bat
  
  def nothing
    nil
  end
end

class FakeModel2 < FakeModel

  def foo
    "foowee2"
  end
  alias_method :foobad, :foo
  
  def new_record?
    true
  end
  
end

class FakeErrors
  
  def initialize(model)
    @model = model
  end
  
  def on(name)
    name.to_s.include?("bad")
  end
  
end

class FakeColumn
  attr_accessor :name, :type
  def initialize(name, type)
    @name, @type = name, type
  end
end


  

describe "FakeBufferConsumer", :shared => true do
  
  before :each do
    @obj = FakeModel.new
    def _buffer(buf = "") @buffer ||= "" end    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
merb_helpers-0.4.0 specs/spec_helper.rb