active_record_model_and_rspec_enhanced_templates 1.1.1 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/active_record_model_and_rspec_enhanced_templates.gemspec +27 -31
- data/lib/templates/active_record/model/model.rb +3 -3
- data/lib/templates/rspec/model/model_spec.rb +3 -10
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9f34e84fdc2fa0622dbbccea20cd6ad720b9b583a32e88e0cdc7c774abe73d8d
|
4
|
+
data.tar.gz: 8cffbae2ad3719d3dacf1bcc94fff6dc2c6ff12fa809a8c415ae17cf55a99ff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bcd1264691ab7a46f2e43b70a2e7201cb8339e240747151392b8d29f111b82fe6993d2dc8c4f1d7cf29495e504dbe943dc6eeed7a7d57431e29bdeb4ea1adb8
|
7
|
+
data.tar.gz: e30701ddf869851b82308398fc6428d42eea60033fa0ca89866fbe6c58354c69db85732389a476653355e5fc85304e6b82c758bcc01cc5143612e30c119fa4f3
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -21,6 +21,7 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.description = %Q{ActiveRecord generator and RSpec templates that add some basic functionality to the model and its spec}
|
22
22
|
gem.email = "dima@koulikoff.ru"
|
23
23
|
gem.authors = ["Dmitri Koulikoff"]
|
24
|
+
gem.version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
24
25
|
# dependencies defined in Gemfile
|
25
26
|
end
|
26
27
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4
|
@@ -2,18 +2,18 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: active_record_model_and_rspec_enhanced_templates 1.
|
5
|
+
# stub: active_record_model_and_rspec_enhanced_templates 1.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name = "active_record_model_and_rspec_enhanced_templates"
|
9
|
-
s.version = "1.
|
8
|
+
s.name = "active_record_model_and_rspec_enhanced_templates".freeze
|
9
|
+
s.version = "1.4"
|
10
10
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Dmitri Koulikoff"]
|
14
|
-
s.date = "
|
15
|
-
s.description = "ActiveRecord generator and RSpec templates that add some basic functionality to the model and its spec"
|
16
|
-
s.email = "dima@koulikoff.ru"
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["Dmitri Koulikoff".freeze]
|
14
|
+
s.date = "2020-06-08"
|
15
|
+
s.description = "ActiveRecord generator and RSpec templates that add some basic functionality to the model and its spec".freeze
|
16
|
+
s.email = "dima@koulikoff.ru".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
19
19
|
"README.rdoc"
|
@@ -33,33 +33,29 @@ Gem::Specification.new do |s|
|
|
33
33
|
"spec/active_record_model_and_rspec_enhanced_templates_spec.rb",
|
34
34
|
"spec/spec_helper.rb"
|
35
35
|
]
|
36
|
-
s.homepage = "http://github.com/dima4p/active_record_model_and_rspec_enhanced_templates"
|
37
|
-
s.licenses = ["MIT"]
|
38
|
-
s.rubygems_version = "
|
39
|
-
s.summary = "ActiveRecord generator and RSpec templates that add some basic functionality"
|
36
|
+
s.homepage = "http://github.com/dima4p/active_record_model_and_rspec_enhanced_templates".freeze
|
37
|
+
s.licenses = ["MIT".freeze]
|
38
|
+
s.rubygems_version = "3.1.2".freeze
|
39
|
+
s.summary = "ActiveRecord generator and RSpec templates that add some basic functionality".freeze
|
40
40
|
|
41
41
|
if s.respond_to? :specification_version then
|
42
42
|
s.specification_version = 4
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
52
|
-
s.add_dependency(%q<rdoc>, ["~> 4.1"])
|
53
|
-
s.add_dependency(%q<bundler>, ["~> 1.6"])
|
54
|
-
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
55
|
-
s.add_dependency(%q<simplecov>, ["~> 0.0"])
|
56
|
-
end
|
45
|
+
if s.respond_to? :add_runtime_dependency then
|
46
|
+
s.add_development_dependency(%q<rake>.freeze, ["~> 11.0"])
|
47
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.1"])
|
48
|
+
s.add_development_dependency(%q<rdoc>.freeze, ["~> 4.1"])
|
49
|
+
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.6"])
|
50
|
+
s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
51
|
+
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.0"])
|
57
52
|
else
|
58
|
-
s.add_dependency(%q<
|
59
|
-
s.add_dependency(%q<
|
60
|
-
s.add_dependency(%q<
|
61
|
-
s.add_dependency(%q<
|
62
|
-
s.add_dependency(%q<
|
53
|
+
s.add_dependency(%q<rake>.freeze, ["~> 11.0"])
|
54
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.1"])
|
55
|
+
s.add_dependency(%q<rdoc>.freeze, ["~> 4.1"])
|
56
|
+
s.add_dependency(%q<bundler>.freeze, ["~> 1.6"])
|
57
|
+
s.add_dependency(%q<jeweler>.freeze, ["~> 2.0"])
|
58
|
+
s.add_dependency(%q<simplecov>.freeze, ["~> 0.0"])
|
63
59
|
end
|
64
60
|
end
|
65
61
|
|
@@ -5,16 +5,16 @@ class <%= class_name %> < <%= parent_class_name.classify %>
|
|
5
5
|
<% if attributes.any?(&:reference?) -%>
|
6
6
|
|
7
7
|
<% attributes.select(&:reference?).each do |attribute| -%>
|
8
|
-
belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %>
|
8
|
+
belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.respond_to?(:polymorphic?) and attribute.polymorphic? %><%= ', required: true' if attribute.respond_to?(:required?) and attribute.required? %>
|
9
9
|
<% end -%>
|
10
10
|
<% end -%>
|
11
|
-
<% if attributes.any?(&:token?) -%>
|
11
|
+
<% if attributes.first.respond_to?(:token) and attributes.any?(&:token?) -%>
|
12
12
|
|
13
13
|
<% attributes.select(&:token?).each do |attribute| -%>
|
14
14
|
has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
|
15
15
|
<% end -%>
|
16
16
|
<% end -%>
|
17
|
-
<% if attributes.any?(&:password_digest?) -%>
|
17
|
+
<% if (attributes.any?(&:password_digest?) rescue false) -%>
|
18
18
|
|
19
19
|
has_secure_password
|
20
20
|
<% end -%>
|
@@ -7,8 +7,8 @@ require 'spec_helper'
|
|
7
7
|
<% module_namespacing do -%>
|
8
8
|
describe <%= class_name %>, type: :model do
|
9
9
|
|
10
|
-
<% if options[:fixture_replacement] == :
|
11
|
-
subject { create :<%= singular_name %> }
|
10
|
+
<% if options[:fixture_replacement] == :factory_bot -%>
|
11
|
+
subject(:<%= singular_name %>) { create :<%= singular_name %> }
|
12
12
|
<% else -%>
|
13
13
|
before :each do
|
14
14
|
@valid_attrs = {
|
@@ -19,7 +19,7 @@ describe <%= class_name %>, type: :model do
|
|
19
19
|
<% end -%>
|
20
20
|
|
21
21
|
describe 'validations' do
|
22
|
-
it {
|
22
|
+
it { is_expected.to be_valid }
|
23
23
|
end # validations
|
24
24
|
|
25
25
|
<% if attribute = attributes.detect{|a| a.name == 'position'} || attributes.detect{|a| a.name == 'name'} || attributes.detect{|a| a.name == 'title'} || attributes.first -%>
|
@@ -27,13 +27,6 @@ describe <%= class_name %>, type: :model do
|
|
27
27
|
describe 'scopes' do
|
28
28
|
describe '.ordered' do
|
29
29
|
it 'orders the records of <%= class_name %> by :<%=attribute.name %>' do
|
30
|
-
<% if options[:fixture_replacement] == :factory_girl -%>
|
31
|
-
create :<%= singular_name %>
|
32
|
-
create :<%= singular_name %>
|
33
|
-
<% else -%>
|
34
|
-
<%= class_name %>.create @valid_attrs
|
35
|
-
<%= class_name %>.create @valid_attrs
|
36
|
-
<% end -%>
|
37
30
|
expect(<%= class_name %>.ordered).to eq <%= class_name %>.order(:<%=attribute.name %>)
|
38
31
|
end
|
39
32
|
end # .ordered
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_model_and_rspec_enhanced_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitri Koulikoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '11.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '11.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
135
|
- !ruby/object:Gem::Version
|
122
136
|
version: '0'
|
123
137
|
requirements: []
|
124
|
-
|
125
|
-
rubygems_version: 2.5.1
|
138
|
+
rubygems_version: 3.1.2
|
126
139
|
signing_key:
|
127
140
|
specification_version: 4
|
128
141
|
summary: ActiveRecord generator and RSpec templates that add some basic functionality
|