Closed tovodeverett closed 8 years ago
+1 getting in test environment in RSpec
This is an issue with Rails really, that it doesn't run after_commit
callbacks in tests. See here for more info, it's already fixed in Rails 5. For your Rails 4 tests DHH posted a solution here. Basically, change this:
test "hello world" do
assert_equal "Hello, world!", hello_world
end
To this:
uses_transaction :test_hello_world
test "hello world" do
assert_equal "Hello, world!", hello_world
end
In my case I cleared all cache before assertion by Rails.cache.clear
Use new version 0.5.x
Is this supposedly fixed in 0.5.3, or is there a later version of 0.5.x I should be using? I'm seeing issues with my test suite when I update from 0.4.4 to 0.5.3. The problems go away when I revert to 0.4.4.
@tovodeverett Which Rails version?
Rails 4.2.5.1 currently. When the regression first cropped up between 0.4.4 and 0.4.5 back in September, I was using Rails 4.2.4.
I have a PR on this issue #86.
I believe I am seeing a regression in 0.4.5. The following code works as expected with 0.4.4, but does not work as expected with 0.4.5:
It appears that writes do not invalidate or update the cache, whereas in 0.4.4 they did.