You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any Event of a given event_classification is intended to have one and only one entry with status = 1, and all other Events should have status = 2 to represent that they are old.
test_after_commit is in use, and spec_helper.rb sets config.use_transactional_fixtures = true.
That is: the spec does not arrive at the same result as the development console. This caused an issue with an application since the above test passes when it should fail.
I think this is a bug with test_after_commit since it claims to enable callbacks for testing but there is this discrepancy.
Version info:
Rails 4.0.4.
test_after_commit 0.2.3.
rspec and rspec-rails 2.14.1 (but also reproduced on later 0.0.x versions too).
The text was updated successfully, but these errors were encountered:
Consider an
Event
model created by the following migration:Any
Event
of a givenevent_classification
is intended to have one and only one entry withstatus = 1
, and all otherEvent
s should havestatus = 2
to represent that they are old.This is achieved with an
after_commit
callback:To verify the behaviour, open up a Rails console and run the following:
The outcome is that there are two
Event
s:This makes sense since
id=2
saves andid=1
to setstatus=2
, which thenid=2
to also havestatus=2
.However, the following test case passes:
test_after_commit
is in use, andspec_helper.rb
setsconfig.use_transactional_fixtures = true
.That is: the spec does not arrive at the same result as the development console. This caused an issue with an application since the above test passes when it should fail.
I think this is a bug with
test_after_commit
since it claims to enable callbacks for testing but there is this discrepancy.Version info:
test_after_commit
0.2.3.rspec
andrspec-rails
2.14.1 (but also reproduced on later0.0.x
versions too).The text was updated successfully, but these errors were encountered: