On Dec 20, 6:09 am, Alex Sergeyev <[email protected]> wrote:
> Hi,
>
> How to setup columns and values for Dataset mock?
> DB = Sequel.mock
> DB[:items].all => [{:id => 1, :name =>2}]
> DB[:foo].all => [{:id => 1, :foo =>25}]

Did you read the RDoc for the mock adapter (http://
sequel.rubyforge.org/rdoc-adapters/classes/Sequel/Mock.html)?  This is
a serious question, because if you did and you still don't understand
how to use it, the RDoc needs to be improved.  Here's an example:

  # When initializing the Database
  DB = Sequel.mock(:fetch=>[{:id => 1, :name =>2}])

or:

  # After initializing the Database
  DB.fetch = [{:id => 1, :name =>2}]

or:

  # Override per dataset
  ds = DB[:items]
  ds._fetch = [{:id => 1, :name =>2}]

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to