importmap_mocha-rails 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86ad7a8af87278157916f9355aa84c1eec7564969abaf41335585f667bdc815b
4
- data.tar.gz: 52c7eb3feaafa2f2c3dbefebe343edbe29863bf13d404a56242b13a1604b5dce
3
+ metadata.gz: e2388d036fdd25a99fc77e9cc413445cd9c8ddea2907191c9c3845dece76ef66
4
+ data.tar.gz: a6866270afd51bde1557343d5dff4dc766b27eac94ccf6f4f21810d98762fd89
5
5
  SHA512:
6
- metadata.gz: 298fce026b6f26defde4dd2ec9b23b2a0314b4b803cb719833594fdc47ef2b54307ee0afb2346110bc7f4c3e241b78d11b17c4055ef06e38af07dc7a1896cb6d
7
- data.tar.gz: 147026a848c6ce0d2d2901c38b5fbf88e72c8e3f864fc00d21885f7cf096537e358386bfc91b625975720d4d9fb6d6b8f99f50923d3521f9a640e65fdb1f2767
6
+ metadata.gz: 299fc3a872ce6a8fbcde9c158af2c665f8599455e7574456538bd1bff1b89026e8309589191518825dbcbe32233cace2c5b9949c18cf96f420753b3e079fda9c
7
+ data.tar.gz: dc0352d3e1d13feb44dba890569af26b07230eef0578cb95060417d9a4efd8348c211d407f1bd8c7104672a3d9ad83d84f8ef7b293de26e20307517319a02b63
data/README.md CHANGED
@@ -77,6 +77,8 @@ describe('clear controller', () => {
77
77
  });
78
78
  ```
79
79
 
80
+ ![screenshot](./images/screenshot01.png)
81
+
80
82
  # Configuration
81
83
 
82
84
  * config.importmap_mocha_style: The style of the test code, `"bdd"` or `"tdd"`. Default is `"bdd"`.
@@ -0,0 +1,16 @@
1
+ pin "importmap_mocha"
2
+
3
+ pin "@mswjs/interceptors", to: "@mswjs--interceptors.js"
4
+ pin "@mswjs/interceptors/presets/browser" , to: "@mswjs--interceptors--presets--browser.js"
5
+ pin "chai", to: "chai.js"
6
+
7
+ pin "@open-draft/logger", to: "@open-draft--logger.js" # @0.3.0
8
+ pin "is-node-process", to: "is-node-process.js" # @1.2.0
9
+ pin "outvariant", to: "outvariant.js" # @1.4.0
10
+ pin "@open-draft/until", to: "@open-draft--until.js" # @2.1.0
11
+ pin "@open-draft/deferred-promise", to: "@open-draft--deferred-promise.js" # @2.2.0
12
+ pin "strict-event-emitter", to: "strict-event-emitter.js" # @0.5.1
13
+
14
+ Rails.application.config.importmap_mocha_path.each do |path|
15
+ pin_all_from path
16
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ImportmapMocha
4
+ class Engine < ::Rails::Engine
5
+ config.before_initialize do
6
+ Rails.application.config.importmap_mocha_path = []
7
+ %w[test spec].each do |d|
8
+ path = Rails.root.join(d, 'javascripts')
9
+ Rails.application.config.importmap_mocha_path << path if path.exist?
10
+ end
11
+ end
12
+
13
+ initializer 'importmap_mocha.assets' do
14
+ if Rails.application.config.respond_to?(:assets)
15
+ Rails.application.config.assets.paths << Engine.root.join('app/assets/javascripts')
16
+ Rails.application.config.assets.paths << Engine.root.join('app/assets/stylesheets')
17
+ Rails.application.config.assets.paths << Engine.root.join('vendor/javascripts')
18
+ Rails.application.config.assets.paths << Engine.root.join('vendor/stylesheets')
19
+ Rails.application.config.assets.paths += Rails.application.config.importmap_mocha_path
20
+ end
21
+ end
22
+
23
+ PRECOMPILE_ASSETS = %w[importmap_mocha.js chai.js mocha.js mocha.css].freeze
24
+
25
+ initializer 'turbo.assets' do
26
+ Rails.application.config.assets.precompile += PRECOMPILE_ASSETS if Rails.application.config.respond_to?(:assets)
27
+ end
28
+
29
+ initializer 'importmap_mocha.importmap', before: 'importmap' do |app|
30
+ app.config.importmap.paths << Engine.root.join('config/importmap.rb') if Rails.application.respond_to?(:importmap)
31
+ end
32
+
33
+ initializer "importmap_mocha.cache_sweeper", before: "importmap.cache_sweeper" do |app|
34
+ if app.config.importmap.sweep_cache && !app.config.cache_classes
35
+ app.config.importmap.cache_sweepers << Engine.root.join('app/assets/javascripts')
36
+ app.config.importmap.cache_sweepers << Engine.root.join('vendor/javascripts')
37
+ app.config.importmap.cache_sweepers += Rails.application.config.importmap_mocha_path
38
+ end
39
+ end
40
+
41
+
42
+ initializer 'importmap_mocha.routes' do
43
+ Rails.application.routes.prepend do
44
+ scope module: 'importmap_mocha' do
45
+ get '/rails/info/mocha' => 'test#index'
46
+ end
47
+ end
48
+ end
49
+
50
+ initializer 'importmap_mocha.config' do
51
+ unless Rails.application.config.respond_to?(:importmap_mocha_style)
52
+ Rails.application.config.importmap_mocha_style = 'bdd'
53
+ end
54
+ unless Rails.application.config.respond_to?(:importmap_mocha_scripts)
55
+ Rails.application.config.importmap_mocha_scripts = []
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ImportmapMocha
4
+ VERSION = '0.3.3'
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'importmap_mocha/version'
2
+ require 'importmap_mocha/engine'
3
+
4
+ module ImportmapMocha
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :importmap_mocha_rails do
3
+ # # Task goes here
4
+ # end