Skip to content

Commit

Permalink
Going on a mad refactoring tangent, adding a coverage-of feature to r…
Browse files Browse the repository at this point in the history
…eport the coverage of a specific source file
  • Loading branch information
mattwynne committed Jun 15, 2009
1 parent 4834d5f commit 3422d80
Show file tree
Hide file tree
Showing 12 changed files with 472 additions and 337 deletions.
2 changes: 1 addition & 1 deletion bin/cucover
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '../../lib/cucover')
load Cucumber::BINARY
Cucover::Cli.new(ARGV).start
4 changes: 4 additions & 0 deletions examples/self_test/simple/lib/foo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ class Foo
def execute
true
end

def sloppy_method
1/0
end
end
27 changes: 27 additions & 0 deletions features/coverage_of.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Feature: Coverage Of
In order to find out how well tested a source file that I'm working on is
As a developer
I want to be able to ask Cucover which features cover which lines of a given source file

Background:
Given the cache is clear
And I am using the simple example app
And I have run cucover -- features/call_foo.feature

Scenario: Run a feature that covers only some of the source code in a file
When I run cucover --coverage-of lib/foo.rb
Then it should pass with:
"""
1 features/call_foo.feature class Foo
2 features/call_foo.feature def execute
3 features/call_foo.feature true
4 features/call_foo.feature end
5
6 def sloppy_method
7 1/0
8 end
9 features/call_foo.feature end
"""


2 changes: 1 addition & 1 deletion features/step_definitions/main_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def within_examples_dir
end

Given /^I have run cucover (.*)$/ do |args|
When %{I run cucover "#{args}"}
When %{I run cucover #{args}}
end

Given /^the cache is clear$/ do
Expand Down
Loading

0 comments on commit 3422d80

Please sign in to comment.