konacha 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +4 -0
- data/app/controllers/konacha/specs_controller.rb +1 -0
- data/app/views/konacha/specs/parent.html.erb +1 -1
- data/konacha.gemspec +1 -1
- data/lib/konacha/runner.rb +4 -3
- data/spec/controllers/specs_controller_spec.rb +13 -0
- data/spec/runner_spec.rb +15 -1
- data/spec/views/specs/parent.html.erb_spec.rb +1 -0
- metadata +4 -4
data/History.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
<title>Konacha Tests</title>
|
6
6
|
<%= stylesheet_link_tag "konacha", :debug => false %>
|
7
7
|
<%= javascript_include_tag "mocha", "konacha/parent", :debug => false %>
|
8
|
-
<%= javascript_include_tag("konacha/runner", :debug => false) if
|
8
|
+
<%= javascript_include_tag("konacha/runner", :debug => false) if @run_mode.runner? %>
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<% @specs.each do |spec| %>
|
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.3.0"
|
21
21
|
gem.license = "MIT"
|
22
22
|
|
23
23
|
gem.add_dependency "railties", ">= 3.1", "< 5"
|
data/lib/konacha/runner.rb
CHANGED
@@ -8,12 +8,13 @@ module Konacha
|
|
8
8
|
|
9
9
|
attr_reader :reporter
|
10
10
|
|
11
|
-
def initialize
|
11
|
+
def initialize(session = nil)
|
12
|
+
@session = session
|
12
13
|
@reporter = Konacha::Reporter.new(*formatters)
|
13
14
|
end
|
14
15
|
|
15
|
-
def run
|
16
|
-
session.visit
|
16
|
+
def run(path = '/')
|
17
|
+
session.visit path
|
17
18
|
|
18
19
|
events_consumed = 0
|
19
20
|
done = false
|
@@ -5,6 +5,19 @@ describe Konacha::SpecsController do
|
|
5
5
|
@routes = Konacha::Engine.routes
|
6
6
|
end
|
7
7
|
|
8
|
+
describe '#parent' do
|
9
|
+
it 'accepts a mode parameter and assigns it to @run_mode' do
|
10
|
+
get :parent, :mode => 'runner'
|
11
|
+
assigns[:run_mode].should be_runner
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'uses the Konacha.mode if no mode parameter is specified' do
|
15
|
+
Konacha.stub(:mode => :konacha_mode)
|
16
|
+
get :parent
|
17
|
+
assigns[:run_mode].should be_konacha_mode
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
describe "#iframe" do
|
9
22
|
it "assigns the result of Spec.find_by_name to @spec" do
|
10
23
|
Konacha::Spec.should_receive(:find_by_name).with("spec_name") { :spec }
|
data/spec/runner_spec.rb
CHANGED
@@ -5,8 +5,8 @@ describe Konacha::Runner do
|
|
5
5
|
Konacha.mode = :runner
|
6
6
|
STDOUT.stub(:puts)
|
7
7
|
end
|
8
|
-
|
9
8
|
describe ".new" do
|
9
|
+
|
10
10
|
before do
|
11
11
|
class TestFormatter
|
12
12
|
def initialize(io)
|
@@ -24,6 +24,11 @@ describe Konacha::Runner do
|
|
24
24
|
Konacha::Reporter.should_receive(:new).with(instance_of(Konacha::Formatter), instance_of(TestFormatter))
|
25
25
|
described_class.new
|
26
26
|
end
|
27
|
+
|
28
|
+
it 'accepts an existing capybara session' do
|
29
|
+
instance = described_class.new 'existing_session'
|
30
|
+
instance.session.should == 'existing_session'
|
31
|
+
end
|
27
32
|
end
|
28
33
|
|
29
34
|
shared_examples_for "Konacha::Runner" do |driver|
|
@@ -127,6 +132,15 @@ describe Konacha::Runner do
|
|
127
132
|
subject.reporter.should_receive(:process_mocha_event).any_number_of_times
|
128
133
|
subject.run
|
129
134
|
end
|
135
|
+
|
136
|
+
it 'accepts paths to test' do
|
137
|
+
session = double('capybara session')
|
138
|
+
session.stub(:evaluate_script).and_return([start, pass, end_event].to_json)
|
139
|
+
session.should_receive(:visit).with('/test_path')
|
140
|
+
|
141
|
+
instance = described_class.new session
|
142
|
+
instance.run('/test_path')
|
143
|
+
end
|
130
144
|
end
|
131
145
|
end
|
132
146
|
|
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.3.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-01-
|
12
|
+
date: 2013-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -325,7 +325,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
325
325
|
version: '0'
|
326
326
|
segments:
|
327
327
|
- 0
|
328
|
-
hash:
|
328
|
+
hash: 3599375489174334072
|
329
329
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
330
330
|
none: false
|
331
331
|
requirements:
|
@@ -334,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
334
|
version: '0'
|
335
335
|
segments:
|
336
336
|
- 0
|
337
|
-
hash:
|
337
|
+
hash: 3599375489174334072
|
338
338
|
requirements: []
|
339
339
|
rubyforge_project:
|
340
340
|
rubygems_version: 1.8.24
|