rails_sandbox_jasmine 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,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.sw?
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails_sandbox_jasmine.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Rodrigo Rosenfeld Rosas
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
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
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Jasmine specs for the Rails asset pipeline
2
+
3
+ Run your specs while taking advantage of the Rails asset pipeline.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rails_sandbox_jasmine'
10
+
11
+ Or if you prefer to use the master branch:
12
+
13
+ gem 'rails_sandbox_jasmine', git: 'git://github.com/rosenfeld/rails_sandbox_jasmine' # or:
14
+ gem 'rails_sandbox_jasmine', github: 'rosenfeld/rails_sandbox_jasmine' # Bundler-pre syntax
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ ## Usage
21
+
22
+ $ rake sandbox_assets:serve
23
+
24
+ If you only intend to use the Jasmine test runner with the Rails Sandbox Assets gem, you can
25
+ set the default template to 'jasmine/runner' in your config/application.rb, for example:
26
+
27
+ config.sandbox_assets.template = 'jasmine/runner'
28
+
29
+ Then name your specs as specs/javascripts/some\_spec.js.coffee.
30
+
31
+ By default, this gem will only enable the Jasmine test runner for specs under
32
+ specs/javascripts/jasmine/. Run them by browsing to http://localhost:5000/jasmine.
33
+
34
+ For more details on settings please take a look at the
35
+ [rails-sandbox-assets gem](http://github.com/rosenfeld/rails-sandbox-assets).
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,46 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html;charset=utf-8" />
5
+ <title>Jasmine Spec Runner</title>
6
+ <link rel="shortcut icon" type="image/png" href="<%= asset_path 'jasmine_favicon.png' %>" />
7
+ <%= stylesheet_link_tag "jasmine" %>
8
+ <%= javascript_include_tag "jasmine", "jasmine-html" %>
9
+
10
+ <% @tests.each do |test| -%>
11
+ <%= javascript_include_tag test %>
12
+ <% end -%>
13
+
14
+ <script type="text/javascript">
15
+ (function() {
16
+ var jasmineEnv = jasmine.getEnv();
17
+ jasmineEnv.updateInterval = 1000;
18
+
19
+ var htmlReporter = new jasmine.HtmlReporter();
20
+
21
+ jasmineEnv.addReporter(htmlReporter);
22
+
23
+ jasmineEnv.specFilter = function(spec) {
24
+ return htmlReporter.specFilter(spec);
25
+ };
26
+
27
+ var currentWindowOnload = window.onload;
28
+
29
+ window.onload = function() {
30
+ if (currentWindowOnload) {
31
+ currentWindowOnload();
32
+ }
33
+ execJasmine();
34
+ };
35
+
36
+ function execJasmine() {
37
+ jasmineEnv.execute();
38
+ }
39
+
40
+ })();
41
+ </script>
42
+ </head>
43
+
44
+ <body>
45
+ </body>
46
+ </html>
@@ -0,0 +1,3 @@
1
+ module RailsSandboxJasmine
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,18 @@
1
+ require "rails_sandbox_jasmine/version"
2
+ require "rails-sandbox-assets"
3
+
4
+ module RailsSandboxJasmine
5
+ class JasmineFilter
6
+ def self.filter(controller)
7
+ controller.template = 'jasmine/runner' if controller.params[:path].try :start_with?, 'jasmine'
8
+ end
9
+ end
10
+
11
+ class Engine < Rails::Engine
12
+ initializer 'sandbox_assets.jasmine' do |app|
13
+ unless app.config.sandbox_assets.template == 'jasmine/runner'
14
+ SandboxAssets::BaseController.prepend_before_filter JasmineFilter
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/rails_sandbox_jasmine/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Rodrigo Rosenfeld Rosas"]
6
+ gem.email = ["rr.rosas@gmail.com"]
7
+ gem.description = %q{Add Jasmine spec runner to Rails}
8
+ gem.summary = %q{Use rails-sandbox-assets to serve the assets}
9
+ gem.homepage = "http://github.com/rosenfeld/rails_sandbox_jasmine"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "rails_sandbox_jasmine"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = RailsSandboxJasmine::VERSION
17
+
18
+ gem.add_dependency 'rails-sandbox-assets', '>= 0.0.2'
19
+ end