Hi Jeremy,

apologies for being vague.

My Sequel model has a method called 'valid' that looks like this:

def self.valid
  where { foo > 0 & (bar > 0 | fubar > 0) }
end

and I want to test that in a spec

by inserting dummy records into a dummy db so that I can a spec like
it 'does not return invalid rows' do
  expect(MyModel.valid.count).to eq(#the number of valid rows in the mock 
DB)
end

So if i do 

MyModel.dataset = Sequel.mock[:tablename]
MyModel.dataset._fetch = [{foo: 1, bar: 1, fubar: 123}, {foo: 0, bar: 0, 
fubar: 1}]

Then queries via MyModel always return that stubbed data which is not what 
I want.

I was hoping I could do something like

DB = Sequel.connect('mock://postgres')
DB[:tablename].all = [{foo: 1, bar: 1, fubar: 123}, {foo: 0, bar: 0, fubar: 
1}]

but DB[:tablename].all is not valid code. I also tried MyModel.insert([foo, 
bar, fubar], [1,2,1]) but when i run queries there is no data in the mock 
db.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to