This file contains 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 File.dirname(__FILE__) + '/../spec_helper' | |
require "rack/test" | |
require "webrat" | |
describe Rack::Bug do | |
include Rack::Test::Methods | |
include Webrat::Matchers | |
def app |
This file contains 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 "benchmark" | |
x = 10_000 | |
first_id = Sport.first.id | |
key = "Sport:#{first_id}" | |
Sport.set key, Sport.find(first_id) # prime cache | |
Benchmark.bm(20) do |b| | |
b.report "Sport.get" do |
This file contains 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
class DummyCache < HashWithIndifferentAccess | |
attr_accessor :servers | |
attr_accessor :logging | |
def get_multi(keys) | |
{} | |
end | |
def set(key, value, ttl = nil, raw = false) | |
end |
This file contains 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
@response = Rack::Response.new(body, status, headers) | |
if @response.redirect? && options["rack-bug.intercept_redirects"] | |
intercept_redirect | |
return @response.to_a | |
elsif modify? | |
inject_toolbar | |
return @response.to_a | |
else | |
return [status, headers, body] |
This file contains 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
# COMMUNITY CHALLENGE | |
# | |
# How would you test this Quiz#problem method? Only two rules: | |
# | |
# 1. No mocks or stubs allowed. I'm looking for a other alternatives. | |
# Mocks can get messy in complex scenarios, and this is intended to | |
# be a high level test which executes all code. I don't think mocking | |
# would be a very clean solution anyway, but if you want to try it | |
# and prove me wrong feel free. | |
# |
This file contains 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 'spec/expectations' | |
require 'rack/test' | |
require 'webrat' | |
Webrat.configure do |config| | |
config.mode = :rack | |
end | |
class MyAppTest | |
include Rack::Test::Methods |
This file contains 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
diff --git a/spec/public/choose_spec.rb b/spec/public/choose_spec.rb | |
index 5a07c17..5b4f954 100644 | |
--- a/spec/public/choose_spec.rb | |
+++ b/spec/public/choose_spec.rb | |
@@ -1,6 +1,38 @@ | |
-require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") | |
+# require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") | |
+webrat_path = File.expand_path(File.dirname(__FILE__) + "/../../lib/") | |
+$LOAD_PATH.unshift(webrat_path) unless $LOAD_PATH.include?(webrat_path) | |
+ |
This file contains 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
Running /Users/bhelmkamp/p/merb/merb-core/spec/public/test/mock_request_helper_spec.rb. | |
............................... | |
Finished in 0.180028 seconds | |
31 examples, 0 failures | |
./lib/merb-core/test/run_spec.rb:12:in `dump_failure': private method `puts' called for nil:NilClass (NoMethodError) | |
from /Library/Ruby/Gems/1.8/gems/rspec-1.2.6/lib/spec/runner/reporter.rb:121:in `dump_failures' | |
from /Library/Ruby/Gems/1.8/gems/rspec-1.2.6/lib/spec/runner/reporter.rb:121:in `each' | |
from /Library/Ruby/Gems/1.8/gems/rspec-1.2.6/lib/spec/runner/reporter.rb:121:in `dump_failures' |
This file contains 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
commit 512356f0d77abff847528b49eb2dd9798d55fb27 | |
Author: Bryan Helmkamp <bryan@brynary.com> | |
Date: Thu Jun 25 20:47:10 2009 -0400 | |
Updating for latest rack-test | |
diff --git a/lib/webrat/sinatra.rb b/lib/webrat/sinatra.rb | |
index 10cdb02..4238bf9 100644 | |
--- a/lib/webrat/sinatra.rb | |
+++ b/lib/webrat/sinatra.rb |
This file contains 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
class AdFrame < Rails::Rack::Metal | |
def self.call(env) | |
refresher = AdFrameApp.new | |
refresher.call(env) | |
end | |
end | |
class AdFrameApp | |
def call(env) | |
if env["REQUEST_URI"] =~ %r|^/ads/iframe/(.+)$| |