class Mochening::Expect
Public Class Methods
from(db) { |expect| ... }
click to toggle source
# File lib/mochening.rb, line 5 def self.from(db) raise "Cannot expect anything from a nil database" if db.nil? raise "Expected a block" unless block_given? yield Mochening::Expect.new(db) end
new(db)
click to toggle source
# File lib/mochening.rb, line 11 def initialize(db) @db = db end
Public Instance Methods
[](table)
click to toggle source
# File lib/mochening.rb, line 15 def [](table) @db.expects(:[]).with(table) self end
all(return_value)
click to toggle source
# File lib/mochening.rb, line 35 def all(return_value) @db.expects(:all).returns(return_value) end
first(return_value)
click to toggle source
# File lib/mochening.rb, line 39 def first(return_value) @db.expects(:first).returns(return_value) end
insert(value)
click to toggle source
# File lib/mochening.rb, line 30 def insert(value) @db.expects(:insert).with(value) self end
select(*columns)
click to toggle source
# File lib/mochening.rb, line 25 def select(*columns) @db.expects(:select).with(*columns) self end
where(restriction)
click to toggle source
# File lib/mochening.rb, line 20 def where(restriction) @db.expects(:where).with(restriction) self end