guard-spinach 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e47377050f7c29c37895b5034af025436b0d4cc2
4
+ data.tar.gz: 67020bc6716d8c8db6b136796eeb1ec3cdff72d9
5
+ SHA512:
6
+ metadata.gz: c3e4c76361651e1f6ac718892a0d4edb189c0af552f5ea0c45b5649a6ce9b72bd9cf4d6d1dd222af719d2eb0bb5197334a93cc4cda6f1f9f0986831d4cbe671b
7
+ data.tar.gz: f388ca1c64de45546faec4b84f0fa3da937bd3ef3502abe111e76e26b358bc5879e4839414e53539f457be3065c9c2b69b917e60ba1ad65b8788d4e94076b8ad
data/Rakefile CHANGED
@@ -2,10 +2,13 @@
2
2
  require 'bundler'
3
3
  Bundler::GemHelper.install_tasks
4
4
 
5
- require 'rake/testtask'
6
- Rake::TestTask.new do |t|
7
- t.libs << "test"
8
- t.test_files = FileList['./test/**/*_test.rb']
9
- end
5
+ begin
6
+ require 'rspec/core/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
10
9
 
11
- task :default => :test
10
+ task :default => :spec
11
+ rescue LoadError
12
+ # no rspec available
13
+ # end
14
+ end
@@ -8,10 +8,10 @@ Gem::Specification.new do |gem|
8
8
  gem.summary = %q{guard-spinach is a guard plugin for spinach}
9
9
  gem.homepage = 'http://github.com/codegram/guard-spinach'
10
10
 
11
- gem.add_runtime_dependency 'guard', '>= 1.1'
11
+ gem.add_runtime_dependency 'guard', '~> 2.0'
12
12
  gem.add_runtime_dependency 'spinach'
13
- gem.add_development_dependency 'mocha'
14
- gem.add_development_dependency 'minitest'
13
+ gem.add_development_dependency 'rake'
14
+ gem.add_development_dependency 'rspec'
15
15
 
16
16
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  gem.files = `git ls-files`.split("\n")
@@ -1,8 +1,8 @@
1
1
  require 'guard'
2
- require 'guard/guard'
2
+ require 'guard/plugin'
3
3
 
4
4
  module Guard
5
- class Spinach < Guard
5
+ class Spinach < Plugin
6
6
  def start
7
7
  run_all if @options[:all_on_start]
8
8
  end
@@ -17,7 +17,11 @@ module Guard
17
17
  def run_command
18
18
  cmd = []
19
19
  cmd << @options[:command_prefix] if @options[:command_prefix]
20
- cmd << 'spinach'
20
+ if @options[:binstubs]
21
+ cmd << 'bin/spinach'
22
+ else
23
+ cmd << 'spinach'
24
+ end
21
25
  cmd << paths.join(" ")
22
26
  cmd << '-g' if @options[:generate]
23
27
  cmd << "-t #{@options[:tags].join(',')}" if @options[:tags] && @options[:tags].any?
@@ -1,3 +1,3 @@
1
1
  module Guard
2
- SPINACH_VERSION = "0.0.3"
2
+ SPINACH_VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,68 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ describe Guard::Spinach::Runner do
4
+ let(:runner) { Guard::Spinach::Runner.new(paths, options) }
5
+ let(:paths) { ['fake/path.feature', 'foo/bar.feature'] }
6
+ let(:options) { nil }
7
+
8
+ describe '#initialize' do
9
+ it 'sets up a bunch of file paths' do
10
+ expect(runner.paths).to include 'fake/path.feature'
11
+ expect(runner.paths).to include 'foo/bar.feature'
12
+ end
13
+ end
14
+
15
+ describe '#run_command' do
16
+ it 'generates a valid run command' do
17
+ expect(runner.run_command).to eq 'spinach fake/path.feature foo/bar.feature'
18
+ end
19
+
20
+ describe 'when :command_prefix option is given' do
21
+ let(:options) { { :command_prefix => 'zeus' } }
22
+
23
+ it 'generates a run command with prefix' do
24
+ expect(runner.run_command).to eq 'zeus spinach fake/path.feature foo/bar.feature'
25
+ end
26
+ end
27
+
28
+ describe 'when :generate option is given' do
29
+ let(:options) { { :generate => true } }
30
+
31
+ it 'generates a run command with -g flag' do
32
+ expect(runner.run_command).to eq 'spinach fake/path.feature foo/bar.feature -g'
33
+ end
34
+ end
35
+ end
36
+
37
+ describe '#run' do
38
+ it 'runs spinach on all the features in the list' do
39
+ expect(runner).to receive(:system).with('spinach fake/path.feature foo/bar.feature')
40
+
41
+ capture_output{ runner.run }
42
+ end
43
+
44
+ it 'outputs a message' do
45
+ expect(runner).to receive(:system)
46
+
47
+ output = capture_output{ runner.run }
48
+
49
+ expect(output).to include 'Running'
50
+ expect(output).to include paths[0]
51
+ expect(output).to include paths[1]
52
+ end
53
+
54
+ it 'notifies of success' do
55
+ allow(runner).to receive(:system).and_return(`(exit 0)`)
56
+ expect(Guard::Notifier).to receive(:notify).with('Passed', title: 'Spinach results', image: :success, priority: 2)
57
+
58
+ runner.run
59
+ end
60
+
61
+ it 'notifier of failures' do
62
+ allow(runner).to receive(:system).and_return(`(exit 1)`)
63
+ expect(Guard::Notifier).to receive(:notify).with('Failed', title: 'Spinach results', image: :failed, priority: 2)
64
+
65
+ runner.run
66
+ end
67
+ end
68
+ end
@@ -1,76 +1,87 @@
1
- require_relative '../test_helper'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe Guard::Spinach do
4
4
  subject do
5
- Guard::Spinach.new(data, options)
5
+ Guard::Spinach.new(options)
6
6
  end
7
+
7
8
  let(:paths) do
8
9
  ['fake/path.feature', 'foo/bar.feature']
9
10
  end
10
- let(:data) do
11
- []
12
- end
11
+
13
12
  let(:options) do
14
13
  {}
15
14
  end
15
+
16
16
  describe "#run_on_change" do
17
17
  it "fires run on a runner" do
18
- Guard::Spinach::Runner.any_instance.expects(:system).with(
19
- "spinach fake/path.feature foo/bar.feature")
18
+ expect_any_instance_of(Guard::Spinach::Runner).to receive(:system).with("spinach fake/path.feature foo/bar.feature")
19
+
20
20
  subject.run_on_change(['fake/path.feature', 'foo/bar.feature'])
21
21
  end
22
+
22
23
  describe "with generate enabled" do
23
24
  let(:options) do
24
25
  { :generate => true }
25
26
  end
27
+
26
28
  it "runs with step definition file generation enabled" do
27
- Guard::Spinach::Runner.any_instance.expects(:system).with(
28
- "spinach #{paths.join(' ')} -g")
29
+ expect_any_instance_of(Guard::Spinach::Runner).to receive(:system).with("spinach #{paths.join(' ')} -g")
30
+
29
31
  subject.run_on_change(paths)
30
32
  end
31
33
  end
32
34
  end
35
+
33
36
  describe "#run_all" do
34
37
  it "fires run on a runner" do
35
- Guard::Spinach::Runner.any_instance.expects(:system).with(
36
- "spinach ")
38
+ expect_any_instance_of(Guard::Spinach::Runner).to receive(:system).with("spinach ")
39
+
37
40
  subject.run_all
38
41
  end
42
+
39
43
  describe "with generate enabled" do
40
44
  let(:options) do
41
45
  { :generate => true }
42
46
  end
47
+
43
48
  it "runs with step definition file generation enabled" do
