spec/cucumber/formatters/profile_formatter_spec.rb in kosmas58-cucumber-0.1.16.6 vs spec/cucumber/formatters/profile_formatter_spec.rb in kosmas58-cucumber-0.1.99.21
- old
+ new
@@ -1,10 +1,11 @@
require File.dirname(__FILE__) + '/../../spec_helper'
+require 'cucumber/formatter/profile'
module Cucumber
- module Formatters
- describe ProfileFormatter do
+ module Formatter
+ describe Progress do
attr_reader :io, :formatter
def mock_proc(stubs={})
stub(Proc, {:to_comment_line => '# steps/example_steps.rb:11'}.merge(stubs))
end
@@ -21,24 +22,24 @@
before(:each) do
::Term::ANSIColor.coloring = false
@io = StringIO.new
step_mother = stub('step_mother')
- @formatter = ProfileFormatter.new(io, step_mother)
+ @formatter = ProfileFormatter.new(step_mother, io)
end
after(:each) do
::Term::ANSIColor.coloring = true
end
- it "should print a heading" do
+ xit "should print a heading" do
formatter.visit_features(nil)
io.string.should eql("Profiling enabled.\n")
end
- it "should record the current time when starting a new step" do
+ xit "should record the current time when starting a new step" do
now = Time.now
Time.stub!(:now).and_return(now)
formatter.step_executing('should foo', nil, nil)
formatter.instance_variable_get("@step_time").should == now
@@ -50,11 +51,11 @@
now = Time.now
formatter.instance_variable_set("@step_time", now)
Time.stub!(:now).and_return(now, now)
end
- it "should group by regular expressions and actual keyword" do
+ xit "should group by regular expressions and actual keyword" do
step_1 = mock_step(:actual_keyword => 'Given')
step_2 = mock_step(:actual_keyword => 'Given')
formatter.step_passed(step_1, /nihon/, nil)
formatter.step_passed(step_2, /ichiban/, nil)
@@ -63,11 +64,11 @@
step_times.has_key?('Given /nihon/').should be_true
step_times.has_key?('Given /ichiban/').should be_true
end
- it "should use a previous step's keyword when recording row steps" do
+ xit "should use a previous step's keyword when recording row steps" do
step = mock_step(:actual_keyword => 'Given')
step_row = mock_step(:row? => true)
formatter.step_passed(step, /nihon/, [])
formatter.step_passed(step_row, /nihon/, [])
@@ -77,27 +78,27 @@
step_times['Given /nihon/'].length.should == 2
end
end
- it "should correctly record a passed step" do
+ xit "should correctly record a passed step" do
formatter.step_executing(nil, nil, nil)
formatter.step_passed(mock_step(:format => 'she doth teach the torches to burn bright', :actual_keyword => 'Given'), nil, nil)
formatter.dump
io.string.should include('Given she doth teach the torches to burn bright')
end
- it "should correctly record a passed step row" do
+ xit "should correctly record a passed step row" do
formatter.step_executing(nil, nil, nil)
formatter.step_passed(mock_step(:row? => true), /example/, ['fitty'])
formatter.dump
io.string.should include('fitty')
end
- it "should calculate the mean step execution time" do
+ xit "should calculate the mean step execution time" do
now = Time.now
Time.stub!(:now).and_return(now, now+5, now, now+1)
2.times do
formatter.step_executing(mock_step, nil, nil)
@@ -107,32 +108,32 @@
formatter.dump
io.string.should include('3.0000000')
end
- it "should display file and line comment for step invocation" do
+ xit "should display file and line comment for step invocation" do
step = mock_step(:format => 'test', :actual_keyword => 'Given', :file => 'test.feature', :line => 5)
formatter.step_executing(step, nil, nil)
formatter.step_passed(step, nil, nil)
formatter.dump
@io.string.should include("# test.feature:5")
end
- it "should display file and line comment for step definition" do
+ xit "should display file and line comment for step definition" do
step = mock_step(:format => 'test', :actual_keyword => 'Given',
:regexp_args_proc => [/test/, nil, mock_proc(:to_comment_line => '# steps/example_steps.rb:11')])
formatter.step_executing(step, nil, nil)
formatter.step_passed(step, nil, nil)
formatter.dump
@io.string.should include("# steps/example_steps.rb:11")
end
- it "should show the performance times of the step invocations for a step definition" do
+ xit "should show the performance times of the step invocations for a step definition" do
now = Time.now
Time.stub!(:now).and_return(now, now+5, now, now+1)
step = mock_step(:format => 'step invocation', :actual_keyword => 'Given')
@@ -146,11 +147,11 @@
io.string.should include("3.0000000 Given /example/")
io.string.should include("5.0000000 Given step invocation")
io.string.should include("1.0000000 Given step invocation")
end
- it "should sort the step invocations in descending order" do
+ xit "should sort the step invocations in descending order" do
now = Time.now
Time.stub!(:now).and_return(now, now+1, now, now+5)
step = mock_step(:format => 'step invocation', :actual_keyword => 'Given')
@@ -164,11 +165,11 @@
io_string_lines.at(-2).should include('5.0000000')
io_string_lines.at(-1).should include('1.0000000')
end
- it "should print the top average 10 step results" do
+ xit "should print the top average 10 step results" do
formatter.instance_variable_set("@step_time", Time.now)
11.times do |test_number|
step_regexp = Regexp.new "unique_test_#{test_number}"
formatter.step_passed(mock_step(:format => 'test', :actual_keyword => 'Given',
@@ -178,10 +179,10 @@
formatter.dump
io.string.scan(/unique_test_\d+/).length.should == 10
end
- it "should print the top 5 step invocations for step definition" do
+ xit "should print the top 5 step invocations for step definition" do
formatter.instance_variable_set("@step_time", Time.now)
10.times do |test_number|
formatter.step_passed(mock_step(:format => 'please invocate me', :actual_keyword => 'Given'), nil, nil)
end