Hello,
I am trying to use sequel with my spec tests and was trying to make
each example run within a transaction. I came up with the following
code:
# monkey patch Sequel transactions into rspec
module Spec
module Example
module ExampleGroupMethods
def execute_examples(success, instance_variables, examples)
return [success, instance_variables] unless success
after_all_instance_variables = instance_variables
examples.each do |example_group_instance|
Merb::Orms::Sequel.connect.transaction do
success &=
example_group_instance.execute(Spec::Runner.options,
instance_variables)
after_all_instance_variables =
example_group_instance.instance_variable_hash
raise Sequel::Error::Rollback #'Rolling Back after rspec
example'
end
end
return [success, after_all_instance_variables]
end
end
end
end
To confirm that this was working i wrote 2 examples, one to create an
object and one he next one to try and find it. IF transactions are
working the second find should fail, but it doesn't. Is there
something else I must do to ensure the rollback occurs?
Thanks,
Michael Fairchild
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---