Skip to content

Instantly share code, notes, and snippets.

@elight
Created December 15, 2010 19:17
Show Gist options
  • Save elight/742442 to your computer and use it in GitHub Desktop.
Save elight/742442 to your computer and use it in GitHub Desktop.
Coulda sometimes generates a backtrace that ends in a shared step instead of tracing back to the calling test. Sadly, this gist has been unable to replicate that behavior.
require 'rubygems'
require 'coulda'
require 'raise_from_module'
Feature "Experimenting with Coulda" do
extend RaiseFromModule
def self.given_i_raise
Given "I raise an Exception" do
raise Exception, "testing from Coulda"
end
end
def self.scenario_as_macro
Scenario "Backtrace from scenario as a macro" do
Given "I raise an Exception" do
raise Exception, "testing from Coulda"
end
end
end
Scenario "Backtrace from scenario" do
Given "I raise an Exception" do
raise Exception, "testing from Coulda"
end
end
Scenario "Backtrace with given as macro" do
given_i_raise
end
scenario_as_macro
Scenario "Backtrace with given as macro extended from a module" do
given_i_raise_from_module
end
scenario_as_macro_extended_from_a_module
Scenario "Ohai"
end
class ExpTest < Test::Unit::TestCase
def test_nothing
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment