Skip to content

Instantly share code, notes, and snippets.

@wndxlori
Created September 17, 2013 16:39
Show Gist options
  • Save wndxlori/6596954 to your computer and use it in GitHub Desktop.
Save wndxlori/6596954 to your computer and use it in GitHub Desktop.
Weird RSpec model failure during my Rails 4 upgrade. Ideas?
def process!
self.transaction do
foo
bar
baz
boom
end
end
foo creates and populates part of obja (of class Content) and obja.save!
bar does obja.build_objb and objb.save!
baz updates more obja attributes and obja.save!
boom updates more obja attributes, and obja.save! fails on a validation error
And the failing spec...
it "does not create new Content" do
expect { request.process! }.to_not change(Content, :count)
end
wtf.
@wndxlori
Copy link
Author

Oh, and this is Postgres... could it be some kind of nested transaction problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment