konacha 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,13 +1,20 @@
1
1
  # master
2
2
 
3
+ # 0.10.0
4
+
5
+ * Rename `konacha:ci` and `konacha:server` task to `konacha:run` and
6
+ `konacha:serve`
7
+ * Really don't require spec dependencies multiple times (#3)
8
+
3
9
  # 0.9.1
4
10
 
5
11
  * Support foo_spec.coffee files (without .js)
6
- * Rename Konacha::Spec#basename to #asset_name
7
12
  * Switch default port to 3500 to avoid collisions with HTTP proxies (like Charles)
8
13
  * Update vendored copies of mocha (0.14.0+) and chai (0.4.2+)
9
14
  * Do not require spec dependencies multiple times (#3)
10
15
  * Support running a subset of specs via a subdirectory path
16
+ * Move #test div off screen: It's still layouted and CSS-visible,
17
+ but not actually visible in the browser window
11
18
 
12
19
  # 0.9.0
13
20
 
data/README.md CHANGED
@@ -56,12 +56,12 @@ Or, if you prefer CoffeeScript, in `spec/javascripts/array_sum_spec.js.coffee`:
56
56
  it "returns the sum of numeric elements", ->
57
57
  [1,2,3].sum().should.equal(6)
58
58
 
59
- The `konacha:server` rake task starts a server for your tests. You can go to the root
59
+ The `konacha:serve` rake task starts a server for your tests. You can go to the root
60
60
  page to run all specs (e.g. `http://localhost:3500/`), a sub page to run an individual
61
61
  spec file (e.g. `http://localhost:3500/array_sum_spec`), or a path to a subdirectory to
62
62
  run a subset of specs (e.g. `http://localhost:3500/models`).
63
63
 
64
- Alternatively, you can run the specs headlessly with the `konacha:ci` task.
64
+ Alternatively, you can run the specs headlessly with the `konacha:run` task.
65
65
 
66
66
  ## Spec Helper
67
67
 
@@ -103,7 +103,7 @@ environment.
103
103
 
104
104
  The `spec_dir` option tells Konacha where to find JavaScript specs. The `interface`
105
105
  option specifies the test interface used by Mocha (see below). `driver` names a
106
- Capybara driver used for the CI task (try `:webkit`, after installing
106
+ Capybara driver used for the `run` task (try `:webkit`, after installing
107
107
  [capybara-webkit](https://github.com/thoughtbot/capybara-webkit)).
108
108
 
109
109
  The values above are the defaults.
@@ -5,7 +5,7 @@ module Konacha
5
5
  asset_paths.asset_for(spec.asset_name, "js").to_a
6
6
  end.flatten.uniq.map(&:logical_path)
7
7
 
8
- javascript_include_tag *assets, :body => true
8
+ javascript_include_tag *assets, :body => true, :debug => false
9
9
  end
10
10
  end
11
11
  end
@@ -2,10 +2,10 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta http-equiv="content-type" content="text/html;charset=utf-8" />
5
- <title>Mocha Tests</title>
6
- <%= stylesheet_link_tag "mocha" %>
7
- <%= stylesheet_link_tag "konacha" %>
8
- <%= javascript_include_tag "jquery", "mocha", "chai", "konacha/#{Konacha.mode}" %>
5
+ <title>Konacha Tests</title>
6
+ <%= stylesheet_link_tag "mocha", :debug => false %>
7
+ <%= stylesheet_link_tag "konacha", :debug => false %>
8
+ <%= javascript_include_tag "jquery", "mocha", "chai", "konacha/#{Konacha.mode}", :debug => false %>
9
9
  <script>
10
10
  mocha.setup(<%= raw Konacha.interface.to_json %>);
11
11
  var expect = chai.expect,
@@ -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 = "0.9.1"
20
+ gem.version = "0.10.0"
21
21
 
22
22
  gem.add_dependency "jquery-rails"
23
23
  gem.add_dependency "rails", "~> 3.1"
@@ -1,3 +1,5 @@
1
+ require "capybara"
2
+
1
3
  module Konacha
2
4
  class Runner
3
5
  def self.start
@@ -1,11 +1,11 @@
1
1
  namespace :konacha do
2
2
  desc "Run JavaScript specs interactively"
3
- task :server => :environment do
3
+ task :serve => :environment do
4
4
  Konacha.serve
5
5
  end
6
6
 
7
7
  desc "Run JavaScript specs non-interactively"
8
- task :ci => :environment do
8
+ task :run => :environment do
9
9
  Konacha.run
10
10
  end
11
11
  end
@@ -0,0 +1,27 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Print deprecation notices to the Rails logger
17
+ config.active_support.deprecation = :log
18
+
19
+ # Only use best-standards-support built into browsers
20
+ config.action_dispatch.best_standards_support = :builtin
21
+
22
+ # Do not compress assets
23
+ config.assets.compress = false
24
+
25
+ # Expands the lines which load the assets
26
+ config.assets.debug = true
27
+ end
@@ -1,4 +1,7 @@
1
- ENV["RAILS_ENV"] = "test"
1
+ # In a real-world app, `rake konacha:serve` and `rake konacha:run` will use
2
+ # the development environment, so we test with the development defaults.
3
+ # In particular, it is important to test with `config.assets.debug = true`.
4
+ ENV["RAILS_ENV"] = "development"
2
5
 
3
6
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
7
  require "rspec/rails"
@@ -16,22 +19,3 @@ Capybara.configure do |config|
16
19
  config.default_driver = :selenium_with_firebug
17
20
  config.app = Konacha.application
18
21
  end
19
-
20
- module SpecDoubleHelpers
21
- def asset_double(asset_name, dependencies = [])
22
- asset = double("asset called '#{asset_name}'")
23
- asset.stub(:to_a).and_return([dependencies, asset].flatten)
24
- asset.stub(:logical_path).and_return(asset_name)
25
- view.asset_paths.stub(:asset_for).with(asset_name, "js").and_return(asset)
26
- asset
27
- end
28
-
29
- def spec_double(asset_name, dependencies = [])
30
- asset_double(asset_name, dependencies)
31
- double("spec called '#{asset_name}'", :asset_name => asset_name)
32
- end
33
- end
34
-
35
- RSpec.configure do |config|
36
- config.include SpecDoubleHelpers, :type => :view
37
- end
@@ -13,6 +13,19 @@ describe "konacha/specs/specs" do
13
13
  rendered.should have_css("script[src='/assets/konacha/runner.js']")
14
14
  end
15
15
 
16
+ def asset_double(asset_name, dependencies = [])
17
+ asset = double("asset called '#{asset_name}'")
18
+ asset.stub(:to_a).and_return([dependencies, asset].flatten)
19
+ asset.stub(:logical_path).and_return(asset_name)
20
+ view.asset_paths.stub(:asset_for).with(asset_name, "js").and_return(asset)
21
+ asset
22
+ end
23
+
24
+ def spec_double(asset_name, dependencies = [])
25
+ asset_double(asset_name, dependencies)
26
+ double("spec called '#{asset_name}'", :asset_name => asset_name)
27
+ end
28
+
16
29
  let(:dependency) { asset_double("dependency") }
17
30
 
18
31
  it "renders a script tag for each spec in @specs" do
@@ -42,4 +55,16 @@ describe "konacha/specs/specs" do
42
55
 
43
56
  rendered.should have_selector("script[src='/assets/dependency.js?body=1']", :count => 1)
44
57
  end
58
+
59
+ it "renders only one script tag for dependencies of dependencies" do
60
+ dependency_a = asset_double("dependency_a")
61
+ dependency_b = asset_double("dependency_b", [dependency_a])
62
+
63
+ assign(:specs, [spec_double("a_spec", [dependency_a, dependency_b])])
64
+
65
+ render
66
+
67
+ rendered.should have_selector("script[src='/assets/dependency_a.js?body=1']", :count => 1)
68
+ rendered.should have_selector("script[src='/assets/dependency_b.js?body=1']", :count => 1)
69
+ end
45
70
  end
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: 0.9.1
4
+ version: 0.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-05 00:00:00.000000000 Z
12
+ date: 2012-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
16
- requirement: &70360792487220 !ruby/object:Gem::Requirement
16
+ requirement: &70262855227300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70360792487220
24
+ version_requirements: *70262855227300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &70360792486700 !ruby/object:Gem::Requirement
27
+ requirement: &70262855225660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70360792486700
35
+ version_requirements: *70262855225660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: capybara
38
- requirement: &70360792486280 !ruby/object:Gem::Requirement
38
+ requirement: &70262855224940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70360792486280
46
+ version_requirements: *70262855224940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-rails
49
- requirement: &70360792485820 !ruby/object:Gem::Requirement
49
+ requirement: &70262855224000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70360792485820
57
+ version_requirements: *70262855224000
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: capybara-firebug
60
- requirement: &70360792485320 !ruby/object:Gem::Requirement
60
+ requirement: &70262855223340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.1'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70360792485320
68
+ version_requirements: *70262855223340
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: coffee-script
71
- requirement: &70360792484900 !ruby/object:Gem::Requirement
71
+ requirement: &70262855222780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70360792484900
79
+ version_requirements: *70262855222780
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: ejs
82
- requirement: &70360792484440 !ruby/object:Gem::Requirement
82
+ requirement: &70262855222000 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70360792484440
90
+ version_requirements: *70262855222000
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: vendorer
93
- requirement: &70360808602580 !ruby/object:Gem::Requirement
93
+ requirement: &70262855220680 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70360808602580
101
+ version_requirements: *70262855220680
102
102
  description: ! 'Konacha is a Rails engine that allows you to test your JavaScript
103
103
  with the
104
104
 
@@ -142,7 +142,7 @@ files:
142
142
  - spec/dummy/config/application.rb
143
143
  - spec/dummy/config/boot.rb
144
144
  - spec/dummy/config/environment.rb
145
- - spec/dummy/config/environments/test.rb
145
+ - spec/dummy/config/environments/development.rb
146
146
  - spec/dummy/config/initializers/konacha.rb
147
147
  - spec/dummy/spec/javascripts/array_sum_cs_spec.js.coffee
148
148
  - spec/dummy/spec/javascripts/array_sum_js_spec.js
@@ -200,7 +200,7 @@ test_files:
200
200
  - spec/dummy/config/application.rb
201
201
  - spec/dummy/config/boot.rb
202
202
  - spec/dummy/config/environment.rb
203
- - spec/dummy/config/environments/test.rb
203
+ - spec/dummy/config/environments/development.rb
204
204
  - spec/dummy/config/initializers/konacha.rb
205
205
  - spec/dummy/spec/javascripts/array_sum_cs_spec.js.coffee
206
206
  - spec/dummy/spec/javascripts/array_sum_js_spec.js
@@ -218,3 +218,4 @@ test_files:
218
218
  - spec/server_spec.rb
219
219
  - spec/spec_helper.rb
220
220
  - spec/views/specs/specs.html.erb_spec.rb
221
+ has_rdoc:
@@ -1,29 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
13
-
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
16
-
17
- # Show full error reports and disable caching
18
- config.consider_all_requests_local = true
19
- config.action_controller.perform_caching = false
20
-
21
- # Raise exceptions instead of rendering exception templates
22
- config.action_dispatch.show_exceptions = false
23
-
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
26
-
27
- # Print deprecation notices to the stderr
28
- config.active_support.deprecation = :stderr
29
- end