jasmine-rails 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/jasmine-rails.rb +39 -1
- data/lib/jasmine_rails/version.rb +1 -1
- data/lib/tasks/jasmine-rails_tasks.rake +2 -1
- metadata +3 -3
data/lib/jasmine-rails.rb
CHANGED
@@ -7,7 +7,7 @@ module JasmineRails
|
|
7
7
|
# ex: /jasmine
|
8
8
|
def route_path
|
9
9
|
route = Rails.application.routes.named_routes[:jasmine_rails]
|
10
|
-
raise 'JasmineRails::Engine has not been mounted
|
10
|
+
raise 'JasmineRails::Engine has not been mounted. Try adding `mount JasmineRails::Engine => "/specs" if defined?(JasmineRails)` to routes.rb' unless route
|
11
11
|
path = route.path
|
12
12
|
|
13
13
|
# Rails 3.1 support
|
@@ -59,6 +59,7 @@ module JasmineRails
|
|
59
59
|
def jasmine_config
|
60
60
|
@config ||= begin
|
61
61
|
path = Rails.root.join('spec', 'javascripts', 'support', 'jasmine.yml')
|
62
|
+
initialize_jasmine_config_if_absent(path)
|
62
63
|
YAML.load_file(path)
|
63
64
|
end
|
64
65
|
end
|
@@ -80,5 +81,42 @@ module JasmineRails
|
|
80
81
|
files = files.collect {|f| f.gsub(root_dir.to_s + '/', '') }
|
81
82
|
files || []
|
82
83
|
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def initialize_jasmine_config_if_absent(path)
|
88
|
+
return if File.exist?(path)
|
89
|
+
Rails.logger.warn("Initializing jasmine.yml configuration")
|
90
|
+
FileUtils.mkdir_p(File.dirname(path))
|
91
|
+
File.open(path, 'w') do |f|
|
92
|
+
f.write <<-YAML.gsub(/^\s{10}/,'')
|
93
|
+
# path to parent directory of src_files
|
94
|
+
# relative path from Rails.root
|
95
|
+
# defaults to app/assets/javascripts
|
96
|
+
src_dir: "app/assets/javascripts"
|
97
|
+
|
98
|
+
# list of file expressions to include as source files
|
99
|
+
# relative path from scr_dir
|
100
|
+
src_files:
|
101
|
+
- "application.{js,coffee}"
|
102
|
+
|
103
|
+
# path to parent directory of spec_files
|
104
|
+
# relative path from Rails.root
|
105
|
+
# defaults to spec/javascripts
|
106
|
+
spec_dir: spec/javascripts
|
107
|
+
|
108
|
+
# list of file expressions to include as helpers into spec runner
|
109
|
+
# relative path from spec_dir
|
110
|
+
helpers:
|
111
|
+
- "helpers/**/*.{js,coffee}"
|
112
|
+
|
113
|
+
# list of file expressions to include as specs into spec runner
|
114
|
+
# relative path from spec_dir
|
115
|
+
spec_files:
|
116
|
+
- "**/*[Ss]pec.{js,coffee}"
|
117
|
+
YAML
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
83
121
|
end
|
84
122
|
end
|
@@ -8,6 +8,7 @@ namespace :spec do
|
|
8
8
|
|
9
9
|
desc "run test with phantomjs"
|
10
10
|
task :javascript => :environment do
|
11
|
+
Rails.application.config.assets.debug = false
|
11
12
|
require 'jasmine_rails/offline_asset_paths'
|
12
13
|
ActionView::AssetPaths.send :include, JasmineRails::OfflineAssetPaths
|
13
14
|
spec_filter = ENV['SPEC']
|
@@ -15,7 +16,7 @@ namespace :spec do
|
|
15
16
|
path = JasmineRails.route_path
|
16
17
|
app.get path, :console => 'true', :spec => spec_filter
|
17
18
|
JasmineRails::OfflineAssetPaths.disabled = true
|
18
|
-
raise "
|
19
|
+
raise "Jasmine runner at '#{path}' returned a #{app.response.status} error: #{app.response.message}" unless app.response.success?
|
19
20
|
html = app.response.body
|
20
21
|
runner_path = Rails.root.join('spec/tmp/runner.html')
|
21
22
|
File.open(runner_path, 'w') {|f| f << html}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-04-
|
14
|
+
date: 2013-04-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 1.8.
|
96
|
+
rubygems_version: 1.8.23
|
97
97
|
signing_key:
|
98
98
|
specification_version: 3
|
99
99
|
summary: Makes Jasmine easier on Rails 3.1
|