konacha 2.4.0 → 2.5.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.
- data/History.md +4 -0
- data/konacha.gemspec +1 -1
- data/lib/konacha.rb +1 -1
- data/lib/konacha/engine.rb +1 -0
- data/lib/konacha/reporter.rb +16 -14
- data/lib/konacha/runner.rb +1 -0
- data/spec/konacha_spec.rb +6 -0
- data/spec/reporter_spec.rb +38 -17
- data/spec/runner_spec.rb +8 -0
- metadata +4 -4
data/History.md
CHANGED
data/konacha.gemspec
CHANGED
@@ -17,7 +17,7 @@ the asset pipeline and engines.}
|
|
17
17
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
gem.name = "konacha"
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
-
gem.version = "2.
|
20
|
+
gem.version = "2.5.0"
|
21
21
|
gem.license = "MIT"
|
22
22
|
|
23
23
|
gem.add_dependency "railties", ">= 3.1", "< 5"
|
data/lib/konacha.rb
CHANGED
@@ -29,7 +29,7 @@ module Konacha
|
|
29
29
|
yield config
|
30
30
|
end
|
31
31
|
|
32
|
-
delegate :port, :spec_dir, :spec_matcher, :application, :driver, :to => :config
|
32
|
+
delegate :port, :spec_dir, :spec_matcher, :application, :driver, :runner_port, :to => :config
|
33
33
|
|
34
34
|
def spec_root
|
35
35
|
File.join(Rails.root, config.spec_dir)
|
data/lib/konacha/engine.rb
CHANGED
data/lib/konacha/reporter.rb
CHANGED
@@ -16,11 +16,10 @@ module Konacha
|
|
16
16
|
'suite end' => :example_group_finished,
|
17
17
|
}
|
18
18
|
|
19
|
-
attr_reader :start_time, :duration, :
|
19
|
+
attr_reader :start_time, :duration, :examples
|
20
20
|
|
21
21
|
def initialize(*formatters)
|
22
22
|
@formatters = formatters
|
23
|
-
@example_count = @failure_count = @pending_count = 0
|
24
23
|
@duration = @start_time = nil
|
25
24
|
@examples, @groups = {}, {}
|
26
25
|
end
|
@@ -36,7 +35,7 @@ module Konacha
|
|
36
35
|
process_event :start_dump
|
37
36
|
process_event :dump_pending
|
38
37
|
process_event :dump_failures
|
39
|
-
process_event :dump_summary,
|
38
|
+
process_event :dump_summary, duration, example_count, failure_count, pending_count
|
40
39
|
process_event :seed, seed if seed
|
41
40
|
ensure
|
42
41
|
process_event :close
|
@@ -49,7 +48,7 @@ module Konacha
|
|
49
48
|
end
|
50
49
|
|
51
50
|
def passed?
|
52
|
-
|
51
|
+
failure_count == 0
|
53
52
|
end
|
54
53
|
|
55
54
|
def process_mocha_event(event)
|
@@ -63,23 +62,26 @@ module Konacha
|
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
65
|
+
def example_count
|
66
|
+
examples.count
|
67
|
+
end
|
68
|
+
|
69
|
+
def failure_count
|
70
|
+
examples.values.count { |example| example.failed? }
|
71
|
+
end
|
72
|
+
|
73
|
+
def pending_count
|
74
|
+
examples.values.count { |example| example.pending? }
|
75
|
+
end
|
75
76
|
|
77
|
+
def process_event(method, *args, &block)
|
76
78
|
@formatters.each do |formatter|
|
77
79
|
formatter.send method, *args, &block
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
81
83
|
def update_or_create_object(data, type)
|
82
|
-
collection = type == 'test' ?
|
84
|
+
collection = type == 'test' ? examples : @groups
|
83
85
|
object = collection[data['fullTitle']]
|
84
86
|
if object
|
85
87
|
object.update_metadata(data)
|
data/lib/konacha/runner.rb
CHANGED
data/spec/konacha_spec.rb
CHANGED
data/spec/reporter_spec.rb
CHANGED
@@ -73,23 +73,6 @@ describe Konacha::Reporter do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
describe "#process_event" do
|
76
|
-
describe "increments counts" do
|
77
|
-
it "increments example count" do
|
78
|
-
subject.process_event(:example_started)
|
79
|
-
subject.example_count.should == 1
|
80
|
-
end
|
81
|
-
|
82
|
-
it "increments pending count" do
|
83
|
-
subject.process_event(:example_pending)
|
84
|
-
subject.pending_count.should == 1
|
85
|
-
end
|
86
|
-
|
87
|
-
it "increments failed count" do
|
88
|
-
subject.process_event(:example_failed)
|
89
|
-
subject.failure_count.should == 1
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
76
|
it "forwards the call on to the formatters" do
|
94
77
|
formatter.should_receive(:example_started).with('arg!')
|
95
78
|
subject.process_event(:example_started, 'arg!')
|
@@ -120,4 +103,42 @@ describe Konacha::Reporter do
|
|
120
103
|
object.parent.should == suite
|
121
104
|
end
|
122
105
|
end
|
106
|
+
|
107
|
+
describe "#passed?" do
|
108
|
+
it 'passes if failure count is zero' do
|
109
|
+
subject.should be_passed
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'does not pass if failure count is not zero' do
|
113
|
+
subject.stub(:failure_count => 1)
|
114
|
+
subject.should_not be_passed
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "counters" do
|
119
|
+
describe "#example_count" do
|
120
|
+
it "is 0 by default" do
|
121
|
+
subject.example_count.should be_zero
|
122
|
+
end
|
123
|
+
|
124
|
+
it "returns examples count" do
|
125
|
+
subject.stub(:examples => {:omg => :two, :examples => :wow})
|
126
|
+
subject.example_count.should == 2
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "#pending_count" do
|
131
|
+
it "returns pending examples count" do
|
132
|
+
subject.stub(:examples => {:first => double(:pending? => true), :second => double(:pending? => false)})
|
133
|
+
subject.pending_count.should == 1
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe "#failure_count" do
|
138
|
+
it "returns failed examples count" do
|
139
|
+
subject.stub(:examples => {:first => double(:failed? => true), :second => double(:failed? => false)})
|
140
|
+
subject.failure_count.should == 1
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
123
144
|
end
|
data/spec/runner_spec.rb
CHANGED
@@ -31,6 +31,14 @@ describe Konacha::Runner do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
describe ".start" do
|
35
|
+
it 'sets the Capybara.server_port' do
|
36
|
+
Capybara.should_receive(:server_port=).with(Konacha.runner_port)
|
37
|
+
Konacha::Runner.any_instance.stub(:run)
|
38
|
+
Konacha::Runner.start
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
34
42
|
shared_examples_for "Konacha::Runner" do |driver|
|
35
43
|
before do
|
36
44
|
Konacha.configure do |config|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konacha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -328,7 +328,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
328
328
|
version: '0'
|
329
329
|
segments:
|
330
330
|
- 0
|
331
|
-
hash:
|
331
|
+
hash: 2309042468152930805
|
332
332
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
333
333
|
none: false
|
334
334
|
requirements:
|
@@ -337,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
337
337
|
version: '0'
|
338
338
|
segments:
|
339
339
|
- 0
|
340
|
-
hash:
|
340
|
+
hash: 2309042468152930805
|
341
341
|
requirements: []
|
342
342
|
rubyforge_project:
|
343
343
|
rubygems_version: 1.8.24
|