guard-unity 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +99 -0
- data/Rakefile +6 -0
- data/guard-unity-test.sublime-workspace +455 -0
- data/guard-unity.gemspec +29 -0
- data/lib/guard/unity.rb +45 -0
- data/lib/guard/unity/notifier.rb +24 -0
- data/lib/guard/unity/notifier/alert.rb +35 -0
- data/lib/guard/unity/notifier/cli.rb +79 -0
- data/lib/guard/unity/options.rb +26 -0
- data/lib/guard/unity/parser.rb +64 -0
- data/lib/guard/unity/runner.rb +45 -0
- data/lib/guard/unity/templates/Guardfile +3 -0
- data/lib/guard/unity/version.rb +5 -0
- data/spec/fixtures/UnitTestResults.xml +32 -0
- data/spec/guard/unity-test/notifier/alert_spec.rb +44 -0
- data/spec/guard/unity-test/notifier/cli_spec.rb +25 -0
- data/spec/guard/unity-test/notifier_spec.rb +25 -0
- data/spec/guard/unity-test/options_spec.rb +17 -0
- data/spec/guard/unity-test/parser_spec.rb +17 -0
- data/spec/guard/unity-test/runner_spec.rb +38 -0
- data/spec/guard/unity_test_spec.rb +110 -0
- data/spec/spec_helper.rb +24 -0
- metadata +192 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Unity::Notifier do
|
4
|
+
|
5
|
+
let (:results_success) { {test_cases: [{name: 'foo', failed: false, message: '', stack: ''}]} }
|
6
|
+
let (:results_failure) { {test_cases: [{name: 'foo', failed: true, message: 'bar', stack: 'foo-bar'}]} }
|
7
|
+
let (:subject) { Guard::Unity::Notifier::CLI.new( {formatador: double(:formatador) }) }
|
8
|
+
|
9
|
+
describe '#notify' do
|
10
|
+
|
11
|
+
it "should display success" do
|
12
|
+
subject.formatador.stub(:display_table)
|
13
|
+
subject.formatador.stub(:display_line)
|
14
|
+
subject.notify(results_success)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should display errors" do
|
18
|
+
subject.formatador.stub(:display_table)
|
19
|
+
subject.formatador.stub(:display_line)
|
20
|
+
subject.notify(results_failure)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Unity::Notifier do
|
4
|
+
|
5
|
+
let (:results) {
|
6
|
+
{
|
7
|
+
tests: 100,
|
8
|
+
errors: 0,
|
9
|
+
failures: 0
|
10
|
+
}
|
11
|
+
}
|
12
|
+
let (:alert) { double(:alert) }
|
13
|
+
let (:cli) { double(:alert) }
|
14
|
+
let (:subject) { Guard::Unity::Notifier.new({alert: alert, cli: cli})}
|
15
|
+
|
16
|
+
describe '#notify' do
|
17
|
+
|
18
|
+
it 'should give results to notification handlers' do
|
19
|
+
alert.stub(:notify).with(results, Guard::Unity::Notifier::TITLE)
|
20
|
+
cli.stub(:notify).with(results)
|
21
|
+
subject.notify(results)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Unity::Options do
|
4
|
+
|
5
|
+
describe '#with_defaults' do
|
6
|
+
it 'should have defaults if no overrides are provided' do
|
7
|
+
defaults = subject.with_defaults({})
|
8
|
+
defaults.should eq(Guard::Unity::Options::DEFAULTS)
|
9
|
+
end
|
10
|
+
it 'should override defaults with provided options' do
|
11
|
+
expected = Guard::Unity::Options::DEFAULTS.merge({test_on_start: true})
|
12
|
+
defaults = subject.with_defaults({test_on_start: true})
|
13
|
+
defaults.should eq(expected)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Unity::Parser do
|
4
|
+
|
5
|
+
let (:parser) { Guard::Unity::Parser.new( { results_path: Dir.pwd + '/spec/fixtures/UnitTestResults.xml' } ) }
|
6
|
+
|
7
|
+
describe '#parse' do
|
8
|
+
|
9
|
+
it "should bla" do
|
10
|
+
results = parser.parse
|
11
|
+
expected = { tests: 21, failures: 2, errors: 1, not_run: 2, inconclusive: 4, ignored: 1, skipped: 1, invalid: 0, test_cases: [{:name=>"test 1", :failed=>false, :message=>"", stack: ""}, {name: "test 2", failed: true, message: "Message", stack: 'foo'}, {name: "test 3", failed: true, message: "Message", stack: 'foo'}] }
|
12
|
+
results.should eq( expected )
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Unity::Runner do
|
4
|
+
|
5
|
+
let (:runner) { Guard::Unity::Runner.new({
|
6
|
+
test_on_start: false,
|
7
|
+
project_path: 'foo',
|
8
|
+
unity: '/Applications/Unity/Unity.app/Contents/MacOS/Unity',
|
9
|
+
parser: double(:parser),
|
10
|
+
notifier: double(:notifier)
|
11
|
+
})
|
12
|
+
}
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
|
16
|
+
it 'calls system commands' do
|
17
|
+
runner.should_receive(:`).once
|
18
|
+
::Guard::UI.should_receive(:info)
|
19
|
+
runner.parser.stub(:parse).with().and_return({})
|
20
|
+
runner.notifier.stub(:notify).with({})
|
21
|
+
runner.run
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#_command' do
|
27
|
+
|
28
|
+
it 'should create a proper system command with multiple groups' do
|
29
|
+
runner.should_receive(:_execute_command).with("/Applications/Unity/Unity.app/Contents/MacOS/Unity -projectPath foo -batchmode -executeMethod UnityTest.UnitTestView.RunAllTestsBatch")
|
30
|
+
::Guard::UI.should_receive(:info)
|
31
|
+
runner.parser.stub(:parse).with().and_return({})
|
32
|
+
runner.notifier.stub(:notify).with({})
|
33
|
+
runner.run
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Unity do
|
4
|
+
|
5
|
+
let (:runner) { Guard::Unity.Runner }
|
6
|
+
|
7
|
+
describe '#initialize' do
|
8
|
+
|
9
|
+
context 'when no options are provided' do
|
10
|
+
|
11
|
+
it 'has :test_on_start set to true' do
|
12
|
+
expect(subject.options[:test_on_start]).to be_true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has :project_path set' do
|
16
|
+
expect(subject.options[:project_path]).to eq(Dir.pwd)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'has :unity set' do
|
20
|
+
expect(subject.options[:unity]).to eq('/Applications/Unity/Unity.app/Contents/MacOS/Unity')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'has :results_path set' do
|
24
|
+
expect(subject.options[:results_path]).to eq(Dir.pwd + '/UnitTestResults.xml')
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when options are provided' do
|
30
|
+
|
31
|
+
subject do
|
32
|
+
Guard::Unity.new test_on_start: false, project_path: 'foo', unity: 'bar', results_path: 'foo-bar'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'has :test_on_start set to false' do
|
36
|
+
expect(subject.options[:test_on_start]).to be_false
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'has :project_path set' do
|
40
|
+
expect(subject.options[:project_path]).to eq('foo')
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'has :unity set' do
|
44
|
+
expect(subject.options[:unity]).to eq('bar')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'has :results_path set' do
|
48
|
+
expect(subject.options[:results_path]).to eq('foo-bar')
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#start' do
|
55
|
+
|
56
|
+
context 'with :run_on_start set to false' do
|
57
|
+
|
58
|
+
subject do
|
59
|
+
Guard::Unity.new test_on_start: false
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should\'t call #run' do
|
63
|
+
subject.should_not_receive :run
|
64
|
+
::Guard::UI.should_receive(:info)
|
65
|
+
subject.start
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with :run_on_start set to true' do
|
70
|
+
|
71
|
+
subject do
|
72
|
+
Guard::Unity.new test_on_start: true
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should call #run' do
|
76
|
+
subject.runner.should_receive :run
|
77
|
+
::Guard::UI.should_receive(:info)
|
78
|
+
subject.start
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#run_all' do
|
85
|
+
|
86
|
+
subject do
|
87
|
+
Guard::Unity.new
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should call #run_all' do
|
91
|
+
subject.runner.should_receive :run
|
92
|
+
subject.run_all
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#run_on_modification' do
|
98
|
+
|
99
|
+
subject do
|
100
|
+
Guard::Unity.new
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should call #run_all' do
|
104
|
+
subject.runner.should_receive :run
|
105
|
+
subject.run_on_modifications []
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'simplecov'
|
3
|
+
|
4
|
+
if ENV['TRAVIS']
|
5
|
+
require 'coveralls'
|
6
|
+
Coveralls.wear!
|
7
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
8
|
+
end
|
9
|
+
|
10
|
+
SimpleCov.start do
|
11
|
+
add_filter '/spec/'
|
12
|
+
add_filter '/.bundle'
|
13
|
+
add_group 'Unity', 'lib/guard'
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'guard/unity'
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
20
|
+
config.run_all_when_everything_filtered = true
|
21
|
+
config.order = :random
|
22
|
+
|
23
|
+
config.filter_run :focus
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-unity
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas Muntaner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: guard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: formatador
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.14'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.14'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-core
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.14'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.14'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-mocks
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.14'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.14'
|
125
|
+
description: Guard gem for Unity3D Test Tools
|
126
|
+
email:
|
127
|
+
- thomas.muntaner@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rspec"
|
134
|
+
- ".travis.yml"
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- guard-unity-test.sublime-workspace
|
140
|
+
- guard-unity.gemspec
|
141
|
+
- lib/guard/unity.rb
|
142
|
+
- lib/guard/unity/notifier.rb
|
143
|
+
- lib/guard/unity/notifier/alert.rb
|
144
|
+
- lib/guard/unity/notifier/cli.rb
|
145
|
+
- lib/guard/unity/options.rb
|
146
|
+
- lib/guard/unity/parser.rb
|
147
|
+
- lib/guard/unity/runner.rb
|
148
|
+
- lib/guard/unity/templates/Guardfile
|
149
|
+
- lib/guard/unity/version.rb
|
150
|
+
- spec/fixtures/UnitTestResults.xml
|
151
|
+
- spec/guard/unity-test/notifier/alert_spec.rb
|
152
|
+
- spec/guard/unity-test/notifier/cli_spec.rb
|
153
|
+
- spec/guard/unity-test/notifier_spec.rb
|
154
|
+
- spec/guard/unity-test/options_spec.rb
|
155
|
+
- spec/guard/unity-test/parser_spec.rb
|
156
|
+
- spec/guard/unity-test/runner_spec.rb
|
157
|
+
- spec/guard/unity_test_spec.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
homepage: https://github.com/rubyrainbows/guard-unity-test
|
160
|
+
licenses:
|
161
|
+
- MIT
|
162
|
+
metadata: {}
|
163
|
+
post_install_message:
|
164
|
+
rdoc_options: []
|
165
|
+
require_paths:
|
166
|
+
- lib
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
requirements: []
|
178
|
+
rubyforge_project:
|
179
|
+
rubygems_version: 2.2.0
|
180
|
+
signing_key:
|
181
|
+
specification_version: 4
|
182
|
+
summary: guard-unity automatically runs Unity Test Tools on file changes
|
183
|
+
test_files:
|
184
|
+
- spec/fixtures/UnitTestResults.xml
|
185
|
+
- spec/guard/unity-test/notifier/alert_spec.rb
|
186
|
+
- spec/guard/unity-test/notifier/cli_spec.rb
|
187
|
+
- spec/guard/unity-test/notifier_spec.rb
|
188
|
+
- spec/guard/unity-test/options_spec.rb
|
189
|
+
- spec/guard/unity-test/parser_spec.rb
|
190
|
+
- spec/guard/unity-test/runner_spec.rb
|
191
|
+
- spec/guard/unity_test_spec.rb
|
192
|
+
- spec/spec_helper.rb
|