44
- Guard::Spinach::Runner.any_instance.expects(:system).with(
45
- "spinach -g")
49
+ expect_any_instance_of(Guard::Spinach::Runner).to receive(:system).with("spinach -g")
50
+
46
51
  subject.run_all
47
52
  end
48
53
  end
49
54
  end
55
+
50
56
  describe "#start" do
51
57
  describe "with defaults" do
52
58
  it "does not fire run on a runner" do
53
- Guard::Spinach::Runner.any_instance.expects(:system).never
59
+ expect_any_instance_of(Guard::Spinach::Runner).to receive(:system).never
60
+
54
61
  subject.start
55
62
  end
56
63
  end
64
+
57
65
  describe "with all_on_start => true" do
58
66
  let(:options) do
59
67
  { :all_on_start => true }
60
68
  end
69
+
61
70
  it "fires run on a runner" do
62
- Guard::Spinach::Runner.any_instance.expects(:system).with(
63
- "spinach ")
71
+ expect_any_instance_of(Guard::Spinach::Runner).to receive(:system).with("spinach ")
72
+
64
73
  subject.start
65
74
  end
66
75
  end
76
+
67
77
  describe "with generate and all_on_start" do
68
78
  let(:options) do
69
79
  { :generate => true, :all_on_start => true }
70
80
  end
81
+
71
82
  it "runs with step definition file generation enabled" do
72
- Guard::Spinach::Runner.any_instance.expects(:system).with(
73
- "spinach -g")
83
+ expect_any_instance_of(Guard::Spinach::Runner).to receive(:system).with("spinach -g")
84
+
74
85
  subject.start
75
86
  end
76
87
  end
@@ -0,0 +1,29 @@
1
+ require 'bundler/setup'
2
+ Bundler.require :default, :test
3
+
4
+ require 'rspec'
5
+ require_relative '../lib/guard/spinach'
6
+
7
+ RSpec.configure do |config|
8
+ config.expect_with :rspec do |expectations|
9
+ expectations.syntax = :expect
10
+ end
11
+
12
+ config.mock_with :rspec do |mocks|
13
+ mocks.syntax = :expect
14
+ mocks.verify_partial_doubles = true
15
+ end
16
+
17
+ config.order = :random
18
+ end
19
+
20
+ def capture_output
21
+ output = StringIO.new
22
+ $stdout = output
23
+ $stderr = output
24
+ yield
25
+ return output.string
26
+ ensure
27
+ $stdout = STDOUT
28
+ $stdout = STDERR
29
+ end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-spinach
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Josep Jaume
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-20 00:00:00.000000000 Z
11
+ date: 2015-04-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: guard
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '1.1'
19
+ version: '2.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '1.1'
26
+ version: '2.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: spinach
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: mocha
42
+ name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- name: minitest
56
+ name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: guard-spinach is a guard plugin for spinach
@@ -82,8 +73,8 @@ executables: []
82
73
  extensions: []
83
74
  extra_rdoc_files: []
84
75
  files:
85
- - .gitignore
86
- - .rvmrc
76
+ - ".gitignore"
77
+ - ".rvmrc"
87
78
  - Gemfile
88
79
  - Guardfile
89
80
  - README.md
@@ -93,35 +84,33 @@ files:
93
84
  - lib/guard/spinach/runner.rb
94
85
  - lib/guard/spinach/templates/Guardfile
95
86
  - lib/guard/spinach/version.rb
96
- - test/guard/spinach/runner_test.rb
97
- - test/guard/spinach_test.rb
98
- - test/test_helper.rb
87
+ - spec/guard/spinach/runner_spec.rb
88
+ - spec/guard/spinach_spec.rb
89
+ - spec/spec_helper.rb
99
90
  homepage: http://github.com/codegram/guard-spinach
100
91
  licenses: []
92
+ metadata: {}
101
93
  post_install_message:
102
94
  rdoc_options: []
103
95
  require_paths:
