kuppayam 0.1.29 → 0.1.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/kuppayam/templates/spec/controllers/resource_controller_spec.rb +18 -18
- data/lib/generators/kuppayam/templates/spec/factories/resource.rb +1 -1
- data/lib/generators/kuppayam/templates/spec/models/resource_spec.rb +5 -5
- data/lib/kuppayam/action_view/form_helper.rb +3 -3
- data/lib/kuppayam/engine.rb +1 -1
- data/lib/kuppayam/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4998ab221ce7a37eeaa2da7f93e5100d626c407b
|
4
|
+
data.tar.gz: f7c4613e52dc060d0f0dea1f190728cb02971d8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a629e6f1954c5812e734dd641aa324a3c011ec4af6ca58fedbcba8b1d4a227714574db288c47e92d17cc1301427616618994ddcb88128dc5e15567fdfeeb74d
|
7
|
+
data.tar.gz: e9d20ca257f99469c3da36da0e940ad0e18cf48f58cb5f5b5827c0c95098b6034dae12385805d6cd1c07734e2375b303869b2d0ce096f338b46d9b0f998c0b29
|
@@ -4,28 +4,28 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe <%= controller_class -%>, :type => :controller do
|
6
6
|
|
7
|
-
let(:user) {
|
8
|
-
let(:suspended_user) {
|
7
|
+
let(:user) {FactoryBot.create(:user)}
|
8
|
+
let(:suspended_user) {FactoryBot.create(:suspended_user)}
|
9
9
|
|
10
|
-
let(:site_role) {
|
10
|
+
let(:site_role) {FactoryBot.create(:role, name: "Site Admin")}
|
11
11
|
|
12
|
-
let(:super_admin_user) {
|
12
|
+
let(:super_admin_user) {FactoryBot.create(:super_admin_user)}
|
13
13
|
let(:site_admin_user) {
|
14
14
|
site_role
|
15
|
-
user =
|
15
|
+
user = FactoryBot.create(:approved_user)
|
16
16
|
user.add_role("Site Admin")
|
17
17
|
user
|
18
18
|
}
|
19
|
-
let(:approved_user) {
|
19
|
+
let(:approved_user) {FactoryBot.create(:approved_user)}
|
20
20
|
|
21
|
-
let(:published_<%= instance_name %>) {
|
22
|
-
let(:unpublished_<%= instance_name %>) {
|
23
|
-
let(:suspended_<%= instance_name %>) {
|
24
|
-
let(:blocked_<%= instance_name %>) {
|
25
|
-
let(:removed_<%= instance_name %>) {
|
21
|
+
let(:published_<%= instance_name %>) {FactoryBot.create(:published_<%= instance_name %>)}
|
22
|
+
let(:unpublished_<%= instance_name %>) {FactoryBot.create(:unpublished_<%= instance_name %>)}
|
23
|
+
let(:suspended_<%= instance_name %>) {FactoryBot.create(:suspended_<%= instance_name %>)}
|
24
|
+
let(:blocked_<%= instance_name %>) {FactoryBot.create(:blocked_<%= instance_name %>)}
|
25
|
+
let(:removed_<%= instance_name %>) {FactoryBot.create(:removed_<%= instance_name %>)}
|
26
26
|
|
27
27
|
describe "index" do
|
28
|
-
2.times {
|
28
|
+
2.times { FactoryBot.create(:published_<%= instance_name %>) }
|
29
29
|
context "Positive Case" do
|
30
30
|
it "should be able to view the list of countries" do
|
31
31
|
session[:id] = site_admin_user.id
|
@@ -55,7 +55,7 @@ describe <%= controller_class -%>, :type => :controller do
|
|
55
55
|
context "Positive Case" do
|
56
56
|
it "should be update status - publish" do
|
57
57
|
session[:id] = site_admin_user.id
|
58
|
-
unpublished_<%= instance_name %> =
|
58
|
+
unpublished_<%= instance_name %> = FactoryBot.create(:unpublished_<%= instance_name %>)
|
59
59
|
put :update_status, params: { use_route: 'dhatu', id: unpublished_<%= instance_name %>.id, status: :published }, xhr: true
|
60
60
|
unpublished_<%= instance_name %>.reload
|
61
61
|
expect(unpublished_<%= instance_name %>.published?).to be_truthy
|
@@ -64,7 +64,7 @@ describe <%= controller_class -%>, :type => :controller do
|
|
64
64
|
|
65
65
|
it "should be update status - unpublish" do
|
66
66
|
session[:id] = site_admin_user.id
|
67
|
-
published_<%= instance_name %> =
|
67
|
+
published_<%= instance_name %> = FactoryBot.create(:published_<%= instance_name %>)
|
68
68
|
put :update_status, params: { use_route: 'dhatu', id: published_<%= instance_name %>.id, status: :unpublished }, xhr: true
|
69
69
|
published_<%= instance_name %>.reload
|
70
70
|
expect(published_<%= instance_name %>.unpublished?).to be_truthy
|
@@ -73,7 +73,7 @@ describe <%= controller_class -%>, :type => :controller do
|
|
73
73
|
|
74
74
|
it "should be update status - remove" do
|
75
75
|
session[:id] = site_admin_user.id
|
76
|
-
unpublished_<%= instance_name %> =
|
76
|
+
unpublished_<%= instance_name %> = FactoryBot.create(:unpublished_<%= instance_name %>)
|
77
77
|
put :update_status, params: { use_route: 'dhatu', id: unpublished_<%= instance_name %>.id, status: :removed }, xhr: true
|
78
78
|
unpublished_<%= instance_name %>.reload
|
79
79
|
expect(unpublished_<%= instance_name %>.removed?).to be_truthy
|
@@ -82,7 +82,7 @@ describe <%= controller_class -%>, :type => :controller do
|
|
82
82
|
|
83
83
|
it "should be update status - archive" do
|
84
84
|
session[:id] = site_admin_user.id
|
85
|
-
unpublished_<%= instance_name %> =
|
85
|
+
unpublished_<%= instance_name %> = FactoryBot.create(:unpublished_<%= instance_name %>)
|
86
86
|
put :update_status, params: { use_route: 'dhatu', id: unpublished_<%= instance_name %>.id, status: :archived }, xhr: true
|
87
87
|
unpublished_<%= instance_name %>.reload
|
88
88
|
expect(unpublished_<%= instance_name %>.archived?).to be_truthy
|
@@ -115,7 +115,7 @@ describe <%= controller_class -%>, :type => :controller do
|
|
115
115
|
context "Positive Case" do
|
116
116
|
it "site admin should be able to create a region" do
|
117
117
|
session[:id] = site_admin_user.id
|
118
|
-
<%= instance_name %>_params =
|
118
|
+
<%= instance_name %>_params = FactoryBot.build(:unpublished_<%= instance_name %>, name: "Some Name").attributes
|
119
119
|
expect do
|
120
120
|
post :create, params: { use_route: 'dhatu', "<%= instance_name %>": <%= instance_name %>_params }, xhr: true
|
121
121
|
end.to change(<%= model_class -%>, :count).by(1)
|
@@ -128,7 +128,7 @@ describe <%= controller_class -%>, :type => :controller do
|
|
128
128
|
context "Positive Case" do
|
129
129
|
it "site admin should be able to update a <%= instance_name %>" do
|
130
130
|
session[:id] = site_admin_user.id
|
131
|
-
published_<%= instance_name %> =
|
131
|
+
published_<%= instance_name %> = FactoryBot.create(:published_<%= instance_name %>, title: "Some Title")
|
132
132
|
<%= instance_name %>_params = published_<%= instance_name %>.attributes.clone
|
133
133
|
<%= instance_name %>_params["title"] = "Changed Title"
|
134
134
|
expect do
|
@@ -2,14 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe <%= model_class %>, type: :model do
|
4
4
|
|
5
|
-
let(:<%= instance_name %>) {
|
5
|
+
let(:<%= instance_name %>) {FactoryBot.build(:<%= instance_name %>)}
|
6
6
|
|
7
7
|
context "Factory" do
|
8
8
|
it "should validate all the factories" do
|
9
|
-
expect(
|
10
|
-
expect(
|
11
|
-
expect(
|
12
|
-
expect(
|
9
|
+
expect(FactoryBot.build(:published_<%= instance_name %>).valid?).to be true
|
10
|
+
expect(FactoryBot.build(:unpublished_<%= instance_name %>).valid?).to be true
|
11
|
+
expect(FactoryBot.build(:removed_<%= instance_name %>).valid?).to be true
|
12
|
+
expect(FactoryBot.build(:archived_<%= instance_name %>).valid?).to be true
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -198,7 +198,7 @@ module Kuppayam
|
|
198
198
|
object_name: object.class.name.underscore,
|
199
199
|
required: true,
|
200
200
|
label: foreign_key.to_s.titleize,
|
201
|
-
prompt: "Select",
|
201
|
+
prompt: "Please Select",
|
202
202
|
editable: true,
|
203
203
|
error_class: "has-error",
|
204
204
|
form_style: "left-right"
|
@@ -222,12 +222,12 @@ module Kuppayam
|
|
222
222
|
end
|
223
223
|
|
224
224
|
selected_id = object.send(foreign_key)
|
225
|
-
|
225
|
+
|
226
226
|
theme_form_group(options[:label], required: options[:required], error_class: error_class, form_style: options[:form_style]) do
|
227
227
|
if !options[:editable] && options[:assoc_object]
|
228
228
|
raw(options[:assoc_object].send(options[:assoc_display_method]) + hidden_field_tag("#{options[:param_name]}[#{foreign_key}]", options[:assoc_object].id))
|
229
229
|
else
|
230
|
-
collection_select(options[:object_name], foreign_key, options[:assoc_collection], :id, options[:assoc_display_method], {
|
230
|
+
collection_select(options[:object_name], foreign_key, options[:assoc_collection], :id, options[:assoc_display_method], {include_blank: options[:include_blank], selected: selected_id}, {:class => 'form-control'})
|
231
231
|
end + error_message
|
232
232
|
end
|
233
233
|
end
|
data/lib/kuppayam/engine.rb
CHANGED
@@ -30,7 +30,7 @@ module Kuppayam
|
|
30
30
|
|
31
31
|
config.generators do |g|
|
32
32
|
g.test_framework :rspec, :fixture => false
|
33
|
-
g.fixture_replacement :
|
33
|
+
g.fixture_replacement :factory_bot, :dir => 'spec/factories'
|
34
34
|
g.assets false
|
35
35
|
g.helper false
|
36
36
|
end
|
data/lib/kuppayam/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuppayam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kpvarma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -277,7 +277,7 @@ dependencies:
|
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: 2.4.3
|
279
279
|
- !ruby/object:Gem::Dependency
|
280
|
-
name:
|
280
|
+
name: factory_bot_rails
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|
282
282
|
requirements:
|
283
283
|
- - "~>"
|