How do you stub methods on a dataset? #1841
jcavalieri
started this conversation in
General
Replies: 1 comment
-
Instead of trying to modify the frozen dataset, you create a modified copy of it using with_extend: ds = ds.with_extend{def on_duplicate_key_update(*args) self end} Alternatively, if you want this method to be available for all of a Database's datasets: DB.extend_datasets{def on_duplicate_key_update(*args) self end} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using JRuby 9.3.3.0, Sequel 5.53.0, and jdbc-sqlite3 3.28.0.
I'm using mysql for our database which has the method
on_duplicate_key_update
. This, however, is not available onjdbc-sqlite3
which is used with the unit tests. So I'm trying to stub the method with RSpec. Unfortunately I cannot because the Dataset object is frozen.I tried stubbing the constant
TRUE_FREEZE
to false. But that didn't work.How would you go about stubbing a method on a Dataset object?
Beta Was this translation helpful? Give feedback.
All reactions