konacha 2.2.0 → 2.3.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # master
2
2
 
3
+ # 2.3.0
4
+
5
+ * Improved support for guard-konacha
6
+
3
7
  # 2.2.0
4
8
 
5
9
  * Update mocha (1.8.1) and chai (1.4.2)
@@ -5,6 +5,7 @@ module Konacha
5
5
  end
6
6
 
7
7
  def parent
8
+ @run_mode = params.fetch(:mode, Konacha.mode).to_s.inquiry
8
9
  @specs = Konacha::Spec.all(params[:path])
9
10
  end
10
11
 
@@ -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 Konacha.mode == :runner %>
8
+ <%= javascript_include_tag("konacha/runner", :debug => false) if @run_mode.runner? %>
9
9
  </head>
10
10
  <body>
11
11
  <% @specs.each do |spec| %>
@@ -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.2.0"
20
+ gem.version = "2.3.0"
21
21
  gem.license = "MIT"
22
22
 
23
23
  gem.add_dependency "railties", ">= 3.1", "< 5"
@@ -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 }
@@ -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
 
@@ -12,6 +12,7 @@ describe "konacha/specs/parent" do
12
12
 
13
13
  spec = spec_double("a_spec")
14
14
  assign(:specs, [spec])
15
+ assign(:run_mode, "server".inquiry)
15
16
 
16
17
  render
17
18
 
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.2.0
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-09 00:00:00.000000000 Z
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: 1029934179768288726
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: 1029934179768288726
337
+ hash: 3599375489174334072
338
338
  requirements: []
339
339
  rubyforge_project:
340
340
  rubygems_version: 1.8.24