make_it_so 0.3.5 → 0.3.6

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
  SHA1:
3
- metadata.gz: 5e153f1537a2270bb678a3c1bfc143d637775136
4
- data.tar.gz: 56b08bb355ac02b6ef80909c00885ced8b755e64
3
+ metadata.gz: 9b20d622a1f19f90b47cb2843320045304dcb106
4
+ data.tar.gz: d9b9d64f958cce7b2d077cb79948c922c09e0200
5
5
  SHA512:
6
- metadata.gz: f7bb389dd8ebf7a59580b6623a93ba14bc856029161669581190d5c8d22e187d2b56af2c72a809e5f43cc3e11ecdc82cf48941a7ec6b69e27747f6002e884948
7
- data.tar.gz: 62d56568875e7eeeadbe8cf6ff12d7454b9b8badc5ac557a48b61055128bb913ccba578f7f582ad2817f3108d46a03d6768226bceb107393f63c59699fa67883
6
+ metadata.gz: f3a47915eff83ac3273ed7e5c8a7ea659fa3846ac760707931a057c914e6969e340e93732afab5275e1ca6dbff9cd9c448e6c604175455330448033ebe8431de
7
+ data.tar.gz: 9b9c021ebfcda78790c05b187fffb6f83baaef825fea21f3e935cc5875abbc7556656bc0d1fe9c3da02aa2e9b80a0de80720730ee6d3e85200d69351ce1f5474
@@ -95,8 +95,19 @@ module MakeItSo
95
95
 
96
96
  def jest
97
97
  after_bundle do
98
- run 'yarn add jest babel-jest --dev'
99
- run 'mkdir -p spec/javascript'
98
+ deps = [
99
+ 'jest',
100
+ 'babel-jest',
101
+ 'enzyme-adapter-react-15.4',
102
+ 'react-addons-test-utils'
103
+ ]
104
+ run "yarn add #{deps.join(' ')} --dev"
105
+
106
+ run 'mkdir -p spec/javascript/support'
107
+ inside 'spec/javascript/support' do
108
+ template 'enzyme.js'
109
+ end
110
+
100
111
  modify_json(package_json_file) do |json|
101
112
  json["scripts"] ||= {}
102
113
  json["scripts"]["test"] = "node_modules/.bin/jest"
@@ -109,10 +120,25 @@ module MakeItSo
109
120
  "moduleDirectories": [
110
121
  "node_modules",
111
122
  "app/javascript"
123
+ ],
124
+ "setupFiles": [
125
+ "./spec/javascript/support/enzyme.js"
112
126
  ]
113
127
  })
114
128
  end
115
129
 
130
+ modify_json(File.join(destination_root, '.babelrc')) do |json|
131
+ json["env"] ||= {}
132
+ json["env"]["test"] ||= {}
133
+ json["env"]["test"].merge!({
134
+ "env": {
135
+ "test": {
136
+ "presets": ["react", "env"],
137
+ }
138
+ }
139
+ })
140
+ end
141
+
116
142
  rake 'yarn:install'
117
143
  end
118
144
  end
@@ -1,3 +1,3 @@
1
1
  module MakeItSo
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
@@ -290,4 +290,16 @@ feature 'jest' do
290
290
  expect(json["jest"]["moduleDirectories"]).to include("app/javascript")
291
291
  end
292
292
  end
293
+
294
+ scenario 'adds a spec/javascript/support/enzyme.js file' do
295
+ support_file = File.join(app_path, 'spec/javascript/support/enzyme.js')
296
+ expect(FileTest.exists?(support_file)).to eq(true)
297
+ end
298
+
299
+ scenario 'adds spec/javascript/support/enzyme.js to setup' do
300
+ in_package_json?(package_json_path) do |json|
301
+ expect(json["jest"]).to_not be_nil
302
+ expect(json["jest"]["setupFiles"]).to include('./spec/javascript/support/enzyme.js')
303
+ end
304
+ end
293
305
  end
@@ -0,0 +1,6 @@
1
+ const Enzyme = require('enzyme');
2
+
3
+ const EnzymeAdapter = require('enzyme-adapter-react-15.4');
4
+
5
+ Enzyme.configure({ adapter: new EnzymeAdapter() });
6
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: make_it_so
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Pickett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-06 00:00:00.000000000 Z
11
+ date: 2018-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -196,6 +196,7 @@ files:
196
196
  - templates/rails/spec/features/user_signs_out_spec.rb
197
197
  - templates/rails/spec/features/user_signs_up_spec.rb
198
198
  - templates/rails/spec/javascript/exampleTest.js
199
+ - templates/rails/spec/javascript/support/enzyme.js
199
200
  - templates/rails/spec/javascript/testHelper.js
200
201
  - templates/rails/spec/support/database_cleaner.rb
201
202
  - templates/rails/spec/support/devise_controller_spec.rb