Skip to content

Commit

Permalink
Merge pull request #24 from oreoshake/gh-22-dup_tests_being_run
Browse files Browse the repository at this point in the history
Individual scenarios are no longer run if the entire feature scheduled. (Fixes #22)
  • Loading branch information
netzpirat committed Nov 9, 2011
2 parents 60d9797 + acfbead commit 21cb175
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/guard/cucumber/inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def clear_cucumber_files_list
#
def included_in_other_path?(path, paths)
paths = paths.select { |p| p != path }
paths.any? { |p| path.include?(p) && (path.gsub(p, '')).include?('/') }
massaged = path[0...(path.index(":")||path.size)]
paths.any? { |p| (path.include?(p) && (path.gsub(p, '')).include?('/')) || massaged.include?(p) }
end

end
end
end
Expand Down
16 changes: 16 additions & 0 deletions spec/guard/cucumber/inspector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
it 'removes duplicate paths' do
inspector.clean(['features', 'features']).should == ['features']
end

it 'removes individual feature tests if the path is already in paths to run' do
inspector.clean(['features/a.feature', 'features/a.feature:10']).should == ['features/a.feature']
end

it 'removes feature folders included in other feature folders' do
inspector.clean(['features/subfolder', 'features']).should == ['features']
Expand All @@ -34,4 +38,16 @@
inspector.clean(['features/subfolder/b.feature', 'features']).should == ['features']
end
end

describe ".included_in_other_path?" do
it "detects dups when a scenario is specified, but the feature is already included" do
paths = Dir.glob

# dup, add a specific test
dup_path = paths.last + ":22"
paths << dup_path

inspector.send(:included_in_other_path?, dup_path, paths).should be_true
end
end
end

0 comments on commit 21cb175

Please sign in to comment.