uberspec 0.2.0 → 0.2.1
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.
- data/VERSION +1 -1
- data/lib/uberspec.rb +1 -6
- data/lib/uberspec/rspec.rb +9 -3
- data/spec/uberspec_spec.rb +36 -5
- data/uberspec.gemspec +2 -2
- data/uberspec.watchr +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/uberspec.rb
CHANGED
@@ -81,13 +81,8 @@ module Uberspec
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def system_with_notify(command)
|
84
|
-
#my_io = MyIO.new($stdout)
|
85
|
-
#$stdout = my_io
|
86
|
-
#system(command)
|
87
|
-
#$stdout = my_io.old_io
|
88
|
-
#results = my_io.captured
|
89
84
|
if notifier
|
90
|
-
results =
|
85
|
+
results = `#{command}`
|
91
86
|
notifier.notify(parse_results(results))
|
92
87
|
puts results
|
93
88
|
else
|
data/lib/uberspec/rspec.rb
CHANGED
@@ -4,7 +4,7 @@ module Uberspec
|
|
4
4
|
class Rspec < Uberspec::Base
|
5
5
|
|
6
6
|
def command
|
7
|
-
|
7
|
+
version == 2 ? 'rspec' : 'spec'
|
8
8
|
end
|
9
9
|
|
10
10
|
def all_test_files
|
@@ -15,9 +15,9 @@ module Uberspec
|
|
15
15
|
results = result_string.split("\n")
|
16
16
|
results = results.last(4).compact.delete_if {|i| i !~ /\S/i }
|
17
17
|
|
18
|
-
time = results
|
18
|
+
time = results.select {|r| r.match(/finished/i)}.first.match(/\d+\.\d+/)[0].to_f
|
19
19
|
|
20
|
-
stats = results
|
20
|
+
stats = results.select {|r| r.match(/examples/)}.first.split(', ').map(&:to_i)
|
21
21
|
examples = stats[0]
|
22
22
|
failed = stats[1]
|
23
23
|
pending = stats[2]
|
@@ -25,5 +25,11 @@ module Uberspec
|
|
25
25
|
{:time => time, :examples => examples, :failed => failed, :pending => pending}
|
26
26
|
end
|
27
27
|
|
28
|
+
private
|
29
|
+
|
30
|
+
def version
|
31
|
+
@version ||= Gem.loaded_specs['rspec'].version.to_s.to_i
|
32
|
+
end
|
33
|
+
|
28
34
|
end
|
29
35
|
end
|
data/spec/uberspec_spec.rb
CHANGED
@@ -62,7 +62,7 @@ describe Uberspec::Base do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
context "
|
65
|
+
context "watching" do
|
66
66
|
before(:each) do
|
67
67
|
@base = Uberspec::Base.watch(@watchr_script)
|
68
68
|
end
|
@@ -146,12 +146,43 @@ describe Uberspec::Base do
|
|
146
146
|
@base.run
|
147
147
|
end
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
context "without notifications" do
|
150
|
+
it "should run the tests and let the console do its own output" do
|
151
|
+
@base.should_receive(:system).with('echo test')
|
152
|
+
@base.system_with_notify('echo test')
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context "with notifications" do
|
157
|
+
before(:each) do
|
158
|
+
@notifier = mock(:notifier, :notify => true)
|
159
|
+
@base.stub(:notifier).and_return(@notifier)
|
160
|
+
@base.stub(:puts).and_return(@notifier)
|
161
|
+
@base.stub(:`).and_return('test')
|
162
|
+
@base.stub(:parse_results).and_return('you win')
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should execute the command" do
|
166
|
+
@base.should_receive(:`).with('echo test')
|
167
|
+
@base.system_with_notify('echo test')
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should parse the results" do
|
171
|
+
@base.should_receive(:parse_results).with('test')
|
172
|
+
@base.system_with_notify('echo test')
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should pass the results on to the notify" do
|
176
|
+
@notifier.should_receive(:notify).with('you win')
|
177
|
+
@base.system_with_notify('echo test')
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should put the results" do
|
181
|
+
@base.should_receive(:puts).with('test')
|
182
|
+
@base.system_with_notify('echo test')
|
183
|
+
end
|
152
184
|
end
|
153
185
|
|
154
|
-
it "should have the custom IO stuff better tested"
|
155
186
|
end
|
156
187
|
|
157
188
|
context "when parsing results" do
|
data/uberspec.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{uberspec}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alan Peabody"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-16}
|
13
13
|
s.description = %q{Continious Integration for Rspec using Watchr}
|
14
14
|
s.email = %q{gapeabody@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/uberspec.watchr
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'uberspec'
|
2
2
|
|
3
|
-
Uberspec::
|
3
|
+
Uberspec::Rspec.watch(self) do |config|
|
4
4
|
config.code_paths += ['^lib/(.*)\.rb']
|
5
5
|
config.spec_paths += ['^spec/(.*)\.']
|
6
|
-
config.notify =
|
6
|
+
config.notify = 'LibNotify' #'Growl' #false
|
7
7
|
end
|
8
8
|
|
9
9
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uberspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alan Peabody
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-16 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|