qunit-rails 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59a108307b5fc8af1eb7e680fa1a62472018caf7
4
- data.tar.gz: c23b8db5646703f3e72327c1a62baf2d6960d113
3
+ metadata.gz: d36a6e67173926358fa5107d450736b5ed487815
4
+ data.tar.gz: 87d91289641cae10ae0fe5a7bc4d008fd73eaa7a
5
5
  SHA512:
6
- metadata.gz: ab29f53dedacf6efb20ee9671a6169abebbdf513b31b76a765ea93d8ce1df6710b35cdc8011f36f4c1c252d55bb33c55256811020f221d584d704321b6640c17
7
- data.tar.gz: ae022fd3686219d3c41b4d95a858fd1da92e97e2673defdc91bcfbeaec8a5becbd8257972d0092a3d7c140038350b2ae008fbd01dfa68f737e3640bf8f794eaf
6
+ metadata.gz: b477bdc7f8552f9d2b2921af4d92ae02c4b408deb489a3ec1c9136bd7298894ba13e14b0b683feb81b0d214521fa5dc706b709c48fdc0cfbc11ce6226fc6e973
7
+ data.tar.gz: ad353fc122858d4d3fc6ebb45515ae251d482cf5d773473d50a9f4afa63f07f2f43fd19f57ef880ce23a47c09df42885afd3b1364975c3e33aa7a250c23b2741
data/.gems ADDED
@@ -0,0 +1 @@
1
+ railties -v 3.2.16
data/CHANGELOG.md CHANGED
@@ -0,0 +1,8 @@
1
+ 0.0.5
2
+ -----
3
+
4
+ * Add custom name support for test folders.
5
+
6
+ * Use `get` instead of `match` in the routes. PR [#17](https://github.com/frodsan/qunit-rails/pull/17).
7
+
8
+ * Update routes to not remount if previously mounted. PR [#16](https://github.com/frodsan/qunit-rails/pull/16).
data/README.md CHANGED
@@ -3,25 +3,19 @@ QUnit on Rails
3
3
 
4
4
  QUnit JavaScript Unit Testing framework for Rails.
5
5
 
6
- Requirements
7
- ------------
8
-
9
- * Ruby 1.9.x
10
- * Rails 3.2+
11
-
12
6
  Getting Started
13
7
  ---------------
14
8
 
15
9
  QUnit on Rails works with Rails 3.2. You can add it to your Gemfile with:
16
10
 
17
- group :development, :test do
18
- gem 'qunit-rails'
19
- end
11
+ ```ruby
12
+ group :development, :test do
13
+ gem "qunit-rails"
14
+ end
15
+ ```
20
16
 
21
- Run the bundle command to install it.
22
-
23
- **The engine is automatically mounted into your application in the development
24
- and test environments.**
17
+ Run the bundle command to install it. The engine is automatically mounted
18
+ into your application in the development and test environments.
25
19
 
26
20
  After you install it and add it to your Gemfile, you need to run the install
27
21
  generator:
@@ -34,21 +28,41 @@ your `test` folder:
34
28
  test/javascripts/test_helper.js
35
29
  test/stylesheets/test_helper.css
36
30
 
37
- If you prefer *CoffeeScript*, you can run:
31
+ If you want to specify a custom folder name for the tests and the test helpers,
32
+ you'll need to change the `qunit.tests_path` option in `config/environments/development.rb`
33
+ file:
34
+
35
+ ```ruby
36
+ App::Application.configure do
37
+ ...
38
+
39
+ config.qunit.tests_path = "spec"
40
+ end
41
+ ```
42
+
43
+ Then, this is the result if you run `rails g qunit:install`:
44
+
45
+ spec/javascripts/test_helper.js
46
+ spec/stylesheets/test_helper.js
47
+
48
+ If you prefer CoffeeScript, you can run:
38
49
 
39
- rails g qunit:install -c
50
+ rails g qunit:install -j coffee
40
51
 
41
52
  This will generate a `test_helper.coffee` file instead of `test_helper.js`.
42
53
 
43
- ## Usage
54
+ Usage
55
+ -----
44
56
 
45
57
  ### JavaScript/CoffeeScript Tests
46
58
 
47
59
  The `test/javascripts/test_helper.js` file has the following content:
48
60
 
49
- //= require application
50
- //= require_tree .
51
- //= require_self
61
+ ```javascript
62
+ //= require application
63
+ //= require_tree .
64
+ //= require_self
65
+ ```
52
66
 
53
67
  This loads all the javascripts defined in `app/assets/javascripts/application.js`.
54
68
  Also, this pulls in all your test files from the `javascripts` folder into
@@ -61,11 +75,13 @@ Also, this pulls in all your test files from the `javascripts` folder into
61
75
 
62
76
  Here's an example `test/javascripts/foo_test.js`:
63
77
 
64
- test('Foo always says the truth', function() {
65
- foo = new Foo();
78
+ ```javascript
79
+ test("Foo always says the truth", function() {
80
+ foo = new Foo();
66
81
 
67
- equal(foo.truth, true, 'foo.truth is not true');
68
- });
82
+ equal(foo.truth, true, "foo.truth is not true");
83
+ });
84
+ ```
69
85
 
70
86
  If you're not comfortable with loading all the javascript defined in the
71
87
  `application.js` manifest file, you can delete `//= require application`
@@ -74,42 +90,49 @@ and use the `require` dependency mechanism in your tests to pull the dependencie
74
90
 
75
91
  Here's an example `test/javascripts/foo_test.js`:
76
92
 
77
- //= require foo
93
+ ```javascript
94
+ //= require foo
78
95
 
79
- test('Foo always says the truth', function() {
80
- foo = new Foo();
96
+ test("Foo always says the truth", function() {
97
+ foo = new Foo();
81
98
 
82
- equal(foo.truth, true, 'foo.truth is not true');
83
- });
99
+ equal(foo.truth, true, "foo.truth is not true");
100
+ });
101
+ ```
84
102
 
85
103
  ### Stylesheets
86
104
 
87
- For including stylesheets in your tests, **QUnit-Rails** uses
88
- `test/javascripts/test_helper.css`. Use [Sprockets](https://github.com/sstephenson/sprockets)
105
+ For including stylesheets in your tests, It uses
106
+ `test/javascripts/test_helper.css`. Use [Sprockets][sprockets]
89
107
  directives to include the right css files:
90
108
 
91
- /*
92
- *= require application
93
- *= require_tree .
94
- */
109
+ ```css
110
+ /*
111
+ *= require application
112
+ *= require_tree .
113
+ */
114
+ ```
95
115
 
96
- ### Overriding `index.html`
116
+ ### Overriding `index.html`
97
117
 
98
118
  You can set your own custom Test Runner, by overriding
99
119
  the default `index.html.erb`. Create a new file in
100
120
  `app/views/qunit/rails/test/index.html.erb` and edit it
101
121
  whichever you prefer:
102
122
 
103
- <html>
104
- <head>
105
- <title>My Custom Test Runner</title>
106
- </head>
107
- <body>
108
- <h1>My Custom Test Runner</h1>
109
- </body>
110
- </html>
123
+ ```html
124
+ <html>
125
+ <head>
126
+ <title>My Custom Test Runner</title>
127
+ </head>
128
+ <body>
129
+ <h1>My Custom Test Runner</h1>
130
+ </body>
131
+ </html>
132
+ ```
111
133
 
112
- ## Run Tests
134
+ Run Tests
135
+ ---------
113
136
 
114
137
  ### Start server
115
138
 
@@ -117,20 +140,6 @@ Start the server to run the tests:
117
140
 
118
141
  rails s
119
142
 
120
- Go to `http://localhost:3000/qunit` to see the QUnit Test Runner.
121
-
122
- ### From the CLI
123
-
124
- [Eventually](/)
125
-
126
- ### Autotest
127
-
128
- [Eventually](/)
129
-
130
- ## What's next?
131
-
132
- Profit.
133
-
134
- ## License
143
+ Go to <http://localhost:3000/qunit> to see the QUnit Test Runner.
135
144
 
136
- MIT License. Copyright 2012 Francesco Rodriguez. <http://www.frodsan.com>
145
+ [sprockets]: https://github.com/sstephenson/sprockets)
data/UNLICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <http://unlicense.org/>
@@ -1,10 +1,7 @@
1
- module Qunit
1
+ module QUnit
2
2
  module Rails
3
3
  class TestController < ActionController::Base
4
4
  layout false
5
-
6
- def index
7
- end
8
5
  end
9
6
  end
10
7
  end
@@ -1 +1,5 @@
1
- Rails.application.config.assets.paths << Rails.root.join('test', 'javascripts') << Rails.root.join('test', 'stylesheets')
1
+ qunit = Rails.application.config.qunit
2
+ javascripts_path = Rails.root.join(qunit.tests_path, qunit.javascripts_path)
3
+ stylesheets_path = Rails.root.join(qunit.tests_path, qunit.stylesheets_path)
4
+
5
+ Rails.application.config.assets.paths << javascripts_path << stylesheets_path
data/config/routes.rb CHANGED
@@ -1,7 +1,10 @@
1
- Qunit::Rails::Engine.routes.draw do
2
- root to: 'test#index'
1
+ QUnit::Rails::Engine.routes.draw do
2
+ root to: "test#index"
3
+ get ":action", controller: "test"
3
4
  end
4
5
 
5
6
  Rails.application.routes.draw do
6
- mount Qunit::Rails::Engine => '/qunit'
7
+ unless Rails.application.routes.named_routes.routes[:qunit_rails]
8
+ mount QUnit::Rails::Engine => "/qunit"
9
+ end
7
10
  end