Skip to content

Commit

Permalink
add :tests option
Browse files Browse the repository at this point in the history
  • Loading branch information
cpjolicoeur committed Jun 9, 2011
1 parent 5451918 commit 541f3f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/guard/annotate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def initialize( watchers=[], options={} )

options[:notify] = true if options[:notify].nil?
options[:position] = 'before' if options[:position].nil?
options[:tests] = false if options[:tests].nil?
options[:routes] = false if options[:routes].nil?
end

Expand Down Expand Up @@ -49,10 +50,14 @@ def annotate_routes?
options[:routes]
end

def annotate_tests_flags
options[:tests] ? "" : "--exclude tests,fixtures"
end

def run_annotate
UI.info 'Running annotate', :reset => true
started_at = Time.now
@result = system("annotate --exclude tests,fixtures -p #{annotation_position}")
@result = system("annotate #{annotate_tests_flags} -p #{annotation_position}")
Notifier::notify( @result, Time.now - started_at ) if notify?

if annotate_routes?
Expand Down
12 changes: 12 additions & 0 deletions spec/guard/annotate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
subject.start
end
end

describe "tests & fixtures" do
it "should not run tests annotations by default" do
subject.options[:tests].should be_false
end

it "should allo user to run tests and fixtures annotations if desired" do
subject = Guard::Annotate.new( [], :tests => true )
subject.should_receive(:system).with("annotate -p before")
subject.start
end
end
end
end

Expand Down

0 comments on commit 541f3f8

Please sign in to comment.