make_it_so 0.3.7 → 0.3.8

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: 92f2d126f14ae04ea599f4b6546931caa8995714
4
- data.tar.gz: 0c46ad51239dd794558d13552c964e0087aadc1a
3
+ metadata.gz: 51d0207bac62321e5b90ec81fbfb797d6ae10e0f
4
+ data.tar.gz: 9356e6bb0f37c5cb64268e4091c45a75efd20d14
5
5
  SHA512:
6
- metadata.gz: 6424abdf838af71ab9917e0f77478faf8415e5b59d0cf893cd1ef840eea70378f64beef0c67cbd4377253fd9cae3147f17adf61937805766289039d8a35a37b1
7
- data.tar.gz: 5837fdae03041a6c735c326b60dd25a329d9fa76b247e6fc039757d30c22fec5050813744fd884b891ab91b065ef290747a9be241e40f939f29bd234941f96d5
6
+ metadata.gz: 37189a870a810b0acd28d3900a6ded2cfc4f61bcc6ea5756bb900ff5dcb0604b18979d3f3fba9d61befc44fb0b785e8a9178bf6c6601d014edd3d59f2dd17a56
7
+ data.tar.gz: 9ce5bb339871e6604833ab9c155733ee0befbfdb334024535e01b8fcd57468ad1b2b5be17f0431c30c492c72f0ca52b6c71f7ae657d364bf9c1cbf177b00a7f1
@@ -78,6 +78,8 @@ module MakeItSo
78
78
 
79
79
  build 'application_controller'
80
80
  build 'application_record'
81
+ build 'dotenv'
82
+
81
83
  if options[:rspec]
82
84
  build 'rspec_dependency'
83
85
  #build 'fix_generators'
@@ -99,13 +99,15 @@ module MakeItSo
99
99
  'jest',
100
100
  'babel-jest',
101
101
  'enzyme-adapter-react-15.4',
102
- 'react-addons-test-utils'
102
+ 'react-addons-test-utils',
103
+ 'jest-fetch-mock'
103
104
  ]
104
105
  run "yarn add #{deps.join(' ')} --dev"
105
106
 
106
107
  run 'mkdir -p spec/javascript/support'
107
108
  inside 'spec/javascript/support' do
108
109
  template 'enzyme.js'
110
+ template 'jest-fetch-mock.js'
109
111
  end
110
112
 
111
113
  modify_json(package_json_file) do |json|
@@ -114,6 +116,7 @@ module MakeItSo
114
116
  json["scripts"]["test:dev"] = "node_modules/.bin/jest --notify --watch"
115
117
  json["jest"] ||= {}
116
118
  json["jest"].merge!({
119
+ "automock": false,
117
120
  "roots": [
118
121
  "spec/javascript"
119
122
  ],
@@ -122,7 +125,8 @@ module MakeItSo
122
125
  "app/javascript"
123
126
  ],
124
127
  "setupFiles": [
125
- "./spec/javascript/support/enzyme.js"
128
+ "./spec/javascript/support/enzyme.js",
129
+ "./spec/javascript/support/jest-fetch-mock.js"
126
130
  ]
127
131
  })
128
132
  end
@@ -143,6 +147,16 @@ module MakeItSo
143
147
  end
144
148
  end
145
149
 
150
+ def dotenv
151
+ self.gem 'dotenv-rails', group: [:development, :test]
152
+ template '.env'
153
+ template '.env.example'
154
+
155
+ append_to_file '.gitignore' do
156
+ ".env\n"
157
+ end
158
+ end
159
+
146
160
  def rspec_dependency
147
161
  self.gem 'rspec-rails', group: [:development, :test]
148
162
  self.gem 'capybara', group: [:development, :test]
@@ -1,3 +1,3 @@
1
1
  module MakeItSo
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
@@ -237,6 +237,23 @@ feature 'user generates rails app' do
237
237
  end
238
238
  end
239
239
 
240
+ context 'dotenv' do
241
+ it 'adds dotenv-rails to Gemfile' do
242
+ expect(File.read(gemfile_path)).to match(/gem(.*)dotenv-rails/)
243
+ end
244
+
245
+ it 'adds .env to gitignore' do
246
+ expect(File.read(File.join(app_path, '.gitignore'))).to include(".env\n")
247
+ end
248
+
249
+ it 'creates a .env file' do
250
+ expect(FileTest.exists?(File.join(app_path, '.env'))).to eq(true)
251
+ end
252
+
253
+ it 'creates a .env.example file' do
254
+ expect(FileTest.exists?(File.join(app_path, '.env.example'))).to eq(true)
255
+ end
256
+ end
240
257
  end
241
258
 
242
259
  feature 'jest' do
@@ -301,4 +318,11 @@ feature 'jest' do
301
318
  expect(json["jest"]["setupFiles"]).to include('./spec/javascript/support/enzyme.js')
302
319
  end
303
320
  end
321
+
322
+ scenario 'adds spec/javascript/support/jest-fetch-mock.js to setup' do
323
+ in_package_json?(package_json_path) do |json|
324
+ expect(json["jest"]).to_not be_nil
325
+ expect(json["jest"]["setupFiles"]).to include('./spec/javascript/support/jest-fetch-mock.js')
326
+ end
327
+ end
304
328
  end
@@ -0,0 +1,2 @@
1
+ # put all your secure credentials here as environment variables
2
+ # SUPER_SECRET_KEY="abc123"
@@ -0,0 +1,2 @@
1
+ # DOCUMENT YOUR REQUIRED ENV VARIABLES HERE
2
+ # SUPER_SECRET_KEY="abc123"
@@ -0,0 +1 @@
1
+ global.fetch = require('jest-fetch-mock')
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.7
4
+ version: 0.3.8
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-10 00:00:00.000000000 Z
11
+ date: 2018-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -185,6 +185,8 @@ files:
185
185
  - templates/gosu/lib/keys.rb
186
186
  - templates/gosu/readme.md
187
187
  - templates/gosu/spec/spec_helper.rb
188
+ - templates/rails/.env
189
+ - templates/rails/.env.example
188
190
  - templates/rails/.gitkeep
189
191
  - templates/rails/app/controllers/application_controller.rb
190
192
  - templates/rails/app/controllers/homes_controller.rb
@@ -197,6 +199,7 @@ files:
197
199
  - templates/rails/spec/features/user_signs_up_spec.rb
198
200
  - templates/rails/spec/javascript/exampleTest.js
199
201
  - templates/rails/spec/javascript/support/enzyme.js
202
+ - templates/rails/spec/javascript/support/jest-fetch-mock.js
200
203
  - templates/rails/spec/javascript/testHelper.js
201
204
  - templates/rails/spec/support/database_cleaner.rb
202
205
  - templates/rails/spec/support/devise_controller_spec.rb