Last active
December 3, 2015 03:02
-
-
Save claudiob/37079cf529f80008d022 to your computer and use it in GitHub Desktop.
Revisions
-
claudiob renamed this gist
Dec 3, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
claudiob revised this gist
Dec 3, 2015 . 1 changed file with 41 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ begin require 'bundler/inline' rescue LoadError => e $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' raise e end gemfile(true) do source 'https://rubygems.org' gem 'rails' end require 'active_support' require 'minitest/autorun' # Ensure backward compatibility with Minitest 4 Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) ActiveSupport::TestCase.test_order = :random class CacheNotificationOrderTest < ActiveSupport::TestCase def setup @record_size = ActiveSupport::Cache.lookup_store(:memory_store).send(:cached_size, 1, ActiveSupport::Cache::Entry.new("aaaaaaaaaa")) @cache = ActiveSupport::Cache.lookup_store(:memory_store, :expires_in => 60, :size => @record_size * 10 + 1) end def test_that_works_on_rails42_and_fails_on_master @events = [ ] ActiveSupport::Notifications.subscribe(/^cache_(.*)\.active_support$/) do |*args| @events << ActiveSupport::Notifications::Event.new(*args) end @cache.fetch("radiohead") { "House Of Cards" } assert_equal @events[0].name, 'cache_read.active_support' assert_equal @events[1].name, 'cache_generate.active_support' assert_equal @events[2].name, 'cache_write.active_support' ensure ActiveSupport::Notifications.unsubscribe(/^cache_(.*)\.active_support$/) end end -
claudiob created this gist
Dec 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ begin require 'bundler/inline' rescue LoadError => e $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' raise e end gemfile(true) do source 'https://rubygems.org' gem 'rails', github: 'rails/rails' gem 'arel', github: 'rails/arel' gem 'rack', github: 'rack/rack' gem 'sprockets', github: 'rails/sprockets' gem 'sprockets-rails', github: 'rails/sprockets-rails' gem 'sass-rails', github: 'rails/sass-rails' end require 'active_support' require 'minitest/autorun' # Ensure backward compatibility with Minitest 4 Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) class CacheNotificationOrderTest < ActiveSupport::TestCase def setup @record_size = ActiveSupport::Cache.lookup_store(:memory_store).send(:cached_size, 1, ActiveSupport::Cache::Entry.new("aaaaaaaaaa")) @cache = ActiveSupport::Cache.lookup_store(:memory_store, :expires_in => 60, :size => @record_size * 10 + 1) end def test_that_works_on_rails42_and_fails_on_master @events = [ ] ActiveSupport::Notifications.subscribe(/^cache_(.*)\.active_support$/) do |*args| @events << ActiveSupport::Notifications::Event.new(*args) end @cache.fetch("radiohead") { "House Of Cards" } assert_equal @events[0].name, 'cache_read.active_support' assert_equal @events[1].name, 'cache_generate.active_support' assert_equal @events[2].name, 'cache_write.active_support' ensure ActiveSupport::Notifications.unsubscribe(/^cache_(.*)\.active_support$/) end end