model_base_generators 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/app/controllers/projects_controller.rb +1 -1
- data/example/app/views/projects/_form.html.erb +7 -0
- data/example/app/views/projects/_table.html.erb +2 -0
- data/example/app/views/projects/show.html.erb +2 -0
- data/example/db/schema.rb +1 -0
- data/example/spec/controllers/projects_controller_spec.rb +3 -1
- data/example/spec/factories/projects.rb +1 -0
- data/example/spec/views/projects/edit.html.erb_spec.rb +1 -0
- data/example/spec/views/projects/index.html.erb_spec.rb +1 -0
- data/example/spec/views/projects/new.html.erb_spec.rb +1 -0
- data/example/spec/views/projects/show.html.erb_spec.rb +1 -0
- data/lib/model_base/column_attribute.rb +2 -0
- data/lib/model_base/version.rb +1 -1
- data/lib/templates/rspec/scaffold/index_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 377e6ba19f399cf524fa5c25a8fa56c983724462
|
4
|
+
data.tar.gz: c7a89884e9ab54a5e4edacf078aa25f2ad9a28eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c67f7275d7db7d492b66c2b825909f8bc3933088a4b66caf16f7af5491fd63a33484c19bfae33fbd0c1e1a5151848d2ca52dabf3bb8a25b82bc4da2805d848c
|
7
|
+
data.tar.gz: e3fcc7532cc2ea27e36b7c49b2f1ac9fa828b878d634e70e9739f1d2124caa7ed62b11cbec3c9f96bf5d345c8cf23702f0e85782f5f2a48ad3ec137527d1ea4e
|
@@ -29,6 +29,13 @@
|
|
29
29
|
</div>
|
30
30
|
<%=f.error_span(:name) %>
|
31
31
|
</div>
|
32
|
+
<div class="form-group">
|
33
|
+
<%= f.label :closed, :class => 'control-label col-lg-2' %>
|
34
|
+
<div class="col-lg-10">
|
35
|
+
<%= f.check_box :closed, :class => 'form-control' %>
|
36
|
+
</div>
|
37
|
+
<%=f.error_span(:closed) %>
|
38
|
+
</div>
|
32
39
|
|
33
40
|
<div class="form-group">
|
34
41
|
<div class="col-lg-offset-2 col-lg-10">
|
@@ -4,6 +4,7 @@
|
|
4
4
|
<tr>
|
5
5
|
<th><%= model_class.human_attribute_name(:owner_id) %></th>
|
6
6
|
<th><%= model_class.human_attribute_name(:name) %></th>
|
7
|
+
<th><%= model_class.human_attribute_name(:closed) %></th>
|
7
8
|
<th><%=t '.actions', :default => t("helpers.actions") %></th>
|
8
9
|
</tr>
|
9
10
|
</thead>
|
@@ -12,6 +13,7 @@
|
|
12
13
|
<tr>
|
13
14
|
<td><%= project.owner.email %></td>
|
14
15
|
<td><%= link_to project.name, project_path(project) %></td>
|
16
|
+
<td><%= project.closed %></td>
|
15
17
|
<td>
|
16
18
|
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
17
19
|
edit_project_path(project), :class => 'btn btn-default btn-xs' %>
|
@@ -8,6 +8,8 @@
|
|
8
8
|
<dd><%= @project.owner.email %></dd>
|
9
9
|
<dt><strong><%= model_class.human_attribute_name(:name) %>:</strong></dt>
|
10
10
|
<dd><%= @project.name %></dd>
|
11
|
+
<dt><strong><%= model_class.human_attribute_name(:closed) %>:</strong></dt>
|
12
|
+
<dd><%= @project.closed %></dd>
|
11
13
|
</dl>
|
12
14
|
|
13
15
|
<%= link_to t('.back', :default => t("helpers.links.back")),
|
data/example/db/schema.rb
CHANGED
@@ -19,6 +19,7 @@ ActiveRecord::Schema.define(version: 20161013025452) do
|
|
19
19
|
create_table :projects do |t|
|
20
20
|
t.references :owner, null: false
|
21
21
|
t.string :name , null: false
|
22
|
+
t.boolean :closed, null: false, default: false
|
22
23
|
end
|
23
24
|
add_foreign_key :projects, :users, column: 'owner_id'
|
24
25
|
|
@@ -107,9 +107,10 @@ RSpec.describe ProjectsController, type: :controller do
|
|
107
107
|
describe "PUT #update" do
|
108
108
|
context "with valid params" do
|
109
109
|
let(:new_name){ valid_parameters[:name].succ }
|
110
|
+
let(:new_closed){ valid_parameters[:closed].! }
|
110
111
|
|
111
112
|
let(:new_parameters) {
|
112
|
-
valid_parameters.merge(name: new_name)
|
113
|
+
valid_parameters.merge(name: new_name, closed: new_closed)
|
113
114
|
}
|
114
115
|
|
115
116
|
it "updates the requested project" do
|
@@ -117,6 +118,7 @@ RSpec.describe ProjectsController, type: :controller do
|
|
117
118
|
put :update, params: {:id => project.to_param, :project => new_parameters}, session: valid_session
|
118
119
|
project.reload
|
119
120
|
expect(project.name).to eq new_name
|
121
|
+
expect(project.closed).to eq new_closed
|
120
122
|
end
|
121
123
|
|
122
124
|
it "assigns the requested project as @project" do
|
@@ -12,6 +12,7 @@ RSpec.describe "projects/edit", type: :view do
|
|
12
12
|
assert_select "form[action=?][method=?]", project_path(@project), "post" do
|
13
13
|
assert_select "select#project_owner_id[name=?]", "project[owner_id]"
|
14
14
|
assert_select "input#project_name[name=?]", "project[name]"
|
15
|
+
assert_select "input#project_closed[name=?]", "project[closed]"
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -14,5 +14,6 @@ RSpec.describe "projects/index", type: :view do
|
|
14
14
|
assert_select "tr>td", :text => 'user1@example.com', :count => 2
|
15
15
|
assert_select "tr>td", :text => 'project1', :count => 1
|
16
16
|
assert_select "tr>td", :text => 'project2', :count => 1
|
17
|
+
assert_select "tr>td", :text => 'false', :count => 2
|
17
18
|
end
|
18
19
|
end
|
@@ -12,6 +12,7 @@ RSpec.describe "projects/new", type: :view do
|
|
12
12
|
assert_select "form[action=?][method=?]", projects_path, "post" do
|
13
13
|
assert_select "select#project_owner_id[name=?]", "project[owner_id]"
|
14
14
|
assert_select "input#project_name[name=?]", "project[name]"
|
15
|
+
assert_select "input#project_closed[name=?]", "project[closed]"
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
data/lib/model_base/version.rb
CHANGED
@@ -18,7 +18,7 @@ RSpec.describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
|
|
18
18
|
it "renders a list of <%= ns_table_name %>" do
|
19
19
|
render
|
20
20
|
<% model.columns_for(:spec_index).each do |attribute| -%>
|
21
|
-
<%- if attribute.ref_model || attribute.enumerized? -%>
|
21
|
+
<%- if attribute.ref_model || attribute.enumerized? || attribute.type == :boolean -%>
|
22
22
|
assert_select "tr>td", :text => <%= attribute.sample_string %>, :count => 2
|
23
23
|
<%- else -%>
|
24
24
|
assert_select "tr>td", :text => <%= attribute.sample_string(1) %>, :count => 1
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|