qunited-rails 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +35 -0
- data/lib/qunited/rails/tasks/qunited.rake +2 -2
- data/lib/qunited/rails/test_task.rb +100 -0
- data/lib/qunited/rails/version.rb +1 -1
- metadata +17 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dd3ec15eb70f34344a6077d0e2adaab92cfa7287
|
4
|
+
data.tar.gz: d419b9f5276abb929e7d75e62c923dcfcf47db8e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bffb5f7bfcf0d13a16fc082bd9482a6d3ee92ba17a5b69f89d9d8d4c48a14027e98f7ca3c197aadbf4570f836f6b97dde0dafd9b4a51ffbc77c1be1a3b3e1289
|
7
|
+
data.tar.gz: 09afd648bb22d3f6791414ee3d2f98d632417481499c7e260b4f0179012f51abd48313cdd0d566b831a2117908fb97d26bab38d8bcfa85cc0352461af31485a8
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Aaron Royer
|
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,35 @@
|
|
1
|
+
<img src="http://i.imgur.com/NIoQy.png" width="150px" />
|
2
|
+
|
3
|
+
qunited-rails runs headless QUnit tests with [QUnited](https://github.com/aaronroyer/qunited) in your Rails 3 project.
|
4
|
+
|
5
|
+
## Configuration
|
6
|
+
|
7
|
+
Add the following to your Gemfile in your Rails 3 project:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group :test, :development do
|
11
|
+
gem 'qunited-rails'
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
The development group is necessary to run Rake tasks without having to type RAILS_ENV=test.
|
16
|
+
|
17
|
+
Next run Bundler to install the necessary gems.
|
18
|
+
|
19
|
+
```
|
20
|
+
$ bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
## Running Tests
|
24
|
+
|
25
|
+
```
|
26
|
+
$ bundle exec rake test:javascripts
|
27
|
+
```
|
28
|
+
|
29
|
+
## Dependencies
|
30
|
+
|
31
|
+
Tests are run with PhantomJS if available, otherwise Rhino (Java) is used. This means you'll either need to have PhantomJS or Java (version 1.1 minimum) in your path to use qunited-rails.
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
qunited-rails is MIT licensed
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'qunited/rake_task'
|
2
2
|
|
3
|
-
desc 'Run
|
4
|
-
task 'test:
|
3
|
+
desc 'Run tests on application JavaScript file'
|
4
|
+
task 'test:js:application' => :environment do
|
5
5
|
QUnited::RakeTask.new('qunited') do |t|
|
6
6
|
all_js_file = './tmp/qunited-application.js'
|
7
7
|
File.open(all_js_file, 'w') do |f|
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module QUnited
|
2
|
+
module Rails
|
3
|
+
class TestTask < ::Rake::TaskLib
|
4
|
+
include ::Rake::DSL if defined?(::Rake::DSL)
|
5
|
+
|
6
|
+
TMP_DIR_NAME = 'qunited-compiled-js'
|
7
|
+
|
8
|
+
# Name of task.
|
9
|
+
#
|
10
|
+
# default:
|
11
|
+
# :qunited
|
12
|
+
attr_accessor :name
|
13
|
+
|
14
|
+
# Array or strings specifying logical paths of Assets. These will be
|
15
|
+
# loaded in order if specified as an array.
|
16
|
+
attr_writer :source_paths
|
17
|
+
|
18
|
+
# Array or glob pattern of QUnit test files. These will be loaded in order if specified as an array.
|
19
|
+
attr_accessor :test_files
|
20
|
+
|
21
|
+
# Array or glob pattern of test helper files. These include extra libraries for mocks or other
|
22
|
+
# test tools. These are loaded after source files and before test files. These will be loaded
|
23
|
+
# in order if specified as an array.
|
24
|
+
attr_accessor :helper_files
|
25
|
+
|
26
|
+
# Array or glob pattern of fixture files. These are included under the #qunit-fixture element
|
27
|
+
# on the test page. These will be included in order if specified as an array.
|
28
|
+
attr_accessor :fixture_files
|
29
|
+
|
30
|
+
# The driver to use to run the QUnit tests.
|
31
|
+
attr_accessor :driver
|
32
|
+
|
33
|
+
# Use verbose output. If this is true, the task will print the QUnited command to stdout.
|
34
|
+
#
|
35
|
+
# default:
|
36
|
+
# true
|
37
|
+
attr_accessor :verbose
|
38
|
+
|
39
|
+
# Fail rake task when tests fail.
|
40
|
+
#
|
41
|
+
# default:
|
42
|
+
# true
|
43
|
+
attr_accessor :fail_on_test_failure
|
44
|
+
|
45
|
+
# The port to use if running the server.
|
46
|
+
#
|
47
|
+
# default:
|
48
|
+
# 3040
|
49
|
+
attr_accessor :server_port
|
50
|
+
|
51
|
+
def initialize(*args)
|
52
|
+
@name = args.shift || :qunited
|
53
|
+
@verbose = true
|
54
|
+
@fail_on_test_failure = true
|
55
|
+
@server_port = nil
|
56
|
+
|
57
|
+
yield self if block_given?
|
58
|
+
|
59
|
+
desc('Run QUnit JavaScript tests') unless ::Rake.application.last_comment
|
60
|
+
task(@name => :environment) do
|
61
|
+
internal_task_name = "qunited-rails-#{@name}"
|
62
|
+
QUnited::RakeTask.new(internal_task_name) do |t|
|
63
|
+
create_tmp_dir
|
64
|
+
|
65
|
+
compiled_source_files = []
|
66
|
+
source_paths.each do |path|
|
67
|
+
compiled_source_files << compile_and_write_tmp_file(path)
|
68
|
+
end
|
69
|
+
|
70
|
+
t.source_files = compiled_source_files
|
71
|
+
%w[test_files helper_files fixture_files driver verbose fail_on_test_failure server_port].each do |a|
|
72
|
+
t.send("#{a}=", send(a))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
Rake::Task[internal_task_name].invoke
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def create_tmp_dir
|
83
|
+
tmp_path = "./tmp/#{TMP_DIR_NAME}"
|
84
|
+
Dir.mkdir tmp_path unless File.directory?(tmp_path)
|
85
|
+
end
|
86
|
+
|
87
|
+
def compile_and_write_tmp_file(logical_path)
|
88
|
+
filename = "./tmp/#{TMP_DIR_NAME}/#{logical_path}"
|
89
|
+
File.open(filename, 'w') do |f|
|
90
|
+
f.write(::Rails.application.assets.find_asset(logical_path).to_s)
|
91
|
+
end
|
92
|
+
filename
|
93
|
+
end
|
94
|
+
|
95
|
+
def source_paths
|
96
|
+
Array(@source_paths)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qunited-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Aaron Royer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-09-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: qunited
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
description: Run headless JavaScript tests with QUnit/QUnited with your Rails project
|
26
28
|
email:
|
27
29
|
- aaronroyer@gmail.com
|
@@ -31,33 +33,35 @@ extra_rdoc_files: []
|
|
31
33
|
files:
|
32
34
|
- .gitignore
|
33
35
|
- Gemfile
|
36
|
+
- MIT-LICENSE
|
37
|
+
- README.md
|
34
38
|
- Rakefile
|
35
39
|
- lib/qunited-rails.rb
|
36
40
|
- lib/qunited/rails/tasks/qunited.rake
|
41
|
+
- lib/qunited/rails/test_task.rb
|
37
42
|
- lib/qunited/rails/version.rb
|
38
43
|
- qunited-rails.gemspec
|
39
44
|
homepage: https://github.com/aaronroyer/qunited-rails
|
40
45
|
licenses: []
|
46
|
+
metadata: {}
|
41
47
|
post_install_message:
|
42
48
|
rdoc_options: []
|
43
49
|
require_paths:
|
44
50
|
- lib
|
45
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
52
|
requirements:
|
48
|
-
- -
|
53
|
+
- - '>='
|
49
54
|
- !ruby/object:Gem::Version
|
50
55
|
version: '0'
|
51
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
57
|
requirements:
|
54
|
-
- -
|
58
|
+
- - '>='
|
55
59
|
- !ruby/object:Gem::Version
|
56
60
|
version: '0'
|
57
61
|
requirements: []
|
58
62
|
rubyforge_project: qunited-rails
|
59
|
-
rubygems_version:
|
63
|
+
rubygems_version: 2.0.3
|
60
64
|
signing_key:
|
61
|
-
specification_version:
|
65
|
+
specification_version: 4
|
62
66
|
summary: QUnit tests for your Rails build
|
63
67
|
test_files: []
|