From b6b2f9d8975fc46557faf1278485a31759c62d7b Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 10 Jun 2011 11:33:27 -0400 Subject: [PATCH] support for faster filtered spec running in JHW 0.3.0 --- Gemfile | 1 + Guardfile | 2 +- guard-jasmine-headless-webkit.gemspec | 4 ++-- lib/guard/jasmine-headless-webkit.rb | 6 +++--- spec/lib/guard/jasmine-headless-webkit_spec.rb | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 9cdbbed..bcfffbb 100644 --- a/Gemfile +++ b/Gemfile @@ -8,3 +8,4 @@ gem 'mocha' gem 'rake', '0.8.7' gem 'growl' gem 'fakefs', :require => nil +gem 'jasmine-headless-webkit', :path => '../jasmine-headless-webkit' diff --git a/Guardfile b/Guardfile index 9ad38fa..79a55c1 100644 --- a/Guardfile +++ b/Guardfile @@ -1,7 +1,7 @@ # A sample Guardfile # More info at https://github.com/guard/guard#readme -guard 'rspec', :version => 2 do +guard 'rspec', :cli => '-c', :version => 2 do watch(%r{^spec/.+_spec\.rb}) watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } diff --git a/guard-jasmine-headless-webkit.gemspec b/guard-jasmine-headless-webkit.gemspec index a03fd30..9ca9421 100644 --- a/guard-jasmine-headless-webkit.gemspec +++ b/guard-jasmine-headless-webkit.gemspec @@ -19,6 +19,6 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency 'guard', '>= 0.2.2' - s.add_dependency 'jasmine-headless-webkit', '>= 0.2.2' + s.add_dependency 'guard', '>= 0.4.0' + s.add_dependency 'jasmine-headless-webkit', '>= 0.3.0' end diff --git a/lib/guard/jasmine-headless-webkit.rb b/lib/guard/jasmine-headless-webkit.rb index 704219c..add6379 100644 --- a/lib/guard/jasmine-headless-webkit.rb +++ b/lib/guard/jasmine-headless-webkit.rb @@ -30,11 +30,11 @@ module Guard @ran_jammit = false if run_before and run_jammit @ran_jammit = true - do_run_all = true if !paths.empty? - do_run_all = (JasmineHeadlessWebkitRunner.run(paths) == 0) + JasmineHeadlessWebkitRunner.run(paths) + else + run_all end - run_all if do_run_all end end diff --git a/spec/lib/guard/jasmine-headless-webkit_spec.rb b/spec/lib/guard/jasmine-headless-webkit_spec.rb index 4cc6198..a833643 100644 --- a/spec/lib/guard/jasmine-headless-webkit_spec.rb +++ b/spec/lib/guard/jasmine-headless-webkit_spec.rb @@ -36,10 +36,10 @@ describe Guard::JasmineHeadlessWebkit do end end - context 'succeed, run all' do + context 'succeed, but still do not run all' do it "should run all" do Guard::JasmineHeadlessWebkitRunner.expects(:run).returns(0) - guard.expects(:run_all).once + guard.expects(:run_all).never guard.run_on_change(%w{test.js}) end @@ -109,7 +109,7 @@ describe Guard::JasmineHeadlessWebkit do context 'only run once if run_on_change is successful' do before do guard.expects(:run_program).once.returns(true) - Guard::JasmineHeadlessWebkitRunner.expects(:run).twice.returns(0) + Guard::JasmineHeadlessWebkitRunner.expects(:run).once.returns(0) end let(:options) { { :jammit => true } }