jasmine-rails 0.9.1 → 0.10.0
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.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/generators/jasmine_rails/templates/jasmine.yml +12 -0
- data/lib/jasmine-rails.rb +6 -0
- data/lib/jasmine_rails/engine.rb +1 -2
- data/lib/jasmine_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bb3d0009773d52513eb3f461c924259f7b3de17
|
4
|
+
data.tar.gz: 3afa1cc359b3e9311513db6bb6c5b6c77bd9ac00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7338361f1cd63831da86d7da3ed272345cb4594598c1836250d940173bbc4fe6a7017e8fa9d29e6caf9736cce3a8426c60b896941c6149e08e8a604332b7d4fb
|
7
|
+
data.tar.gz: be2a4139cf4d24bf418e837b85140eb26b2ab0865bf77670d9d6019c4b99eb48976a766545dfaf3c39b87e27c4e681293ce4ccaa506f74c13f5c7d3d45c18298
|
data/README.md
CHANGED
@@ -75,6 +75,30 @@ describe('Foo', function() {
|
|
75
75
|
```
|
76
76
|
\*As noted above, spec_helper and foo.js must be required in order for foo_spec.js to run.
|
77
77
|
|
78
|
+
## Spec files in engine
|
79
|
+
|
80
|
+
If you have an engine mounted in your project and you need to test the engine's javascript files,
|
81
|
+
you can instruct jasmine to include and run the spec files from that engine directory.
|
82
|
+
|
83
|
+
Given your main project is located in `/workspace/my_project` and your engine in `/workspace/engine`,
|
84
|
+
you can add the following in the the `jasmine.yml` file:
|
85
|
+
|
86
|
+
```yaml
|
87
|
+
spec_dir:
|
88
|
+
- spec/javascripts
|
89
|
+
- ../engine/spec/javascripts
|
90
|
+
```
|
91
|
+
|
92
|
+
## Include javascript from external source
|
93
|
+
|
94
|
+
If you need to test javascript files that are not part of the assets pipeline (i.e if you have a mobile application
|
95
|
+
that resides outside of your rails app) you can add the following in the the `jasmine.yml` file:
|
96
|
+
|
97
|
+
```yaml
|
98
|
+
include_dir:
|
99
|
+
- ../mobile_app/public/js
|
100
|
+
```
|
101
|
+
|
78
102
|
## Running from the command line
|
79
103
|
|
80
104
|
If you were to run:
|
@@ -3,6 +3,12 @@
|
|
3
3
|
# defaults to app/assets/javascripts
|
4
4
|
src_dir: "app/assets/javascripts"
|
5
5
|
|
6
|
+
# path to additional directory of source file that are not part of assets pipeline and need to be included
|
7
|
+
# relative path from Rails.root
|
8
|
+
# defaults to []
|
9
|
+
# include_dir:
|
10
|
+
# - ../mobile_app/public/js
|
11
|
+
|
6
12
|
# path to parent directory of css_files
|
7
13
|
# relative path from Rails.root
|
8
14
|
# defaults to app/assets/stylesheets
|
@@ -19,6 +25,12 @@ css_files:
|
|
19
25
|
|
20
26
|
# path to parent directory of spec_files
|
21
27
|
# relative path from Rails.root
|
28
|
+
#
|
29
|
+
# Alternatively accept an array of directory to include external spec files
|
30
|
+
# spec_dir:
|
31
|
+
# - spec/javascripts
|
32
|
+
# - ../engine/spec/javascripts
|
33
|
+
#
|
22
34
|
# defaults to spec/javascripts
|
23
35
|
spec_dir: spec/javascripts
|
24
36
|
|
data/lib/jasmine-rails.rb
CHANGED
@@ -26,6 +26,11 @@ module JasmineRails
|
|
26
26
|
[paths].flatten.collect { |path| Rails.root.join(path) }
|
27
27
|
end
|
28
28
|
|
29
|
+
def include_dir
|
30
|
+
paths = jasmine_config['include_dir']
|
31
|
+
[paths].flatten.compact.collect { |path| Rails.root.join(path) }
|
32
|
+
end
|
33
|
+
|
29
34
|
def tmp_dir
|
30
35
|
path = jasmine_config['tmp_dir'] || JasmineRails::DEFAULT_TMP_DIR
|
31
36
|
Rails.root.join(path)
|
@@ -103,6 +108,7 @@ module JasmineRails
|
|
103
108
|
path = Rails.root.join('config', 'jasmine.yml')
|
104
109
|
path = Rails.root.join('spec', 'javascripts', 'support', 'jasmine.yml') unless File.exists?(path)
|
105
110
|
initialize_jasmine_config_if_absent(path)
|
111
|
+
require 'yaml'
|
106
112
|
YAML.load_file(path)
|
107
113
|
end
|
108
114
|
end
|
data/lib/jasmine_rails/engine.rb
CHANGED
@@ -5,8 +5,7 @@ module JasmineRails
|
|
5
5
|
isolate_namespace JasmineRails
|
6
6
|
|
7
7
|
initializer :assets do |config|
|
8
|
-
|
9
|
-
JasmineRails.spec_dir.each do |dir|
|
8
|
+
[Jasmine::Core.path, JasmineRails.include_dir, JasmineRails.spec_dir].flatten.compact.each do |dir|
|
10
9
|
Rails.application.config.assets.paths << dir
|
11
10
|
end
|
12
11
|
Rails.application.config.assets.precompile += %w(jasmine.css boot.js jasmine-boot.js json2.js jasmine.js jasmine-html.js jasmine-console-shims.js jasmine-console-reporter.js jasmine-specs.js jasmine-specs.css)
|
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
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|