jabysoft-bootstrap_generators 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/layouts/admin.html.haml +6 -6
- data/app/views/layouts/application.html.haml +8 -7
- data/app/views/shared/modals/_delete_confirmation.html.haml +0 -1
- data/lib/generators/jabysoft/setup/templates/spec/rails_helper.rb +15 -46
- data/lib/generators/jabysoft/setup/templates/spec/spec_helper.rb +0 -5
- data/lib/jabysoft/bootstrap_generators/version.rb +1 -1
- data/lib/templates/rails/model/model.rb +13 -0
- data/lib/templates/rails/scaffold_controller/controller.rb +9 -0
- data/lib/templates/rspec/scaffold/controller_spec.rb +9 -11
- metadata +3 -3
- data/app/views/shared/_layout.html.haml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a58c22590b7d733f7f04012c5b4f08e8bbb36bfd
|
4
|
+
data.tar.gz: 19e5652454a38537fd6cb24db5374d8dc0bf0385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bfd74f00d9e6f30e3e3888712d3cbde21da394d6524a5ee93d6f624d0ecb04e7dc404a85bdcb5c0b532166937e2857d512ea7532b0ad9a3893adca8b3b00228
|
7
|
+
data.tar.gz: 1129253a2821481aed898d4dd84164c0ea8b639b0e217a20b12f6411faf70f9be491aef23cf822896a37d0bf5e899cdf99c9900036a5b4f8bc0219e7d99c0320
|
@@ -7,15 +7,15 @@
|
|
7
7
|
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
8
8
|
= csrf_meta_tags
|
9
9
|
%body
|
10
|
-
%nav.navbar.navbar-
|
11
|
-
.container
|
10
|
+
%nav.navbar.navbar-inverse.navbar-static-top{role: 'navigation'}
|
11
|
+
.container-fluid
|
12
12
|
= link_to t('title.administration'), admin_root_path, class: 'navbar-brand'
|
13
13
|
|
14
14
|
%button{class: "navbar-toggle", "data-toggle" => "collapse", "data-target" => ".navHeaderCollapse"}
|
15
15
|
%span.glyphicon.glyphicon-th
|
16
16
|
#navbar.collapse.navbar-collapse.navHeaderCollapse
|
17
17
|
%ul.nav.navbar-nav.navbar-left
|
18
|
-
%li= link_to '
|
18
|
+
%li= link_to t('dashboard'), '#'
|
19
19
|
%li= link_to t('about'), '#'
|
20
20
|
%li.dropdown
|
21
21
|
%a.dropdown-toggle{src: '#', "data-toggle" => 'dropdown'}
|
@@ -32,7 +32,7 @@
|
|
32
32
|
%li.user-avatar
|
33
33
|
= image_tag("icons/admin.png")
|
34
34
|
|
35
|
-
.container
|
35
|
+
.container-fluid
|
36
36
|
.row
|
37
37
|
.col-lg-12
|
38
38
|
= render_flash_messages
|
@@ -41,6 +41,6 @@
|
|
41
41
|
= yield
|
42
42
|
|
43
43
|
%footer.navbar.navbar-default.navbar-static-bottom
|
44
|
-
.container
|
44
|
+
.container-fluid
|
45
45
|
%p.navbar-text
|
46
|
-
= "© Admin JabySoft
|
46
|
+
= "© Admin JabySoft #{Date.today.year} All rights reserved".html_safe
|
@@ -7,17 +7,18 @@
|
|
7
7
|
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
8
8
|
= csrf_meta_tags
|
9
9
|
%body
|
10
|
-
%nav.navbar.navbar-
|
11
|
-
.container
|
10
|
+
%nav.navbar.navbar-inverse.navbar-static-top{role: 'navigation'}
|
11
|
+
.container-fluid
|
12
12
|
= link_to t('title.application'), '#', class: 'navbar-brand'
|
13
|
+
|
13
14
|
%button{class: "navbar-toggle", "data-toggle" => "collapse", "data-target" => ".navHeaderCollapse"}
|
14
15
|
%span.glyphicon.glyphicon-th
|
15
16
|
.collapse.navbar-collapse.navHeaderCollapse
|
16
17
|
%ul.nav.navbar-nav.navbar-left
|
17
|
-
%li= link_to '
|
18
|
-
%li= link_to '
|
18
|
+
%li= link_to t('dashboard'), '#'
|
19
|
+
%li= link_to t('about'), '#'
|
19
20
|
|
20
|
-
.container
|
21
|
+
.container-fluid
|
21
22
|
.row
|
22
23
|
.col-lg-12
|
23
24
|
= render_flash_messages
|
@@ -26,6 +27,6 @@
|
|
26
27
|
= yield
|
27
28
|
|
28
29
|
%footer.navbar.navbar-default.navbar-static-bottom
|
29
|
-
.container
|
30
|
+
.container-fluid
|
30
31
|
%p.navbar-text
|
31
|
-
= "© JabySoft
|
32
|
+
= "© JabySoft #{Date.today.year} All rights reserved".html_safe
|
@@ -1,3 +1,12 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require File.expand_path('../../config/environment', __FILE__)
|
4
|
+
# Prevent database truncation if the environment is production
|
5
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
6
|
+
require 'spec_helper'
|
7
|
+
require 'rspec/rails'
|
8
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
9
|
+
|
1
10
|
# It sends test coverage info to codacy.com
|
2
11
|
require 'codacy-coverage'
|
3
12
|
Codacy::Reporter.start
|
@@ -7,15 +16,9 @@ SimpleCov.start :rails do
|
|
7
16
|
add_filter 'config/initializers'
|
8
17
|
end
|
9
18
|
|
10
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
11
|
-
ENV['RAILS_ENV'] ||= 'test'
|
12
|
-
require File.expand_path('../../config/environment', __FILE__)
|
13
|
-
# Prevent database truncation if the environment is production
|
14
|
-
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
15
|
-
require 'spec_helper'
|
16
|
-
require 'rspec/rails'
|
17
|
-
# Add additional requires below this line. Rails is not loaded until this point!
|
18
19
|
require 'shoulda/matchers'
|
20
|
+
require 'database_cleaner'
|
21
|
+
|
19
22
|
Shoulda::Matchers.configure do |config|
|
20
23
|
config.integrate do |with|
|
21
24
|
with.test_framework :rspec
|
@@ -23,31 +26,18 @@ Shoulda::Matchers.configure do |config|
|
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
26
|
-
# Requires supporting ruby files with custom matchers and macros, etc, in
|
27
|
-
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
28
|
-
# run as spec files by default. This means that files in spec/support that end
|
29
|
-
# in _spec.rb will both be required and run as specs, causing the specs to be
|
30
|
-
# run twice. It is recommended that you do not name files matching this glob to
|
31
|
-
# end with _spec.rb. You can configure this pattern with the --pattern
|
32
|
-
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
33
|
-
#
|
34
|
-
# The following line is provided for convenience purposes. It has the downside
|
35
|
-
# of increasing the boot-up time by auto-requiring all files in the support
|
36
|
-
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
37
|
-
# require only the support files necessary.
|
38
|
-
#
|
39
|
-
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
40
|
-
|
41
29
|
# Checks for pending migration and applies them before tests are run.
|
42
30
|
# If you are not using ActiveRecord, you can remove this line.
|
43
31
|
ActiveRecord::Migration.maintain_test_schema!
|
44
32
|
|
45
33
|
RSpec.configure do |config|
|
46
34
|
|
47
|
-
#
|
35
|
+
# Devise
|
48
36
|
config.include Devise::Test::ControllerHelpers, :type => :controller
|
49
|
-
|
37
|
+
|
38
|
+
# FactoryGirl
|
50
39
|
config.include FactoryGirl::Syntax::Methods
|
40
|
+
|
51
41
|
# DatabaseCleaner
|
52
42
|
config.before(:suite) do
|
53
43
|
DatabaseCleaner.clean_with(:truncation)
|
@@ -67,29 +57,8 @@ RSpec.configure do |config|
|
|
67
57
|
|
68
58
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
69
59
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
70
|
-
|
71
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
72
|
-
# examples within a transaction, remove the following line or assign false
|
73
|
-
# instead of true.
|
74
60
|
config.use_transactional_fixtures = true
|
75
|
-
|
76
|
-
# RSpec Rails can automatically mix in different behaviours to your tests
|
77
|
-
# based on their file location, for example enabling you to call `get` and
|
78
|
-
# `post` in specs under `spec/controllers`.
|
79
|
-
#
|
80
|
-
# You can disable this behaviour by removing the line below, and instead
|
81
|
-
# explicitly tag your specs with their type, e.g.:
|
82
|
-
#
|
83
|
-
# RSpec.describe UsersController, :type => :controller do
|
84
|
-
# # ...
|
85
|
-
# end
|
86
|
-
#
|
87
|
-
# The different available types are documented in the features, such as in
|
88
|
-
# https://relishapp.com/rspec/rspec-rails/docs
|
89
61
|
config.infer_spec_type_from_file_location!
|
90
|
-
|
91
62
|
# Filter lines from Rails gems in backtraces.
|
92
63
|
config.filter_rails_from_backtrace!
|
93
|
-
# arbitrary gems may also be filtered via:
|
94
|
-
# config.filter_gems_from_backtrace("gem name")
|
95
64
|
end
|
@@ -1,8 +1,3 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start :rails do
|
3
|
-
add_filter 'config/initializers'
|
4
|
-
end
|
5
|
-
|
6
1
|
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
7
2
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
8
3
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
class <%= class_name %> < Jabysoft::BaseModel
|
3
|
+
<% attributes.select(&:reference?).each do |attribute| -%>
|
4
|
+
belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %>
|
5
|
+
<% end -%>
|
6
|
+
<% attributes.select(&:token?).each do |attribute| -%>
|
7
|
+
has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
|
8
|
+
<% end -%>
|
9
|
+
<% if attributes.any?(&:password_digest?) -%>
|
10
|
+
has_secure_password
|
11
|
+
<% end -%>
|
12
|
+
end
|
13
|
+
<% end -%>
|
@@ -24,5 +24,14 @@ class <%= controller_class_name %>Controller < Jabysoft::BaseController
|
|
24
24
|
# def load_form_resources
|
25
25
|
# @list = Model.all
|
26
26
|
# end
|
27
|
+
|
28
|
+
# Call after_create or after_update methods to change the default url response and execute more code.
|
29
|
+
# def after_update(success)
|
30
|
+
# redirect_to root_path
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# def after_create(success)
|
34
|
+
# redirect_to root_path
|
35
|
+
# end
|
27
36
|
end
|
28
37
|
<% end -%>
|
@@ -21,13 +21,13 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
21
21
|
|
22
22
|
<% unless options[:singleton] -%>
|
23
23
|
describe 'GET #index' do
|
24
|
+
before(:each) { get :index, params: {} }
|
25
|
+
|
24
26
|
it 'renders the index template' do
|
25
|
-
get :index
|
26
27
|
expect(response).to render_template(:index)
|
27
28
|
end
|
28
29
|
|
29
30
|
it 'returns http 200' do
|
30
|
-
get :index
|
31
31
|
expect(response).to have_http_status(:success)
|
32
32
|
end
|
33
33
|
end
|
@@ -35,60 +35,58 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
35
35
|
<% end -%>
|
36
36
|
describe 'GET #show' do
|
37
37
|
let(:<%= file_name %>) { <%= class_name %>.create! valid_attributes }
|
38
|
+
before(:each) { get :show, params: {id: <%= file_name %>.to_param} }
|
38
39
|
|
39
40
|
it 'renders the show template' do
|
40
|
-
get :show, params: {id: <%= file_name %>.to_param}
|
41
41
|
expect(response).to render_template(:show)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'returns http 200' do
|
45
|
-
get :show, params: {id: <%= file_name %>.to_param}
|
46
45
|
expect(response).to have_http_status(:success)
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
50
49
|
describe 'GET #new' do
|
50
|
+
before(:each) { get :new, params: {} }
|
51
|
+
|
51
52
|
it 'renders the new template' do
|
52
|
-
get :new, params: {}
|
53
53
|
expect(response).to render_template(:new)
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'returns http 200' do
|
57
|
-
get :new, params: {}
|
58
57
|
expect(response).to have_http_status(:success)
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
62
61
|
describe 'GET #edit' do
|
63
62
|
let(:<%= file_name %>) { <%= class_name %>.create! valid_attributes }
|
63
|
+
before(:each) { get :edit, params: {id: <%= file_name %>.to_param} }
|
64
64
|
|
65
65
|
it 'renders the edit template' do
|
66
|
-
get :edit, params: {id: <%= file_name %>.to_param}
|
67
66
|
expect(response).to render_template(:edit)
|
68
67
|
end
|
69
68
|
|
70
69
|
it 'returns http 200' do
|
71
|
-
get :edit, params: {id: <%= file_name %>.to_param}
|
72
70
|
expect(response).to have_http_status(:success)
|
73
71
|
end
|
74
72
|
end
|
75
73
|
|
76
74
|
describe 'POST #create' do
|
77
75
|
context 'with valid params' do
|
76
|
+
before(:each) { post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session }
|
77
|
+
|
78
78
|
it 'creates a new <%= class_name %>' do
|
79
79
|
expect {
|
80
80
|
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
|
81
81
|
}.to change(<%= class_name %>, :count).by(1)
|
82
82
|
end
|
83
83
|
|
84
|
-
it '<%= class_name %> should be found in database' do
|
85
|
-
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
|
84
|
+
it '<%= class_name %> should be found in database' do
|
86
85
|
<%= ns_file_name %> = <%= class_name %>.last
|
87
86
|
expect(<%= ns_file_name %>.id.present?).to be true
|
88
87
|
end
|
89
88
|
|
90
89
|
it 'redirects to the created <%= ns_file_name %>' do
|
91
|
-
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
|
92
90
|
expect(response).to redirect_to(<%= class_name %>.last)
|
93
91
|
end
|
94
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jabysoft-bootstrap_generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emerson Xavier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -158,7 +158,6 @@ files:
|
|
158
158
|
- app/views/layouts/admin.html.haml
|
159
159
|
- app/views/layouts/application.html.haml
|
160
160
|
- app/views/shared/_datepicker_field.html.haml
|
161
|
-
- app/views/shared/_layout.html.haml
|
162
161
|
- app/views/shared/_messages.html.haml
|
163
162
|
- app/views/shared/_panel.html.haml
|
164
163
|
- app/views/shared/_search_form.html.haml
|
@@ -188,6 +187,7 @@ files:
|
|
188
187
|
- lib/templates/haml/scaffold/index.html.haml
|
189
188
|
- lib/templates/haml/scaffold/new.html.haml
|
190
189
|
- lib/templates/haml/scaffold/show.html.haml
|
190
|
+
- lib/templates/rails/model/model.rb
|
191
191
|
- lib/templates/rails/scaffold_controller/controller.rb
|
192
192
|
- lib/templates/rspec/scaffold/controller_spec.rb
|
193
193
|
- lib/templates/rspec/scaffold/model_spec.rb
|