104
96
  - lib
105
97
  required_ruby_version: !ruby/object:Gem::Requirement
106
- none: false
107
98
  requirements:
108
- - - ! '>='
99
+ - - ">="
109
100
  - !ruby/object:Gem::Version
110
101
  version: '0'
111
102
  required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
103
  requirements:
114
- - - ! '>='
104
+ - - ">="
115
105
  - !ruby/object:Gem::Version
116
106
  version: '0'
117
107
  requirements: []
118
108
  rubyforge_project:
119
- rubygems_version: 1.8.23
109
+ rubygems_version: 2.4.5
120
110
  signing_key:
121
- specification_version: 3
111
+ specification_version: 4
122
112
  summary: guard-spinach is a guard plugin for spinach
123
113
  test_files:
124
- - test/guard/spinach/runner_test.rb
125
- - test/guard/spinach_test.rb
126
- - test/test_helper.rb
127
- has_rdoc:
114
+ - spec/guard/spinach/runner_spec.rb
115
+ - spec/guard/spinach_spec.rb
116
+ - spec/spec_helper.rb
@@ -1,61 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- describe Guard::Spinach::Runner do
4
- let(:runner) { Guard::Spinach::Runner.new(paths, options) }
5
- let(:paths) { ['fake/path.feature', 'foo/bar.feature'] }
6
- let(:options) { nil }
7
-
8
- describe '#initialize' do
9
- it 'sets up a bunch of file paths' do
10
- runner.paths.must_include 'fake/path.feature'
11
- runner.paths.must_include 'foo/bar.feature'
12
- end
13
- end
14
-
15
- describe '#run_command' do
16
- it 'generates a valid run command' do
17
- runner.run_command.must_equal 'spinach fake/path.feature foo/bar.feature'
18
- end
19
-
20
- describe 'when :command_prefix option is given' do
21
- let (:options) { { :command_prefix => 'zeus' } }
22
- it 'generates a run command with prefix' do
23
- runner.run_command.must_equal 'zeus spinach fake/path.feature foo/bar.feature'
24
- end
25
- end
26
-
27
- describe 'when :generate option is given' do
28
- let (:options) { { :generate => true } }
29
- it 'generates a run command with -g flag' do
30
- runner.run_command.must_equal 'spinach fake/path.feature foo/bar.feature -g'
31
- end
32
- end
33
- end
34
-
35
- describe '#run' do
36
- it 'runs spinach on all the features in the list' do
37
- runner.expects(:system).with('spinach fake/path.feature foo/bar.feature')
38
- capture_output{ runner.run }
39
- end
40
-
41
- it 'outputs a message' do
42
- runner.stubs(:system)
43
- output = capture_output{ runner.run }
44
- output.must_include 'Running'
45
- output.must_include paths[0]
46
- output.must_include paths[1]
47
- end
48
-
49
- it 'notifies of success' do
50
- runner.stubs(:system).returns(`(exit 0)`)
51
- Guard::Notifier.expects(:notify).with('Passed', title: 'Spinach results', image: :success, priority: 2)
52
- runner.run
53
- end
54
-
55
- it 'notifier of failures' do
56
- runner.stubs(:system).returns(`(exit 1)`)
57
- Guard::Notifier.expects(:notify).with('Failed', title: 'Spinach results', image: :failed, priority: 2)
58
- runner.run
59
- end
60
- end
61
- end
@@ -1,19 +0,0 @@
1
- require 'bundler/setup'
2
- Bundler.require :default, :test
3
-
4
- require 'minitest/spec'
5
- require 'minitest/autorun'
6
- require 'mocha/setup'
7
-
8
- require_relative '../lib/guard/spinach'
9
-
10
- def capture_output
11
- output = StringIO.new
12
- $stdout = output
13
- $stderr = output
14
- yield
15
- return output.string
16
- ensure
17
- $stdout = STDOUT
18
- $stdout = STDERR
19
- end