Created
February 7, 2014 13:28
-
-
Save senny/8862620 to your computer and use it in GitHub Desktop.
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 characters
require 'bundler' | |
Bundler.setup(:default) | |
require 'rails' | |
require 'action_controller/railtie' | |
class TestApp < Rails::Application | |
config.root = File.dirname(__FILE__) | |
config.session_store :cookie_store, key: 'cookie_store_key' | |
config.secret_token = 'secret_token' | |
config.secret_key_base = 'secret_key_base' | |
config.logger = Logger.new($stdout) | |
Rails.logger = config.logger | |
routes.draw do | |
get '/with_filter' => 'class#index' | |
get '/without_filter' => 'skipping_class#index' | |
end | |
end | |
class ConditionalClassFilter | |
def self.before(controller) controller.instance_variable_set(:"@ran_class_filter", true) end | |
end | |
class ClassController < ActionController::Base | |
before_filter ConditionalClassFilter | |
def index | |
render text: @ran_class_filter.to_s | |
end | |
end | |
class SkippingClassController < ClassController | |
skip_before_filter ConditionalClassFilter | |
end | |
require 'minitest/autorun' | |
require 'rack/test' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
class BugTest < Minitest::Test | |
include Rack::Test::Methods | |
def test_with_class_filter | |
get '/with_filter' | |
assert last_response.ok? | |
assert_equal "true", last_response.body | |
end | |
def test_without_class_filter | |
get '/without_filter' | |
assert last_response.ok? | |
assert_equal "", last_response.body | |
end | |
private | |
def app | |
Rails.application | |
end | |
end |
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 characters
#!/bin/bash | |
rm Gemfile.lock | |
bundle | |
ruby test.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git bisect start 4-0-stable master
git bisect run test.sh