Skip to content

Commit

Permalink
Merge pull request netzpirat#20 from guard/fix_notifier_in_tests
Browse files Browse the repository at this point in the history
prevent notifier from crashing in tests
  • Loading branch information
e2 committed Jan 16, 2015
2 parents 6e9bf69 + b703327 commit 453cf2f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
10 changes: 9 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
source "https://rubygems.org"

gemspec development_group: :test
gemspec development_group: :gem_build_tools

group :gem_build_tools do
gem "rake"
end

# The development group will no be
# installed on Travis CI.
Expand All @@ -15,6 +19,10 @@ group :development do
gem "guard-compat", require: false
end

group :test do
gem "rspec", "~> 3.1"
end

platforms :rbx do
gem "racc"
gem "rubysl", "~> 2.0"
Expand Down
6 changes: 1 addition & 5 deletions guard-cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@ Gem::Specification.new do |s|

s.required_rubygems_version = ">= 1.3.6"

s.add_dependency "guard", ">= 2.0.0"
s.add_dependency "guard-compat", "~> 1.0"
s.add_dependency "cucumber", ">= 1.3.0"
s.add_dependency "nenv", "~> 0.1"

# NOTE: this is the :test group since gemspec(development_group: :test) is used
s.add_development_dependency "bundler", "~> 1.1"
s.add_development_dependency "rake"
s.add_development_dependency "rspec", "~> 3.1"
s.add_development_dependency "bundler", "~> 1.6"

s.files = `git ls-files -z`.split("\x0").select do |f|
/^lib\// =~ f
Expand Down
13 changes: 11 additions & 2 deletions lib/guard/cucumber/notification_formatter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Conditionally require this because it's run outside Guard
# TODO: MOVE THIS OUTSIDE THE FORMATTER!!!!
require "guard/notifier"
#
if Object.const_defined?(:Guard)
# TODO: MOVE THIS OUTSIDE THE FORMATTER!!!!
# TODO: (call notify() in Guard::Cucumber, not here in formatter

# If notifier is defined it's likely Guard::Compat::Plugin's stub
unless Guard.const_defined?(:Notifier)
require "guard"
require "guard/notifier"
end
end

require "cucumber"
require "guard/compat/plugin"
Expand Down

0 comments on commit 453cf2f

Please sign in to comment.