model_base_generators 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 +4 -4
- data/.commit_template +35 -0
- data/example/spec/support/devise.rb +6 -4
- data/lib/generators/model_base/install_generator.rb +10 -8
- data/lib/generators/model_base/templates/spec/factories/users.rb +2 -2
- data/lib/generators/model_base/templates/spec/support/controller_macros.rb +3 -3
- data/lib/generators/model_base/templates/spec/support/devise.rb +7 -5
- data/lib/model_base/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2050a07f362b1b5070054ffd7666cf99003c3097
|
4
|
+
data.tar.gz: 60836c74021de139a972d2f852e0dc71c60f2a06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4325099dbdd0a0250333ad61d72c4e843cfff1833784aa5c905a679646a2a5f8fb48a102491bccf88ac42e2b95e8104bf4a2adcf6062e15183eceea6e015453d
|
7
|
+
data.tar.gz: f95feaa7614f4db2b6774e2d487b804df43f033eedb215179d16d2d14f0a0701947a627d2b570940b99e1d76ba9edc5cf6ece3b8e0ec482f37786dec975c7b7f
|
data/.commit_template
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
# ==== Emojis ====
|
4
|
+
# ✏️ :pencil2: ドキュメント追加
|
5
|
+
# 🐛 :bug: バグ修正
|
6
|
+
# 👍 :+1: 機能改善
|
7
|
+
# ✨ :sparkles: 部分的な機能追加
|
8
|
+
# 🎉 :tada: 盛大に祝うべき大きな機能追加
|
9
|
+
# ♻️ :recycle: リファクタリング
|
10
|
+
# 🚿 :shower: 不要な機能・使われなくなった機能の削除
|
11
|
+
# 💚 :green_heart: テストやCIの修正・改善
|
12
|
+
# 👕 :shirt: Lintエラーの修正やコードスタイルの修正
|
13
|
+
# 🚀 :rocket: パフォーマンス改善
|
14
|
+
# 🆙 :up: 依存パッケージなどのアップデート
|
15
|
+
# 🔒 :lock: 新機能の公開範囲の制限
|
16
|
+
# 👮 :cop: セキュリティ関連の改善
|
17
|
+
|
18
|
+
|
19
|
+
# ==== Format ====
|
20
|
+
# :emoji: Subject
|
21
|
+
#
|
22
|
+
# Commit body...
|
23
|
+
|
24
|
+
# ==== The Seven Rules ====
|
25
|
+
# 1. Separate subject from body with a blank line
|
26
|
+
# 2. Limit the subject line to 50 characters
|
27
|
+
# 3. Capitalize the subject line
|
28
|
+
# 4. Do not end the subject line with a period
|
29
|
+
# 5. Use the imperative mood in the subject line
|
30
|
+
# 6. Wrap the body at 72 characters
|
31
|
+
# 7. Use the body to explain what and why vs. how
|
32
|
+
#
|
33
|
+
# How to Write a Git Commit Message http://chris.beams.io/posts/git-commit/
|
34
|
+
|
35
|
+
# for http://memo.goodpatch.co/2016/07/beautiful-commits-with-emojis/
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-(and-RSpec)
|
3
3
|
RSpec.configure do |config|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
[:controller, :view].each do |t|
|
5
|
+
config.with_options(type: t) do |c|
|
6
|
+
c.include Devise::Test::ControllerHelpers
|
7
|
+
c.include ControllerMacros
|
8
|
+
c.extend ControllerMacros
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
# For request spec
|
@@ -6,15 +6,17 @@ module ModelBase
|
|
6
6
|
|
7
7
|
desc "Generate files to work with model_base"
|
8
8
|
|
9
|
+
FILES = [
|
10
|
+
'app/controllers/concerns/authentication.rb',
|
11
|
+
'spec/factories/users.rb',
|
12
|
+
'spec/support/controller_macros.rb',
|
13
|
+
'spec/support/devise.rb',
|
14
|
+
'spec/support/field_assertions.rb',
|
15
|
+
'spec/support/time_match_support.rb',
|
16
|
+
].freeze
|
17
|
+
|
9
18
|
def generate_files
|
10
|
-
|
11
|
-
'app/controllers/concerns/authentication.rb',
|
12
|
-
'spec/factories/users.rb',
|
13
|
-
'spec/support/controller_macros.rb',
|
14
|
-
'spec/support/devise.rb',
|
15
|
-
'spec/support/field_assertions.rb',
|
16
|
-
'spec/support/time_match_support.rb',
|
17
|
-
].each{|f| template f, f }
|
19
|
+
FILES.each{|f| template f, f }
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
<%- end -%>
|
4
4
|
FactoryGirl.define do
|
5
5
|
factory :user do
|
6
|
-
email
|
6
|
+
email 'user1@example.com'
|
7
7
|
before(:create) do |u|
|
8
|
-
u.password = u.password_confirmation =
|
8
|
+
u.password = u.password_confirmation = 'password'
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%- end -%>
|
4
4
|
module ControllerMacros
|
5
5
|
def devise_login(key, user)
|
6
|
-
@request.env[
|
6
|
+
@request.env['devise.mapping'] = Devise.mappings[key]
|
7
7
|
sign_in(user)
|
8
8
|
end
|
9
9
|
|
@@ -12,10 +12,10 @@ module ControllerMacros
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def login_admin
|
15
|
-
before(:each){ devise_login(:admin, FactoryGirl.create(:admin)) }
|
15
|
+
before(:each) { devise_login(:admin, FactoryGirl.create(:admin)) }
|
16
16
|
end
|
17
17
|
|
18
18
|
def login_user
|
19
|
-
before(:each){ devise_login(:user, FactoryGirl.create(:user)) }
|
19
|
+
before(:each) { devise_login(:user, FactoryGirl.create(:user)) }
|
20
20
|
end
|
21
21
|
end
|
@@ -3,16 +3,18 @@
|
|
3
3
|
<%- end -%>
|
4
4
|
# https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-(and-RSpec)
|
5
5
|
RSpec.configure do |config|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
[:controller, :view].each do |t|
|
7
|
+
config.with_options(type: t) do |c|
|
8
|
+
c.include Devise::Test::ControllerHelpers
|
9
|
+
c.include ControllerMacros
|
10
|
+
c.extend ControllerMacros
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
14
|
# For request spec
|
13
15
|
# https://github.com/plataformatec/devise/wiki/How-To:-Test-with-Capybara
|
14
16
|
# http://qiita.com/gakkie/items/40e5678af7b63afc14df
|
15
|
-
config.include Warden::Test::Helpers, :
|
17
|
+
config.include Warden::Test::Helpers, type: :request
|
16
18
|
config.before :suite do
|
17
19
|
Warden.test_mode!
|
18
20
|
end
|
data/lib/model_base/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_base_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -116,6 +116,7 @@ executables:
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
+
- ".commit_template"
|
119
120
|
- ".gitignore"
|
120
121
|
- ".rspec"
|
121
122
|
- ".travis.yml"
|