Skip to content

Instantly share code, notes, and snippets.

@tourdedave
Created March 2, 2013 22:23
Show Gist options
  • Save tourdedave/5073541 to your computer and use it in GitHub Desktop.
Save tourdedave/5073541 to your computer and use it in GitHub Desktop.
Trying to call RSpec through code and load a custom formatter
require 'rspec'
require 'nyan_cat_formatter'
group = describe 2 do
it "should be two" do
2.should == 3 # failing test
end
it "should be two" do
2.should == 2
end
end
RSpec.configuration.formatter = "NyanCatFormatter"
formatter = RSpec.configuration.formatters[0]
reporter = RSpec::Core::Reporter.new(formatter)
reporter.report group.examples.size do |example|
group.run(example)
end
puts formatter.scoreboard
puts formatter.nyan_trail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment