qunit-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/log/*.log
6
+ test/dummy/tmp/
7
+ test/dummy/.sass-cache
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ qunit-rails (0.0.1)
5
+ railties (~> 3.2.3)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionpack (3.2.3)
11
+ activemodel (= 3.2.3)
12
+ activesupport (= 3.2.3)
13
+ builder (~> 3.0.0)
14
+ erubis (~> 2.7.0)
15
+ journey (~> 1.0.1)
16
+ rack (~> 1.4.0)
17
+ rack-cache (~> 1.2)
18
+ rack-test (~> 0.6.1)
19
+ sprockets (~> 2.1.2)
20
+ activemodel (3.2.3)
21
+ activesupport (= 3.2.3)
22
+ builder (~> 3.0.0)
23
+ activesupport (3.2.3)
24
+ i18n (~> 0.6)
25
+ multi_json (~> 1.0)
26
+ builder (3.0.0)
27
+ erubis (2.7.0)
28
+ hike (1.2.1)
29
+ i18n (0.6.0)
30
+ journey (1.0.3)
31
+ json (1.7.3)
32
+ multi_json (1.3.5)
33
+ rack (1.4.1)
34
+ rack-cache (1.2)
35
+ rack (>= 0.4)
36
+ rack-ssl (1.3.2)
37
+ rack
38
+ rack-test (0.6.1)
39
+ rack (>= 1.0)
40
+ railties (3.2.3)
41
+ actionpack (= 3.2.3)
42
+ activesupport (= 3.2.3)
43
+ rack-ssl (~> 1.3.2)
44
+ rake (>= 0.8.7)
45
+ rdoc (~> 3.4)
46
+ thor (~> 0.14.6)
47
+ rake (0.9.2.2)
48
+ rdoc (3.12)
49
+ json (~> 1.4)
50
+ sprockets (2.1.3)
51
+ hike (~> 1.2)
52
+ rack (~> 1.0)
53
+ tilt (~> 1.1, != 1.3.0)
54
+ thor (0.14.6)
55
+ tilt (1.3.3)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ qunit-rails!
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Francesco Rodriguez
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # QUnit on Rails
2
+
3
+ QUnit JavaScript Unit Testing framework for Rails.
4
+
5
+ ## Requirements
6
+
7
+ * Ruby 1.9.x
8
+ * Rails 3.2+
9
+
10
+ ## Getting Started
11
+
12
+ QUnit on Rails works with Rails 3.2. You can add it to your Gemfile with:
13
+
14
+ group :development, :test do
15
+ gem 'qunit-rails'
16
+ end
17
+
18
+ Run the bundle command to install it.
19
+
20
+ **The engine is automatically mounted into your application in the development
21
+ and test environments.**
22
+
23
+ After you install it and add it to your Gemfile, you need to run the install
24
+ generator:
25
+
26
+ rails g qunit:install
27
+
28
+ The generator will create two directories with two files inside your `test` folder:
29
+
30
+ test/javascripts/test_helper.js
31
+ test/stylesheets/test_helper.css
32
+
33
+ ## Usage
34
+
35
+ ### JavaScripts
36
+
37
+ The file `test/javascripts/test_helper.js` has the following content:
38
+
39
+ //= require application
40
+ //= require_tree .
41
+
42
+ This loads all the javascripts defined in `app/assets/javascripts/application.js`.
43
+ Also, this pulls in all your test files from the `javascripts` folder into
44
+ *QUnit-Rails*:
45
+
46
+ test/javascripts/*_test.js
47
+ test/javascripts/*_test.js.coffee
48
+ test/javascripts/*_test.js.erb
49
+
50
+ Here's an example `test/javascripts/foo_test.js`:
51
+
52
+ test('Foo always says the truth', function() {
53
+ foo = new Foo();
54
+
55
+ equal(foo.truth, true, 'foo.truth is not true');
56
+ });
57
+
58
+ If you're not comfortable with loading all the javascript defined in the
59
+ `application.js` manifest file, you can delete `//= require application`
60
+ from the `test_helper.js` file and use the `require` dependency mechanism
61
+ in your tests to pull the dependencies. Here's an example
62
+ `test/javascripts/foo_test.js`:
63
+
64
+ //= require foo
65
+
66
+ test('Foo always says the truth', function() {
67
+ foo = new Foo();
68
+
69
+ equal(foo.truth, true, 'foo.truth is not true');
70
+ });
71
+
72
+ ### Stylesheets
73
+
74
+ For including stylesheets in your tests, *QUnit-Rails* uses
75
+ `test/javascripts/test_helper.css`. Use [Sprockets](https://github.com/sstephenson/sprockets)
76
+ directives to include the right css files:
77
+
78
+ /*
79
+ *= require application
80
+ *= require_tree .
81
+ */
82
+
83
+ ## Run Tests
84
+
85
+ ### Start server
86
+
87
+ Start the server to run the tests:
88
+
89
+ rails s
90
+
91
+ Go to `http://localhost:3000/qunit` to see the QUnit Test Runner.
92
+
93
+ ### From the CLI
94
+
95
+ [COMING SOON](/)
96
+
97
+ ### Autotest
98
+
99
+ [COMING SOON](/)
100
+
101
+ ## What's next?
102
+
103
+ Profit.
104
+
105
+ ## License
106
+
107
+ MIT License. Copyright 2012 Francesco Rodriguez. <http://www.frodsan.com>
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ module Qunit
2
+ module Rails
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ module Qunit
2
+ module Rails
3
+ class TestController < Qunit::Rails::ApplicationController
4
+ layout false
5
+
6
+ def index
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ <html>
2
+ <head>
3
+ <title>QUnit Test Runner</title>
4
+ <%= stylesheet_link_tag "qunit" %>
5
+ <%= stylesheet_link_tag "test_helper" %>
6
+ <%= javascript_include_tag "qunit" %>
7
+ <%= javascript_include_tag "test_helper" %>
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+ <div id="qunit"></div></div>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ Rails.application.config.assets.paths << Rails.root.join("test", "javascripts") << Rails.root.join("test", "stylesheets")
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ Qunit::Rails::Engine.routes.draw do
2
+ root to: 'test#index'
3
+ end
4
+
5
+ Rails.application.routes.draw do
6
+ mount Qunit::Rails::Engine => '/qunit'
7
+ end