Skip to content

Commit 453cf2f

Browse files
committed
Merge pull request #20 from guard/fix_notifier_in_tests
prevent notifier from crashing in tests
2 parents 6e9bf69 + b703327 commit 453cf2f

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

Gemfile

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
source "https://rubygems.org"
22

3-
gemspec development_group: :test
3+
gemspec development_group: :gem_build_tools
4+
5+
group :gem_build_tools do
6+
gem "rake"
7+
end
48

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

22+
group :test do
23+
gem "rspec", "~> 3.1"
24+
end
25+
1826
platforms :rbx do
1927
gem "racc"
2028
gem "rubysl", "~> 2.0"

guard-cucumber.gemspec

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@ Gem::Specification.new do |s|
1717

1818
s.required_rubygems_version = ">= 1.3.6"
1919

20-
s.add_dependency "guard", ">= 2.0.0"
2120
s.add_dependency "guard-compat", "~> 1.0"
2221
s.add_dependency "cucumber", ">= 1.3.0"
2322
s.add_dependency "nenv", "~> 0.1"
2423

25-
# NOTE: this is the :test group since gemspec(development_group: :test) is used
26-
s.add_development_dependency "bundler", "~> 1.1"
27-
s.add_development_dependency "rake"
28-
s.add_development_dependency "rspec", "~> 3.1"
24+
s.add_development_dependency "bundler", "~> 1.6"
2925

3026
s.files = `git ls-files -z`.split("\x0").select do |f|
3127
/^lib\// =~ f

lib/guard/cucumber/notification_formatter.rb

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Conditionally require this because it's run outside Guard
2-
# TODO: MOVE THIS OUTSIDE THE FORMATTER!!!!
3-
require "guard/notifier"
2+
#
3+
if Object.const_defined?(:Guard)
4+
# TODO: MOVE THIS OUTSIDE THE FORMATTER!!!!
5+
# TODO: (call notify() in Guard::Cucumber, not here in formatter
6+
7+
# If notifier is defined it's likely Guard::Compat::Plugin's stub
8+
unless Guard.const_defined?(:Notifier)
9+
require "guard"
10+
require "guard/notifier"
11+
end
12+
end
413

514
require "cucumber"
615
require "guard/compat/plugin"

0 commit comments

Comments
 (0)