Skip to content

Instantly share code, notes, and snippets.

@r00k
Created April 16, 2013 17:27
Show Gist options
  • Save r00k/5397806 to your computer and use it in GitHub Desktop.
Save r00k/5397806 to your computer and use it in GitHub Desktop.
Error at /products
//<!--
function toggle(id) {
var pre = document.getElementById(\"pre-\" + id);
var post = document.getElementById(\"post-\" + id);
var context = document.getElementById(\"context-\" + id);
if (pre.style.display == 'block') {
pre.style.display = 'none';
post.style.display = 'none';
context.style.background = \"none\";
} else {
pre.style.display = 'block';
post.style.display = 'block';
context.style.background = \"#fffed9\";
}
}
function toggleBacktrace(){
var bt = document.getElementById(\"backtrace\");
var toggler = document.getElementById(\"expando\");
if (bt.className == 'condensed') {
bt.className = 'expanded';
toggler.innerHTML = \"(condense)\";
} else {
bt.className = 'condensed';
toggler.innerHTML = \"(expand)\";
}
}
//-->
* {margin: 0; padding: 0; border: 0; outline: 0;}
div.clear {clear: both;}
body {background: #EEEEEE; margin: 0; padding: 0;
font-family: 'Lucida Grande', 'Lucida Sans Unicode',
'Garuda';}
code {font-family: 'Lucida Console', monospace;
font-size: 12px;}
li {height: 18px;}
ul {list-style: none; margin: 0; padding: 0;}
ol:hover {cursor: pointer;}
ol li {white-space: pre;}
#explanation {font-size: 12px; color: #666666;
margin: 20px 0 0 100px;}
/* WRAP */
#wrap {width: 1000px; background: #FFFFFF; margin: 0 auto;
padding: 30px 50px 20px 50px;
border-left: 1px solid #DDDDDD;
border-right: 1px solid #DDDDDD;}
/* HEADER */
#header {margin: 0 auto 25px auto;}
#header img {float: left;}
#header #summary {float: left; margin: 12px 0 0 20px; width:660px;
font-family: 'Lucida Grande', 'Lucida Sans Unicode';}
h1 {margin: 0; font-size: 36px; color: #981919;}
h2 {margin: 0; font-size: 22px; color: #333333;}
#header ul {margin: 0; font-size: 12px; color: #666666;}
#header ul li strong{color: #444444;}
#header ul li {display: inline; padding: 0 10px;}
#header ul li.first {padding-left: 0;}
#header ul li.last {border: 0; padding-right: 0;}
/* BODY */
#backtrace,
#get,
#post,
#cookies,
#rack {width: 980px; margin: 0 auto 10px auto;}
p#nav {float: right; font-size: 14px;}
/* BACKTRACE */
a#expando {float: left; padding-left: 5px; color: #666666;
font-size: 14px; text-decoration: none; cursor: pointer;}
a#expando:hover {text-decoration: underline;}
h3 {float: left; width: 100px; margin-bottom: 10px;
color: #981919; font-size: 14px; font-weight: bold;}
#nav a {color: #666666; text-decoration: none; padding: 0 5px;}
#backtrace li.frame-info {background: #f7f7f7; padding-left: 10px;
font-size: 12px; color: #333333;}
#backtrace ul {list-style-position: outside; border: 1px solid #E9E9E9;
border-bottom: 0;}
#backtrace ol {width: 920px; margin-left: 50px;
font: 10px 'Lucida Console', monospace; color: #666666;}
#backtrace ol li {border: 0; border-left: 1px solid #E9E9E9;
padding: 2px 0;}
#backtrace ol code {font-size: 10px; color: #555555; padding-left: 5px;}
#backtrace-ul li {border-bottom: 1px solid #E9E9E9; height: auto;
padding: 3px 0;}
#backtrace-ul .code {padding: 6px 0 4px 0;}
#backtrace.condensed .system,
#backtrace.condensed .framework {display:none;}
/* REQUEST DATA */
p.no-data {padding-top: 2px; font-size: 12px; color: #666666;}
table.req {width: 980px; text-align: left; font-size: 12px;
color: #666666; padding: 0; border-spacing: 0;
border: 1px solid #EEEEEE; border-bottom: 0;
border-left: 0;
clear:both}
table.req tr th {padding: 2px 10px; font-weight: bold;
background: #F7F7F7; border-bottom: 1px solid #EEEEEE;
border-left: 1px solid #EEEEEE;}
table.req tr td {padding: 2px 20px 2px 10px;
border-bottom: 1px solid #EEEEEE;
border-left: 1px solid #EEEEEE;}
/* HIDE PRE/POST CODE AT START */
.pre-context,
.post-context {display: none;}
table td.code {width:750px}
table td.code div {width:750px;overflow:hidden}
ThreadError at /products
deadlock; recursive locking
file:
lock.rb
location: lock
line:
14
BACKTRACE
(expand)
JUMP TO:
GET
POST
COOKIES
ENV
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/lock.rb in
lock
def initialize(app, mutex = Mutex.new)
@app, @mutex = app, mutex
end
def call(env)
old, env[FLAG] = env[FLAG], false
@mutex.lock
response = @app.call(env)
body = BodyProxy.new(response[2]) { @mutex.unlock }
response[2] = body
response
ensure
@mutex.unlock unless body
env[FLAG] = old
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/lock.rb in
call
def initialize(app, mutex = Mutex.new)
@app, @mutex = app, mutex
end
def call(env)
old, env[FLAG] = env[FLAG], false
@mutex.lock
response = @app.call(env)
body = BodyProxy.new(response[2]) { @mutex.unlock }
response[2] = body
response
ensure
@mutex.unlock unless body
env[FLAG] = old
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb in
call
path = env['PATH_INFO'].chomp('/')
if match = @file_handler.match?(path)
env[\"PATH_INFO\"] = match
return @file_handler.call(env)
end
end
@app.call(env)
end
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/airbrake-3.0.9/lib/airbrake/user_informer.rb in
call
end
def replacement(with)
Airbrake.configuration.user_information.gsub(/\\{\\{\\s*error_id\\s*\\}\\}/, with.to_s)
end
def call(env)
status, headers, body = @app.call(env)
if env['airbrake.error_id'] && Airbrake.configuration.user_information
new_body = []
replace = replacement(env['airbrake.error_id'])
body.each do |chunk|
new_body << chunk.gsub(\"<!-- AIRBRAKE ERROR -->\", replace)
end
body.close if body.respond_to?(:close)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.12/lib/rails/engine.rb in
call
end
def endpoint
self.class.endpoint || routes
end
def call(env)
app.call(env.merge!(env_config))
end
def env_config
@env_config ||= {
'action_dispatch.routes' => routes
}
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.12/lib/rails/application.rb in
call
def helpers_paths #:nodoc:
config.helpers_paths
end
def call(env)
env[\"ORIGINAL_FULLPATH\"] = build_original_fullpath(env)
super(env)
end
protected
alias :build_middleware_stack :app
def reload_dependencies?
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/builder.rb in
call
def to_app
app = @map ? generate_map(@run, @map) : @run
fail \"missing run or map statement\" unless app
@use.reverse.inject(app) { |a,e| e[a] }
end
def call(env)
to_app.call(env)
end
private
def generate_map(default_app, mapping)
mapped = default_app ? {'/' => default_app} : {}
mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b) }
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/urlmap.rb in
block in call
rest = m[1]
next unless !rest || rest.empty? || rest[0] == ?/
env['SCRIPT_NAME'] = (script_name + location)
env['PATH_INFO'] = rest
return app.call(env)
end
[404, {\"Content-Type\" => \"text/plain\", \"X-Cascade\" => \"pass\"}, [\"Not Found: \#{path}\"]]
ensure
env['PATH_INFO'] = path
env['SCRIPT_NAME'] = script_name
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/urlmap.rb in
each
def call(env)
path = env[\"PATH_INFO\"]
script_name = env['SCRIPT_NAME']
hHost = env['HTTP_HOST']
sName = env['SERVER_NAME']
sPort = env['SERVER_PORT']
@mapping.each do |host, location, match, app|
unless hHost == host \\
|| sName == host \\
|| (!host && (hHost == sName || hHost == sName+':'+sPort))
next
end
next unless m = match.match(path.to_s)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/urlmap.rb in
call
def call(env)
path = env[\"PATH_INFO\"]
script_name = env['SCRIPT_NAME']
hHost = env['HTTP_HOST']
sName = env['SERVER_NAME']
sPort = env['SERVER_PORT']
@mapping.each do |host, location, match, app|
unless hHost == host \\
|| sName == host \\
|| (!host && (hHost == sName || hHost == sName+':'+sPort))
next
end
next unless m = match.match(path.to_s)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
forward
def pass(&block)
throw :pass, block
end
# Forward the request to the downstream app -- middleware only.
def forward
fail \"downstream app not set\" unless @app.respond_to? :call
status, headers, body = @app.call env
@response.status = status
@response.body = body
@response.headers.merge! headers
nil
end
private
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
route_missing
# No matching route was found or all routes passed. The default
# implementation is to forward the request downstream when running
# as middleware (@app is non-nil); when no downstream app is set, raise
# a NotFound exception. Subclasses can override this method to perform
# custom route miss logic.
def route_missing
if @app
forward
else
raise NotFound
end
end
# Attempt to serve static files from public directory. Throws :halt when
# a matching file is found, returns nil otherwise.
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
route!
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
return route!(base.superclass, pass_block)
end
route_eval(&pass_block) if pass_block
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval(&block)
throw :halt, instance_eval(&block)
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
route!
route_eval(&block)
end
end
end
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
return route!(base.superclass, pass_block)
end
route_eval(&pass_block) if pass_block
route_missing
end
# Run a route block and throw :halt with the result.
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
dispatch!
res
end
# Dispatch a request with error handling.
def dispatch!
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
rescue NotFound => boom
handle_not_found!(boom)
rescue ::Exception => boom
handle_exception!(boom)
ensure
filter! :after unless env['sinatra.static_file']
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
block in call!
@response = Response.new
@params = indifferent_params(@request.params)
template_cache.clear if settings.reload_templates
force_encoding(@request.route)
force_encoding(@params)
@response['Content-Type'] = nil
invoke { dispatch! }
invoke { error_block!(response.status) }
unless @response['Content-Type']
if Array === body and body.first.respond_to? :content_type
content_type body.first.content_type
else
content_type :html
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
block in invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when Array === res
if Fixnum === res.first
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
catch
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when Array === res
if Fixnum === res.first
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke
res = catch(:halt) { yield }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when Array === res
if Fixnum === res.first
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
call!
@response = Response.new
@params = indifferent_params(@request.params)
template_cache.clear if settings.reload_templates
force_encoding(@request.route)
force_encoding(@params)
@response['Content-Type'] = nil
invoke { dispatch! }
invoke { error_block!(response.status) }
unless @response['Content-Type']
if Array === body and body.first.respond_to? :content_type
content_type body.first.content_type
else
content_type :html
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/base.rb in
call
@app = app
@template_cache = Tilt::Cache.new
yield self if block_given?
end
# Rack call interface.
def call(env)
dup.call!(env)
end
attr_accessor :env, :request, :response, :params
def call!(env) # :nodoc:
@env = env
@request = Request.new(env)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/head.rb in
call
class Head
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
if env[\"REQUEST_METHOD\"] == \"HEAD\"
body.close if body.respond_to? :close
[status, headers, []]
else
[status, headers, body]
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-1.4.5/lib/rack/commonlogger.rb in
call
def initialize(app, logger=nil)
@app = app
@logger = logger
end
def call(env)
began_at = Time.now
status, header, body = @app.call(env)
header = Utils::HeaderHash.new(header)
body = BodyProxy.new(body) { log(env, status, header, began_at) }
[status, header, body]
end
private
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/sinatra-1.2.8/lib/sinatra/showexceptions.rb in
call
def initialize(app)
@app = app
@template = ERB.new(TEMPLATE)
end
def call(env)
@app.call(env)
rescue Exception => e
errors, env[\"rack.errors\"] = env[\"rack.errors\"], @@eats_errors
if respond_to?(:prefers_plain_text?) and prefers_plain_text?(env)
content_type = \"text/plain\"
body = [dump_exception(e)]
else
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-test-0.6.2/lib/rack/mock_session.rb in
request
def set_cookie(cookie, uri = nil)
cookie_jar.merge(cookie, uri)
end
def request(uri, env)
env[\"HTTP_COOKIE\"] ||= cookie_jar.for(uri)
@last_request = Rack::Request.new(env)
status, headers, body = @app.call(@last_request.env)
@last_response = MockResponse.new(status, headers, body, env[\"rack.errors\"].flush)
body.close if body.respond_to?(:close)
cookie_jar.merge(last_response.headers[\"Set-Cookie\"], uri)
@after_request.each { |hook| hook.call }
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-test-0.6.2/lib/rack/test.rb in
process_request
Rack::MockRequest.env_for(uri.to_s, env)
end
def process_request(uri, env)
uri = URI.parse(uri)
uri.host ||= @default_host
@rack_mock_session.request(uri, env)
if retry_with_digest_auth?(env)
auth_env = env.merge({
\"HTTP_AUTHORIZATION\" => digest_auth_header,
\"rack-test.digest_auth_retry\" => true
})
auth_env.delete('rack.request')
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rack-test-0.6.2/lib/rack/test.rb in
get
# the app's response in #last_response. Yield #last_response to a block
# if given.
#
# Example:
# get \"/\"
def get(uri, params = {}, env = {}, &block)
env = env_for(uri, env.merge(:method => \"GET\", :params => params))
process_request(uri, env, &block)
end
# Issue a POST request for the given URI. See #get
#
# Example:
# post \"/signup\", \"name\" => \"Bryan\"
def post(uri, params = {}, env = {}, &block)
/Users/ben/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/forwardable.rb in
get
# q.queue #=> [42]
# q.push 23 #=> NoMethodError
#
def def_instance_delegator(accessor, method, ali = method)
line_no = __LINE__; str = %{
def \#{ali}(*args, &block)
begin
\#{accessor}.__send__(:\#{method}, *args, &block)
rescue Exception
[email protected]_if{|s| %r\"\#{Regexp.quote(__FILE__)}\"o =~ s} unless Forwardable::debug
::Kernel::raise
end
end
}
# If it's not a class or module, it's an instance
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/capybara-1.1.2/lib/capybara/rack_test/browser.rb in
process
elsif not path.start_with?('/')
path = request_path.sub(%r(/[^/]*$), '/') + path
end
path = current_host + path
end
reset_cache!
send(method, path, attributes, env)
end
def current_url
last_request.url
rescue Rack::Test::Error
\"\"
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/capybara-1.1.2/lib/capybara/rack_test/browser.rb in
visit
def options
driver.options
end
def visit(path, attributes = {})
reset_host!
process(:get, path, attributes)
follow_redirects!
end
def submit(method, path, attributes)
path = request_path if not path or path.empty?
process(method, path, attributes)
follow_redirects!
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/capybara-1.1.2/lib/capybara/rack_test/driver.rb in
visit
end
def request
browser.last_request
end
def visit(path, attributes = {})
browser.visit(path, attributes)
end
def submit(method, path, attributes)
browser.submit(method, path, attributes)
end
def follow(method, path, attributes = {})
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/capybara-1.1.2/lib/capybara/session.rb in
visit
#
# Capybara.app_host = 'http://google.com'
# session.visit('/') # visits the google homepage
#
# @param [String] url The URL to navigate to
#
def visit(url)
driver.visit(url)
end
##
#
# Execute the given block for a particular scope on the page. Within will find the first
# element matching the given selector and execute the block scoped to that element:
#
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/capybara-1.1.2/lib/capybara/dsl.rb in
visit
def page
Capybara.current_session
end
Session::DSL_METHODS.each do |method|
class_eval <<-RUBY, __FILE__, __LINE__+1
def \#{method}(*args, &block)
page.\#{method}(*args, &block)
end
RUBY
end
end
extend(Capybara::DSL)
end
/Users/ben/code/learn/spec/requests/products_spec.rb in
block (3 levels) in <top (required)>
describe 'Products' do
context 'GET /products' do
it 'lists all active workshops' do
workshop_one = create(:workshop)
workshop_two = create(:workshop)
private_workshop = create(:private_workshop)
visit products_path
expect(page).to have_content(workshop_one.name)
expect(page).to have_content(workshop_two.name)
expect(page).not_to have_content(private_workshop.name)
click_link workshop_one.name
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example.rb in
instance_eval
start(reporter)
begin
unless pending
with_around_each_hooks do
begin
run_before_each
@example_group_instance.instance_eval(&@example_block)
rescue Pending::PendingDeclaredInExample => e
@pending_declared_in_example = e.message
rescue Exception => e
set_exception(e)
ensure
run_after_each
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example.rb in
block in run
start(reporter)
begin
unless pending
with_around_each_hooks do
begin
run_before_each
@example_group_instance.instance_eval(&@example_block)
rescue Pending::PendingDeclaredInExample => e
@pending_declared_in_example = e.message
rescue Exception => e
set_exception(e)
ensure
run_after_each
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example.rb in
call
# @param [Proc]
# Adds a `run` method to the extended Proc, allowing it to be invoked
# in an [around](../Hooks#around-instance_method) hook using either
# `run` or `call`.
def self.extended(proc)
# @api public
# Foo bar
def proc.run; call; end
end
# @api private
def with(metadata)
@metadata = metadata
self
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example.rb in
run
# @param [Proc]
# Adds a `run` method to the extended Proc, allowing it to be invoked
# in an [around](../Hooks#around-instance_method) hook using either
# `run` or `call`.
def self.extended(proc)
# @api public
# Foo bar
def proc.run; call; end
end
# @api private
def with(metadata)
@metadata = metadata
self
end
/Users/ben/code/learn/spec/support/fake_stripe.rb in
block (3 levels) in <top (required)>
end
RSpec.configure do |config|
config.include FakeStripeFailureStatus
config.around do |example|
ensure_fake_stripe_failure_status_is_reset do
example.run
end
end
end
/Users/ben/code/learn/spec/support/fake_stripe.rb in
ensure_fake_stripe_failure_status_is_reset
Stripe.api_base = url
end
module FakeStripeFailureStatus
def ensure_fake_stripe_failure_status_is_reset
fake_stripe_failure = FakeStripe.failure
begin
yield
ensure
FakeStripe.failure = fake_stripe_failure
end
end
end
RSpec.configure do |config|
/Users/ben/code/learn/spec/support/fake_stripe.rb in
block (2 levels) in <top (required)>
end
end
RSpec.configure do |config|
config.include FakeStripeFailureStatus
config.around do |example|
ensure_fake_stripe_failure_status_is_reset do
example.run
end
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/extensions/instance_eval_with_args.rb in
instance_exec
#
# based on Bounded Spec InstanceExec (Mauricio Fernandez)
# http://eigenclass.org/hiki/bounded+space+instance_exec
# - uses singleton_class instead of global InstanceExecHelper module
# - this keeps it scoped to classes/modules that include this module
# - only necessary for ruby 1.8.6
def instance_eval_with_args(*args, &block)
return instance_exec(*args, &block) if respond_to?(:instance_exec)
# If there are no args and the block doesn't expect any, there's no
# need to fake instance_exec with our hack below.
# Notes:
# * lambda { }.arity # => -1
# * lambda { || }.arity # => 0
# * lambda { |*a| }.arity # -1
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/extensions/instance_eval_with_args.rb in
instance_eval_with_args
#
# based on Bounded Spec InstanceExec (Mauricio Fernandez)
# http://eigenclass.org/hiki/bounded+space+instance_exec
# - uses singleton_class instead of global InstanceExecHelper module
# - this keeps it scoped to classes/modules that include this module
# - only necessary for ruby 1.8.6
def instance_eval_with_args(*args, &block)
return instance_exec(*args, &block) if respond_to?(:instance_exec)
# If there are no args and the block doesn't expect any, there's no
# need to fake instance_exec with our hack below.
# Notes:
# * lambda { }.arity # => -1
# * lambda { || }.arity # => 0
# * lambda { |*a| }.arity # -1
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example.rb in
instance_eval_with_args
# @private
def instance_eval_with_rescue(context = nil, &block)
@example_group_instance.instance_eval_with_rescue(context, &block)
end
# @private
def instance_eval_with_args(*args, &block)
@example_group_instance.instance_eval_with_args(*args, &block)
end
private
def with_around_each_hooks(&block)
if around_each_hooks.empty?
yield
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb in
block (2 levels) in run
@initial_procsy = initial_procsy
self
end
def run
inject(@initial_procsy) do |procsy, around_hook|
Example.procsy(procsy.metadata) do
@example.instance_eval_with_args(procsy, &around_hook)
end
end.call
end
end
class GroupHookCollection < Array
def for(group)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb in
call
def with(example, initial_procsy)
@example = example
@initial_procsy = initial_procsy
self
end
def run
inject(@initial_procsy) do |procsy, around_hook|
Example.procsy(procsy.metadata) do
@example.instance_eval_with_args(procsy, &around_hook)
end
end.call
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb in
run
def with(example, initial_procsy)
@example = example
@initial_procsy = initial_procsy
self
end
def run
inject(@initial_procsy) do |procsy, around_hook|
Example.procsy(procsy.metadata) do
@example.instance_eval_with_args(procsy, &around_hook)
end
end.call
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb in
run_hook
end
# @private
#
# Runs all of the blocks stored with the hook in the context of the
# example. If no example is provided, just calls the hook directly.
def run_hook(hook, scope, example_or_group=ExampleGroup.new, initial_procsy=nil)
find_hook(hook, scope, example_or_group, initial_procsy).run
end
# @private
def around_each_hooks_for(example, initial_procsy=nil)
AroundHookCollection.new(ancestors.map {|a| a.hooks[:around][:each]}.flatten).for(example, initial_procsy)
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
run_around_each_hooks
assign_before_all_ivars(superclass.before_all_ivars, example_group_instance)
run_hook(:before, :all, example_group_instance)
store_before_all_ivars(example_group_instance)
end
# @private
def self.run_around_each_hooks(example, initial_procsy)
run_hook(:around, :each, example, initial_procsy)
end
# @private
def self.run_before_each_hooks(example)
run_hook(:before, :each, example)
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example.rb in
with_around_each_hooks
private
def with_around_each_hooks(&block)
if around_each_hooks.empty?
yield
else
@example_group_class.run_around_each_hooks(self, Example.procsy(metadata, &block))
end
rescue Exception => e
set_exception(e, \"in an around(:each) hook\")
end
def start(reporter)
reporter.example_started(self)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example.rb in
run
@example_group_instance = example_group_instance
@example_group_instance.example = self
start(reporter)
begin
unless pending
with_around_each_hooks do
begin
run_before_each
@example_group_instance.instance_eval(&@example_block)
rescue Pending::PendingDeclaredInExample => e
@pending_declared_in_example = e.message
rescue Exception => e
set_exception(e)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
block in run_examples
# @private
def self.run_examples(reporter)
filtered_examples.ordered.map do |example|
next if RSpec.wants_to_quit
instance = new
set_ivars(instance, before_all_ivars)
succeeded = example.run(instance, reporter)
RSpec.wants_to_quit = true if fail_fast? && !succeeded
succeeded
end.all?
end
# @private
def self.fail_filtered_examples(exception, reporter)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
map
before_all_ivars.clear
reporter.example_group_finished(self)
end
end
# @private
def self.run_examples(reporter)
filtered_examples.ordered.map do |example|
next if RSpec.wants_to_quit
instance = new
set_ivars(instance, before_all_ivars)
succeeded = example.run(instance, reporter)
RSpec.wants_to_quit = true if fail_fast? && !succeeded
succeeded
end.all?
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
run_examples
before_all_ivars.clear
reporter.example_group_finished(self)
end
end
# @private
def self.run_examples(reporter)
filtered_examples.ordered.map do |example|
next if RSpec.wants_to_quit
instance = new
set_ivars(instance, before_all_ivars)
succeeded = example.run(instance, reporter)
RSpec.wants_to_quit = true if fail_fast? && !succeeded
succeeded
end.all?
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
run
RSpec.clear_remaining_example_groups if top_level?
return
end
reporter.example_group_started(self)
begin
run_before_all_hooks(new)
result_for_this_group = run_examples(reporter)
results_for_descendants = children.ordered.map {|child| child.run(reporter)}.all?
result_for_this_group && results_for_descendants
rescue Exception => ex
fail_filtered_examples(ex, reporter)
ensure
run_after_all_hooks(new)
before_all_ivars.clear
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
block in run
return
end
reporter.example_group_started(self)
begin
run_before_all_hooks(new)
result_for_this_group = run_examples(reporter)
results_for_descendants = children.ordered.map {|child| child.run(reporter)}.all?
result_for_this_group && results_for_descendants
rescue Exception => ex
fail_filtered_examples(ex, reporter)
ensure
run_after_all_hooks(new)
before_all_ivars.clear
reporter.example_group_finished(self)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
map
return
end
reporter.example_group_started(self)
begin
run_before_all_hooks(new)
result_for_this_group = run_examples(reporter)
results_for_descendants = children.ordered.map {|child| child.run(reporter)}.all?
result_for_this_group && results_for_descendants
rescue Exception => ex
fail_filtered_examples(ex, reporter)
ensure
run_after_all_hooks(new)
before_all_ivars.clear
reporter.example_group_finished(self)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb in
run
return
end
reporter.example_group_started(self)
begin
run_before_all_hooks(new)
result_for_this_group = run_examples(reporter)
results_for_descendants = children.ordered.map {|child| child.run(reporter)}.all?
result_for_this_group && results_for_descendants
rescue Exception => ex
fail_filtered_examples(ex, reporter)
ensure
run_after_all_hooks(new)
before_all_ivars.clear
reporter.example_group_finished(self)
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb in
block (2 levels) in run
@options.configure(@configuration)
@configuration.load_spec_files
@world.announce_filters
@configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
begin
@configuration.run_hook(:before, :suite)
@world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
ensure
@configuration.run_hook(:after, :suite)
end
end
end
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb in
map
@options.configure(@configuration)
@configuration.load_spec_files
@world.announce_filters
@configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
begin
@configuration.run_hook(:before, :suite)
@world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
ensure
@configuration.run_hook(:after, :suite)
end
end
end
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb in
block in run
@options.configure(@configuration)
@configuration.load_spec_files
@world.announce_filters
@configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
begin
@configuration.run_hook(:before, :suite)
@world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
ensure
@configuration.run_hook(:after, :suite)
end
end
end
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/reporter.rb in
report
# reporter.report(group.examples.size) do |r|
# example_groups.map {|g| g.run(r) }
# end
#
def report(expected_example_count, seed=nil)
start(expected_example_count)
begin
yield self
ensure
finish(seed)
end
end
def start(expected_example_count)
@start = Time.now
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb in
run
def run(err, out)
@configuration.error_stream = err
@configuration.output_stream ||= out
@options.configure(@configuration)
@configuration.load_spec_files
@world.announce_filters
@configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
begin
@configuration.run_hook(:before, :suite)
@world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
ensure
@configuration.run_hook(:after, :suite)
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb in
run
begin
DRbCommandLine.new(options).run(err, out)
rescue DRb::DRbConnError
err.puts \"No DRb server is running. Running in local process instead ...\"
CommandLine.new(options).run(err, out)
end
else
CommandLine.new(options).run(err, out)
end
ensure
RSpec.reset
end
end
end
end
/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb in
block in autorun
module RSpec
module Core
class Runner
# Register an at_exit hook that runs the suite.
def self.autorun
return if autorun_disabled? || installed_at_exit? || running_in_drb?
at_exit { exit run(ARGV, $stderr, $stdout).to_i unless $! }
@installed_at_exit = true
end
AT_EXIT_HOOK_BACKTRACE_LINE = \"\#{__FILE__}:\#{__LINE__ - 2}:in `autorun'\"
def self.disable_autorun!
@autorun_disabled = true
end
GET
No GET data.
POST
No POST data.
COOKIES
No cookie data.
Rack ENV
Variable
Value
CONTENT_LENGTH
0
HTTPS
off
HTTP_COOKIE
HTTP_HOST
www.example.com
ORIGINAL_FULLPATH
/products
PATH_INFO
/products
QUERY_STRING
REMOTE_ADDR
127.0.0.1
REQUEST_METHOD
GET
SCRIPT_NAME
SERVER_NAME
www.example.com
SERVER_PORT
80
action_dispatch.backtrace_cleaner
#<Rails::BacktraceCleaner:0x007fe40bb31dd8 @filters=[#<Proc:0x007fe40bb31d10@/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.12/lib/rails/backtrace_cleaner.rb:10>, #<Proc:0x007fe40bb31ce8@/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.12/lib/rails/backtrace_cleaner.rb:11>, #<Proc:0x007fe40bb31cc0@/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.12/lib/rails/backtrace_cleaner.rb:12>, #<Proc:0x007fe40bb316a8@/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.12/lib/rails/backtrace_cleaner.rb:26>], @silencers=[#<Proc:0x007fe40bb31680@/Users/ben/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.12/lib/rails/backtrace_cleaner.rb:15>, #<Proc:0x007fe40bb31630@/Users/ben/code/learn/config/initializers/backtrace_silencers.rb:5>]>
action_dispatch.logger
#<ActiveSupport::TaggedLogging:0x007fe439339d50 @logger=#<ActiveSupport::BufferedLogger:0x007fe42df101d0 @log_dest=#<File:/Users/ben/code/learn/log/test.log>, @log=#<Logger:0x007fe42df101a8 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x007fe42df10158 @datetime_format=nil>, @formatter=#<Logger::SimpleFormatter:0x007fe439339d78 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x007fe42df10090 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:/Users/ben/code/learn/log/test.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007fe42df10018 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fe439339da0>>>>>>
action_dispatch.parameter_filter
[:password, :token, :password]
action_dispatch.routes
#<ActionDispatch::Routing::RouteSet:0x007fe42f841b40>
action_dispatch.secret_token
c82bd4f59b742528cc30ed0ec5e33e694a47a00563bdc5edae7dcab8aea1650d10c62d35eac87fecbfd9b834e283939266600f28c694c45dc10b60c025cd0e9e
action_dispatch.show_detailed_exceptions
true
action_dispatch.show_exceptions
false
rack.errors
#<Object:0x007fe42daf8b88>
rack.input
#<StringIO:0x007fe4300390a0>
rack.multiprocess
true
rack.multithread
true
rack.request.cookie_hash
{}
rack.request.cookie_string
rack.request.query_hash
{}
rack.request.query_string
rack.run_once
false
rack.test
true
rack.url_scheme
http
rack.version
[1, 1]
sinatra.error
#<ThreadError: deadlock; recursive locking>
You're seeing this error because you have
enabled the show_exceptions setting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment