authorized_rails_scaffolds 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/authorized_rails_scaffolds/version.rb +1 -1
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/install_scaffold_generator.rb +4 -0
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/_form.html.erb +4 -5
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/controller.rb +28 -6
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/edit.html.erb +2 -0
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/index.html.erb +2 -0
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/initializer.rb +137 -0
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/new.html.erb +2 -0
- data/lib/generators/authorized_rails_scaffolds/install_scaffold/templates/show.html.erb +6 -6
- data/lib/generators/authorized_rails_scaffolds/install_spec/install_spec_generator.rb +1 -0
- data/lib/generators/authorized_rails_scaffolds/install_spec/templates/controller_spec.rb +45 -35
- data/lib/generators/authorized_rails_scaffolds/install_spec/templates/devise_can_can/controller_macros.rb +4 -4
- data/lib/generators/authorized_rails_scaffolds/install_spec/templates/edit_spec.rb +10 -21
- data/lib/generators/authorized_rails_scaffolds/install_spec/templates/index_spec.rb +17 -45
- data/lib/generators/authorized_rails_scaffolds/install_spec/templates/new_spec.rb +10 -21
- data/lib/generators/authorized_rails_scaffolds/install_spec/templates/routing_spec.rb +59 -0
- data/lib/generators/authorized_rails_scaffolds/install_spec/templates/show_spec.rb +12 -42
- metadata +25 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 33e014ce5460fd00415ab744aa6c62218700e5aa
|
4
|
+
data.tar.gz: f7ef08d1c1d18a961e54f31fa092d459cae329dc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4991100484bf19211002bebdbb8340595485869ae127969985736212aa762df00fde165a505a7efaba9622cd8828dc1abf2caf617530da7c7d0f4ce164d2ac6f
|
7
|
+
data.tar.gz: 825dd5ab02b58a2cb5f8cf1e4f02151158a5b2324cbccb20d578c92922b0850ffc6b7cd413af28ab15dd9628e7304bef27361613ddb54175282408e43e8b002f
|
data/lib/generators/authorized_rails_scaffolds/install_scaffold/install_scaffold_generator.rb
CHANGED
@@ -9,6 +9,10 @@ class AuthorizedRailsScaffolds::InstallScaffoldGenerator < Rails::Generators::Ba
|
|
9
9
|
copy_erb_template 'show.html.erb'
|
10
10
|
end
|
11
11
|
|
12
|
+
def copy_initializer
|
13
|
+
copy_file 'initializer.rb', 'config/initializers/authorized_rails_scaffolds.rb'
|
14
|
+
end
|
15
|
+
|
12
16
|
def copy_rails_templates
|
13
17
|
copy_rails_template 'controller.rb'
|
14
18
|
end
|
@@ -1,14 +1,13 @@
|
|
1
1
|
<%-
|
2
2
|
|
3
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
4
|
+
|
3
5
|
local_class_name = file_name.classify # Non-Namespaced class name
|
4
6
|
var_name = file_name # Non-namespaced variable name
|
5
7
|
plural_var_name = var_name.pluralize # Pluralized non-namespaced variable name
|
6
8
|
|
7
|
-
form_objects = singular_table_name.split(file_name, -1)[0..-2].join(file_name)
|
8
|
-
form_object_array = form_objects.blank? ? "@#{var_name}" : "[:#{form_objects.split('_').join(', :')}, @#{var_name}]"
|
9
|
-
|
10
9
|
-%>
|
11
|
-
<%%= simple_form_for(<%= form_object_array %>, :html => { class: 'form-horizontal' }) do |f| %>
|
10
|
+
<%%= simple_form_for(<%= t_helper.form_object_array %>, :html => { class: 'form-horizontal' }) do |f| %>
|
12
11
|
<%%= f.error_notification %>
|
13
12
|
|
14
13
|
<div class="form-inputs">
|
@@ -20,7 +19,7 @@ form_object_array = form_objects.blank? ? "@#{var_name}" : "[:#{form_objects.spl
|
|
20
19
|
<div class="form-actions">
|
21
20
|
<%%= f.button :submit, :class => 'btn-primary' %>
|
22
21
|
<%%= link_to t('.cancel', :default => t("helpers.links.cancel")),
|
23
|
-
<%=
|
22
|
+
<%= t_helper.controller_index_path %>,
|
24
23
|
:class => 'btn'
|
25
24
|
%>
|
26
25
|
</div>
|
@@ -4,16 +4,38 @@ require_dependency "<%= namespaced_file_path %>/application_controller"
|
|
4
4
|
<% end -%>
|
5
5
|
<%-
|
6
6
|
|
7
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
8
|
+
|
7
9
|
local_class_name = local_class_name = class_name.split("::")[-1] # Non-Namespaced class name
|
8
10
|
var_name = file_name # Non-namespaced variable name
|
9
11
|
plural_var_name = var_name.pluralize # Pluralized non-namespaced variable name
|
10
12
|
|
11
13
|
orm_instance = Rails::Generators::ActiveModel.new var_name
|
12
14
|
|
15
|
+
# Determine namespace prefix i.e awesome_
|
16
|
+
namespace_prefix = singular_table_name[0..-(file_name.length + 1)]
|
17
|
+
|
18
|
+
# Determine Parent Prefix i.e. user_company
|
19
|
+
parent_prefix = AuthorizedRailsScaffolds::PARENT_MODELS.collect{ |x| x.underscore }.join('_')
|
20
|
+
parent_prefix = "#{parent_prefix}_" unless parent_prefix.blank?
|
21
|
+
|
22
|
+
# Route Prefix i.e. awesome_user_company
|
23
|
+
route_prefix = namespace_prefix + parent_prefix
|
24
|
+
|
25
|
+
parent_variables = AuthorizedRailsScaffolds::PARENT_MODELS.collect { |x| "@#{x.underscore}" }.join(', ')
|
26
|
+
|
27
|
+
# Route Helpers
|
28
|
+
route_params_prefix = parent_variables.blank? ? "" : "#{parent_variables}, "
|
29
|
+
index_path_prefix = "#{route_prefix}#{plural_var_name}"
|
30
|
+
single_path_prefix = "#{route_prefix}#{var_name}"
|
31
|
+
|
13
32
|
-%>
|
14
33
|
<% module_namespacing do -%>
|
15
34
|
class <%= controller_class_name %>Controller < ApplicationController
|
16
|
-
|
35
|
+
<%- AuthorizedRailsScaffolds::PARENT_MODELS.each_with_index do |model, model_index| -%>
|
36
|
+
load_resource :<%= model.underscore %><% if model_index > 0 %>, :through => :<%= AuthorizedRailsScaffolds::PARENT_MODELS[model_index - 1].underscore %><% end %>
|
37
|
+
<%- end -%>
|
38
|
+
load_and_authorize_resource :<%= var_name%><% if AuthorizedRailsScaffolds::PARENT_MODELS.any? %>, :through => :<%= AuthorizedRailsScaffolds::PARENT_MODELS.last.underscore %><% end %>
|
17
39
|
|
18
40
|
# GET <%= route_url %>
|
19
41
|
# GET <%= route_url %>.json
|
@@ -60,8 +82,8 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
60
82
|
|
61
83
|
respond_to do |format|
|
62
84
|
if @<%= orm_instance.save %>
|
63
|
-
format.html { redirect_to <%=
|
64
|
-
format.json { render <%= key_value :json, "@#{var_name}" %>, <%= key_value :status, ':created' %>, <%= key_value :location, "#{
|
85
|
+
format.html { redirect_to <%= "#{single_path_prefix}_path(#{route_params_prefix}@#{var_name})" %>, <%= key_value :notice, "'#{human_name} was successfully created.'" %> }
|
86
|
+
format.json { render <%= key_value :json, "@#{var_name}" %>, <%= key_value :status, ':created' %>, <%= key_value :location, "#{single_path_prefix}_path(#{route_params_prefix}@#{var_name})" %> }
|
65
87
|
else
|
66
88
|
format.html { render <%= key_value :action, '"new"' %> }
|
67
89
|
format.json { render <%= key_value :json, "@#{orm_instance.errors}" %>, <%= key_value :status, ':unprocessable_entity' %> }
|
@@ -76,7 +98,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
76
98
|
|
77
99
|
respond_to do |format|
|
78
100
|
if @<%= orm_instance.update_attributes("params[:#{var_name}]") %>
|
79
|
-
format.html { redirect_to <%=
|
101
|
+
format.html { redirect_to <%= "#{single_path_prefix}_path(#{route_params_prefix}@#{var_name})" %>, <%= key_value :notice, "'#{human_name} was successfully updated.'" %> }
|
80
102
|
format.json { head :no_content }
|
81
103
|
else
|
82
104
|
format.html { render <%= key_value :action, '"edit"' %> }
|
@@ -92,7 +114,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
92
114
|
@<%= orm_instance.destroy %>
|
93
115
|
|
94
116
|
respond_to do |format|
|
95
|
-
format.html { redirect_to <%=
|
117
|
+
format.html { redirect_to <%= t_helper.controller_index_route %> }
|
96
118
|
format.json { head :no_content }
|
97
119
|
end
|
98
120
|
end
|
@@ -104,7 +126,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
104
126
|
if params[:action] == 'index'
|
105
127
|
redirect_to root_url, :alert => exception.message
|
106
128
|
else
|
107
|
-
redirect_to <%=
|
129
|
+
redirect_to <%= t_helper.controller_index_route %>, :alert => exception.message
|
108
130
|
end
|
109
131
|
end
|
110
132
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
<%-
|
2
2
|
|
3
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
4
|
+
|
3
5
|
local_class_name = file_name.classify # Non-Namespaced class name
|
4
6
|
var_name = file_name # Non-namespaced variable name
|
5
7
|
plural_var_name = var_name.pluralize # Pluralized non-namespaced variable name
|
@@ -0,0 +1,137 @@
|
|
1
|
+
module AuthorizedRailsScaffolds
|
2
|
+
|
3
|
+
PARENT_MODELS = [] # i.e. ['Category', 'User'] for Awesome/FooBar => awesome_category_user_foo_bars_path
|
4
|
+
|
5
|
+
class Helper
|
6
|
+
|
7
|
+
def initialize(class_name, singular_table_name, file_name, plural_file_name = nil)
|
8
|
+
@local_class_name = class_name.split('::')[-1] # Non-Namespaced class name
|
9
|
+
@var_name = file_name # Non-namespaced variable name
|
10
|
+
@plural_var_name = plural_file_name || file_name.pluralize # Pluralized non-namespaced variable name
|
11
|
+
|
12
|
+
# Determine namespace prefix i.e awesome
|
13
|
+
@namespace_prefix = singular_table_name[0..-(file_name.length + 2)]
|
14
|
+
|
15
|
+
# Determine Parent Prefix i.e. user_company
|
16
|
+
parent_prefix = AuthorizedRailsScaffolds::PARENT_MODELS.collect{ |x| x.underscore }.join('_')
|
17
|
+
parent_prefix = "#{parent_prefix}_" unless parent_prefix.blank?
|
18
|
+
|
19
|
+
# Route Prefix i.e. awesome_user_company
|
20
|
+
@route_prefix = @namespace_prefix.blank? ? parent_prefix : "#{@namespace_prefix}_#{parent_prefix}"
|
21
|
+
|
22
|
+
@parent_variables = AuthorizedRailsScaffolds::PARENT_MODELS.collect{ |x| "@#{x.underscore}" }.join(', ')
|
23
|
+
|
24
|
+
# Route Helpers
|
25
|
+
@route_params_prefix = @parent_variables.blank? ? "" : "#{@parent_variables}, "
|
26
|
+
@index_path_prefix = "#{@route_prefix}#{@plural_var_name}"
|
27
|
+
@single_path_prefix = "#{@route_prefix}#{var_name}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def local_class_name
|
31
|
+
@local_class_name
|
32
|
+
end
|
33
|
+
|
34
|
+
def var_name
|
35
|
+
@var_name
|
36
|
+
end
|
37
|
+
|
38
|
+
def plural_var_name
|
39
|
+
@plural_var_name
|
40
|
+
end
|
41
|
+
|
42
|
+
def form_object_array(variable = nil)
|
43
|
+
variable ||= "@#{var_name}"
|
44
|
+
namespace_prefix = ":#{@namespace_prefix}" unless @namespace_prefix.blank?
|
45
|
+
array = [namespace_prefix, @parent_variables, variable].reject{ |x| x.blank? || x == '_' }.join(', ')
|
46
|
+
"[#{array}]"
|
47
|
+
end
|
48
|
+
|
49
|
+
def controller_show_route(variable = nil)
|
50
|
+
variable ||= "@#{@var_name}"
|
51
|
+
"#{@single_path_prefix}_path(#{@route_params_prefix}#{variable})"
|
52
|
+
end
|
53
|
+
|
54
|
+
def controller_index_path
|
55
|
+
if @parent_variables.blank?
|
56
|
+
"#{@index_path_prefix}_path"
|
57
|
+
else
|
58
|
+
"#{@index_path_prefix}_path(#{@parent_variables})"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def controller_index_route
|
63
|
+
if @parent_variables.blank?
|
64
|
+
"#{@index_path_prefix}_url"
|
65
|
+
else
|
66
|
+
"#{@index_path_prefix}_url(#{@parent_variables})"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# call arguments
|
71
|
+
def index_action_params_prefix
|
72
|
+
if AuthorizedRailsScaffolds::PARENT_MODELS.any?
|
73
|
+
AuthorizedRailsScaffolds::PARENT_MODELS.collect{|x| ":#{x.underscore}_id => @#{x.underscore}.to_param"}.join(', ')
|
74
|
+
else
|
75
|
+
''
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def references_show_route(attribute_name, variable = nil)
|
80
|
+
variable ||= "@#{@var_name}.#{attribute_name}"
|
81
|
+
if AuthorizedRailsScaffolds::PARENT_MODELS.any? && AuthorizedRailsScaffolds::PARENT_MODELS.last.underscore == attribute_name
|
82
|
+
references_path = "#{@route_prefix}path(#{variable})"
|
83
|
+
else
|
84
|
+
references_path = "#{attribute_name}_path(#{variable})"
|
85
|
+
unless @namespace_prefix.blank?
|
86
|
+
references_path = "#{@namespace_prefix}_#{references_path}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
references_path
|
90
|
+
end
|
91
|
+
|
92
|
+
def action_params_prefix
|
93
|
+
index_action_params = index_action_params_prefix
|
94
|
+
if index_action_params.blank?
|
95
|
+
''
|
96
|
+
else
|
97
|
+
"#{index_action_params}, "
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Returns code that will generate attribute_value as an attribute_type
|
102
|
+
def factory_attribute_value(attribute_type, attribute_value)
|
103
|
+
case attribute_type
|
104
|
+
when :datetime
|
105
|
+
"DateTime.parse(#{attribute_value})"
|
106
|
+
when :time
|
107
|
+
value_as_time = attribute_value.to_time.strftime('%T')
|
108
|
+
"Time.parse(#{value_as_time.dump})"
|
109
|
+
when :date
|
110
|
+
value_as_date = attribute_value.to_time.strftime('%Y-%m-%d')
|
111
|
+
"Date.parse(#{value_as_date.dump})"
|
112
|
+
else
|
113
|
+
attribute_value
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns the expected output string of attribute_value if it is an attribute_type
|
118
|
+
def factory_attribute_string(attribute_type, attribute_value)
|
119
|
+
case attribute_type
|
120
|
+
when :datetime
|
121
|
+
attribute_value_as_date = DateTime.parse(attribute_value)
|
122
|
+
I18n.l(attribute_value_as_date, :format => :long).dump
|
123
|
+
when :time
|
124
|
+
attribute_value_as_time = Time.parse(attribute_value)
|
125
|
+
I18n.l(attribute_value_as_time, :format => :short).dump
|
126
|
+
when :date
|
127
|
+
attribute_value_as_date = Date.parse(attribute_value)
|
128
|
+
I18n.l(attribute_value_as_date).dump
|
129
|
+
else
|
130
|
+
attribute_value
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%-
|
2
2
|
|
3
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
4
|
+
|
3
5
|
local_class_name = file_name.classify # Non-Namespaced class name
|
4
6
|
var_name = file_name # Non-namespaced variable name
|
5
7
|
plural_var_name = var_name.pluralize # Pluralized non-namespaced variable name
|
6
8
|
|
7
|
-
path_prefix = singular_table_name[0..-(file_name.length+1)]
|
8
|
-
|
9
9
|
-%>
|
10
10
|
<%%- model_class = <%= local_class_name %> -%>
|
11
11
|
<div class="page-header">
|
@@ -18,7 +18,7 @@ path_prefix = singular_table_name[0..-(file_name.length+1)]
|
|
18
18
|
<%- if attribute.type == :references -%>
|
19
19
|
<%% if @<%= var_name %>.<%= attribute.name %>.present? && can?(:read, @<%= var_name %>.<%= attribute.name %>) %>
|
20
20
|
<dt><strong><%%= <%= attribute_label %> %>:</strong></dt>
|
21
|
-
<dd><%%= link_to @<%= var_name %>.<%= attribute.name %>, <%=
|
21
|
+
<dd><%%= link_to @<%= var_name %>.<%= attribute.name %>, <%= t_helper.references_show_route attribute.name %> %></dd>
|
22
22
|
<%% end %>
|
23
23
|
<%- elsif [:datetime, :timestamp, :time, :date].include? attribute.type -%>
|
24
24
|
<%% unless @<%= var_name %>.<%= attribute.name %>.nil? %>
|
@@ -41,16 +41,16 @@ path_prefix = singular_table_name[0..-(file_name.length+1)]
|
|
41
41
|
|
42
42
|
<div class="form-actions">
|
43
43
|
<%%= link_to t('.back', :default => t("helpers.links.back")),
|
44
|
-
<%=
|
44
|
+
<%= t_helper.controller_index_path %>, :class => 'btn' %>
|
45
45
|
<%% if can? :update, @<%= var_name %> %>
|
46
46
|
<%%= link_to t('.edit', :default => t("helpers.links.edit")),
|
47
|
-
edit_<%=
|
47
|
+
edit_<%= t_helper.controller_show_route "@#{var_name}" %>,
|
48
48
|
:class => 'btn'
|
49
49
|
%>
|
50
50
|
<%% end %>
|
51
51
|
<%% if can? :destroy, @<%= var_name %> %>
|
52
52
|
<%%= link_to t('.destroy', :default => t("helpers.links.destroy")),
|
53
|
-
<%=
|
53
|
+
<%= t_helper.controller_show_route "@#{var_name}" %>,
|
54
54
|
:method => 'delete',
|
55
55
|
:data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
|
56
56
|
:class => 'act act-danger pull-right'
|
@@ -14,6 +14,7 @@ class AuthorizedRailsScaffolds::InstallSpecGenerator < Rails::Generators::Base
|
|
14
14
|
copy_scaffold_template 'index_spec.rb'
|
15
15
|
copy_scaffold_template 'new_spec.rb'
|
16
16
|
copy_scaffold_template 'show_spec.rb'
|
17
|
+
copy_scaffold_template 'routing_spec.rb'
|
17
18
|
end
|
18
19
|
|
19
20
|
def create_controller_macros
|
@@ -21,6 +21,8 @@ require 'spec_helper'
|
|
21
21
|
<% module_namespacing do -%>
|
22
22
|
<%-
|
23
23
|
|
24
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
25
|
+
|
24
26
|
local_class_name = class_name.split('::')[-1] # Non-Namespaced class name
|
25
27
|
var_name = file_name # Non-namespaced variable name
|
26
28
|
plural_var_name = var_name.pluralize # Pluralized non-namespaced variable name
|
@@ -40,13 +42,21 @@ describe <%= controller_class_name %>Controller do
|
|
40
42
|
FactoryGirl.attributes_for(:<%= var_name %>)
|
41
43
|
end
|
42
44
|
|
45
|
+
<%- if AuthorizedRailsScaffolds::PARENT_MODELS.any? -%>
|
46
|
+
before(:each) do
|
47
|
+
<%- AuthorizedRailsScaffolds::PARENT_MODELS.each do |model| -%>
|
48
|
+
@<%= model.underscore %> = FactoryGirl.create(:<%= model.underscore %>)
|
49
|
+
<%- end -%>
|
50
|
+
end
|
51
|
+
|
52
|
+
<%- end -%>
|
43
53
|
<% unless options[:singleton] -%>
|
44
54
|
describe "GET index" do
|
45
55
|
context 'without a user' do
|
46
56
|
describe 'with valid request' do
|
47
57
|
before(:each) do
|
48
58
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
49
|
-
get :index, {}
|
59
|
+
get :index, {<%= t_helper.index_action_params_prefix %>}
|
50
60
|
end
|
51
61
|
it { should redirect_to(new_user_session_path) }
|
52
62
|
it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
|
@@ -57,7 +67,7 @@ describe <%= controller_class_name %>Controller do
|
|
57
67
|
describe 'with valid request' do
|
58
68
|
before(:each) do
|
59
69
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
60
|
-
get :index, {}
|
70
|
+
get :index, {<%= t_helper.index_action_params_prefix %>}
|
61
71
|
end
|
62
72
|
it { should redirect_to(root_url) }
|
63
73
|
it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
|
@@ -68,7 +78,7 @@ describe <%= controller_class_name %>Controller do
|
|
68
78
|
describe 'with valid request' do
|
69
79
|
before(:each) do
|
70
80
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
71
|
-
get :index, {}
|
81
|
+
get :index, {<%= t_helper.index_action_params_prefix %>}
|
72
82
|
end
|
73
83
|
it { should respond_with(:success) }
|
74
84
|
it { should render_template(:index) }
|
@@ -86,7 +96,7 @@ describe <%= controller_class_name %>Controller do
|
|
86
96
|
describe 'with valid request' do
|
87
97
|
before(:each) do
|
88
98
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
89
|
-
get :show, {
|
99
|
+
get :show, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
90
100
|
end
|
91
101
|
it { should redirect_to(new_user_session_path) }
|
92
102
|
it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
|
@@ -97,9 +107,9 @@ describe <%= controller_class_name %>Controller do
|
|
97
107
|
describe 'with valid request' do
|
98
108
|
before(:each) do
|
99
109
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
100
|
-
get :show, {
|
110
|
+
get :show, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
101
111
|
end
|
102
|
-
it { should redirect_to(<%=
|
112
|
+
it { should redirect_to(<%= t_helper.controller_index_route %>) }
|
103
113
|
it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
|
104
114
|
end
|
105
115
|
end
|
@@ -108,7 +118,7 @@ describe <%= controller_class_name %>Controller do
|
|
108
118
|
describe 'with valid request' do
|
109
119
|
before(:each) do
|
110
120
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
111
|
-
get :show, {
|
121
|
+
get :show, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
112
122
|
end
|
113
123
|
it { should respond_with(:success) }
|
114
124
|
it { should render_template(:show) }
|
@@ -124,7 +134,7 @@ describe <%= controller_class_name %>Controller do
|
|
124
134
|
context 'without a user' do
|
125
135
|
describe 'with valid request' do
|
126
136
|
before(:each) do
|
127
|
-
get :new, {}
|
137
|
+
get :new, {<%= t_helper.index_action_params_prefix %>}
|
128
138
|
end
|
129
139
|
it { should redirect_to(new_user_session_path) }
|
130
140
|
it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
|
@@ -134,9 +144,9 @@ describe <%= controller_class_name %>Controller do
|
|
134
144
|
login_unauthorized_user
|
135
145
|
describe 'with valid request' do
|
136
146
|
before(:each) do
|
137
|
-
get :new, {}
|
147
|
+
get :new, {<%= t_helper.index_action_params_prefix %>}
|
138
148
|
end
|
139
|
-
it { should redirect_to(<%=
|
149
|
+
it { should redirect_to(<%= t_helper.controller_index_route %>) }
|
140
150
|
it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
|
141
151
|
end
|
142
152
|
end
|
@@ -144,7 +154,7 @@ describe <%= controller_class_name %>Controller do
|
|
144
154
|
login_user_with_ability :create, <%= local_class_name %>
|
145
155
|
describe 'with valid request' do
|
146
156
|
before(:each) do
|
147
|
-
get :new, {}
|
157
|
+
get :new, {<%= t_helper.index_action_params_prefix %>}
|
148
158
|
end
|
149
159
|
it { should respond_with(:success) }
|
150
160
|
it { should render_template(:new) }
|
@@ -161,7 +171,7 @@ describe <%= controller_class_name %>Controller do
|
|
161
171
|
describe 'with valid request' do
|
162
172
|
before(:each) do
|
163
173
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
164
|
-
get :edit, {
|
174
|
+
get :edit, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
165
175
|
end
|
166
176
|
it { should redirect_to(new_user_session_path) }
|
167
177
|
it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
|
@@ -172,9 +182,9 @@ describe <%= controller_class_name %>Controller do
|
|
172
182
|
describe 'with valid request' do
|
173
183
|
before(:each) do
|
174
184
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
175
|
-
get :edit, {
|
185
|
+
get :edit, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
176
186
|
end
|
177
|
-
it { should redirect_to(<%=
|
187
|
+
it { should redirect_to(<%= t_helper.controller_index_route %>) }
|
178
188
|
it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
|
179
189
|
end
|
180
190
|
end
|
@@ -183,7 +193,7 @@ describe <%= controller_class_name %>Controller do
|
|
183
193
|
describe 'with valid request' do
|
184
194
|
before(:each) do
|
185
195
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
186
|
-
get :edit, {
|
196
|
+
get :edit, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
187
197
|
end
|
188
198
|
it { should respond_with(:success) }
|
189
199
|
it { should render_template(:edit) }
|
@@ -199,7 +209,7 @@ describe <%= controller_class_name %>Controller do
|
|
199
209
|
context 'without a user' do
|
200
210
|
describe 'with valid params' do
|
201
211
|
before(:each) do
|
202
|
-
post :create, {
|
212
|
+
post :create, {<%= t_helper.action_params_prefix %>:<%= var_name %> => valid_create_attributes}
|
203
213
|
end
|
204
214
|
it { should redirect_to(new_user_session_path) }
|
205
215
|
it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
|
@@ -209,9 +219,9 @@ describe <%= controller_class_name %>Controller do
|
|
209
219
|
login_unauthorized_user
|
210
220
|
describe "with valid params" do
|
211
221
|
before(:each) do
|
212
|
-
post :create, {
|
222
|
+
post :create, {<%= t_helper.action_params_prefix %>:<%= var_name %> => valid_create_attributes}
|
213
223
|
end
|
214
|
-
it { should redirect_to(<%=
|
224
|
+
it { should redirect_to(<%= t_helper.controller_index_route %>) }
|
215
225
|
it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
|
216
226
|
end
|
217
227
|
end
|
@@ -220,27 +230,27 @@ describe <%= controller_class_name %>Controller do
|
|
220
230
|
describe "with valid params" do
|
221
231
|
it "creates a new <%= local_class_name %>" do
|
222
232
|
expect {
|
223
|
-
post :create, {
|
233
|
+
post :create, {<%= t_helper.action_params_prefix %>:<%= var_name %> => valid_create_attributes}
|
224
234
|
}.to change(<%= local_class_name %>, :count).by(1)
|
225
235
|
end
|
226
236
|
end
|
227
237
|
describe 'with valid params' do
|
228
238
|
before(:each) do
|
229
|
-
post :create, {
|
239
|
+
post :create, {<%= t_helper.action_params_prefix %>:<%= var_name %> => valid_create_attributes}
|
230
240
|
end
|
231
241
|
it "assigns a newly created <%= var_name %> as @<%= var_name %>" do
|
232
242
|
assigns(:<%= var_name %>).should be_a(<%= local_class_name %>)
|
233
243
|
assigns(:<%= var_name %>).should be_persisted
|
234
244
|
end
|
235
245
|
it "redirects to the created <%= var_name %>" do
|
236
|
-
response.should redirect_to(<%=
|
246
|
+
response.should redirect_to(<%= t_helper.controller_show_route "#{local_class_name}.last" %>)
|
237
247
|
end
|
238
248
|
end
|
239
249
|
describe "with invalid params" do
|
240
250
|
before(:each) do
|
241
251
|
# Trigger the behavior that occurs when invalid params are submitted
|
242
252
|
<%= local_class_name %>.any_instance.stub(:save).and_return(false)
|
243
|
-
post :create, {
|
253
|
+
post :create, {<%= t_helper.action_params_prefix %>:<%= var_name %> => <%= formatted_hash(example_invalid_attributes) %>}
|
244
254
|
end
|
245
255
|
it { should render_template(:new) }
|
246
256
|
it { should render_with_layout(:application) }
|
@@ -256,7 +266,7 @@ describe <%= controller_class_name %>Controller do
|
|
256
266
|
describe 'with valid params' do
|
257
267
|
before(:each) do
|
258
268
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
259
|
-
put :update, {
|
269
|
+
put :update, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param, :<%= var_name %> => valid_update_attributes}
|
260
270
|
end
|
261
271
|
it { should redirect_to(new_user_session_path) }
|
262
272
|
it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
|
@@ -267,9 +277,9 @@ describe <%= controller_class_name %>Controller do
|
|
267
277
|
describe "with valid params" do
|
268
278
|
before(:each) do
|
269
279
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
270
|
-
put :update, {
|
280
|
+
put :update, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param, :<%= var_name %> => valid_update_attributes}
|
271
281
|
end
|
272
|
-
it { should redirect_to(<%=
|
282
|
+
it { should redirect_to(<%= t_helper.controller_index_route %>) }
|
273
283
|
it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
|
274
284
|
end
|
275
285
|
end
|
@@ -287,19 +297,19 @@ describe <%= controller_class_name %>Controller do
|
|
287
297
|
<%- else -%>
|
288
298
|
<%= local_class_name %>.any_instance.should_receive(:update_attributes).with(<%= formatted_hash(example_params_for_update) %>)
|
289
299
|
<%- end -%>
|
290
|
-
put :update, {
|
300
|
+
put :update, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param, :<%= var_name %> => <%= formatted_hash(example_params_for_update) %>}
|
291
301
|
end
|
292
302
|
end
|
293
303
|
describe "with valid params" do
|
294
304
|
before(:each) do
|
295
305
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
296
|
-
put :update, {
|
306
|
+
put :update, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param, :<%= var_name %> => valid_update_attributes}
|
297
307
|
end
|
298
308
|
it "assigns the requested <%= var_name %> as @<%= var_name %>" do
|
299
309
|
assigns(:<%= var_name %>).should eq(@<%= var_name %>)
|
300
310
|
end
|
301
311
|
it "redirects to the <%= var_name %>" do
|
302
|
-
response.should redirect_to(<%=
|
312
|
+
response.should redirect_to(<%= t_helper.controller_show_route "@#{var_name}" %>)
|
303
313
|
end
|
304
314
|
end
|
305
315
|
describe "with invalid params" do
|
@@ -307,7 +317,7 @@ describe <%= controller_class_name %>Controller do
|
|
307
317
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
308
318
|
# Trigger the behavior that occurs when invalid params are submitted
|
309
319
|
<%= local_class_name %>.any_instance.stub(:save).and_return(false)
|
310
|
-
put :update, {
|
320
|
+
put :update, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param, :<%= var_name %> => <%= formatted_hash(example_invalid_attributes) %>}
|
311
321
|
end
|
312
322
|
it { should render_template(:edit) }
|
313
323
|
it { should render_with_layout(:application) }
|
@@ -323,7 +333,7 @@ describe <%= controller_class_name %>Controller do
|
|
323
333
|
describe 'with valid request' do
|
324
334
|
before(:each) do
|
325
335
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
326
|
-
delete :destroy, {
|
336
|
+
delete :destroy, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
327
337
|
end
|
328
338
|
it { should redirect_to(new_user_session_path) }
|
329
339
|
it { should set_the_flash[:alert].to("You need to sign in or sign up before continuing.") }
|
@@ -334,9 +344,9 @@ describe <%= controller_class_name %>Controller do
|
|
334
344
|
describe "with valid request" do
|
335
345
|
before(:each) do
|
336
346
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
337
|
-
delete :destroy, {
|
347
|
+
delete :destroy, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
338
348
|
end
|
339
|
-
it { should redirect_to(<%=
|
349
|
+
it { should redirect_to(<%= t_helper.controller_index_route %>) }
|
340
350
|
it { should set_the_flash[:alert].to("You are not authorized to access this page.") }
|
341
351
|
end
|
342
352
|
end
|
@@ -345,16 +355,16 @@ describe <%= controller_class_name %>Controller do
|
|
345
355
|
it "destroys the requested <%= var_name %>" do
|
346
356
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
347
357
|
expect {
|
348
|
-
delete :destroy, {
|
358
|
+
delete :destroy, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
349
359
|
}.to change(<%= local_class_name %>, :count).by(-1)
|
350
360
|
end
|
351
361
|
describe 'with valid request' do
|
352
362
|
before(:each) do
|
353
363
|
@<%= var_name %> = FactoryGirl.create(:<%= var_name %>)
|
354
|
-
delete :destroy, {
|
364
|
+
delete :destroy, {<%= t_helper.action_params_prefix %>:id => @<%= var_name %>.to_param}
|
355
365
|
end
|
356
366
|
it "redirects to the <%= var_name %> list" do
|
357
|
-
response.should redirect_to(<%=
|
367
|
+
response.should redirect_to(<%= t_helper.controller_index_route %>)
|
358
368
|
end
|
359
369
|
end
|
360
370
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module DeviseCanCanControllerMacros
|
2
2
|
def login_unauthorized_user
|
3
3
|
before(:each) do
|
4
4
|
@ability = Object.new
|
@@ -18,8 +18,8 @@ module DeviceCanCanControllerMacros
|
|
18
18
|
@controller.stubs(:current_ability).returns(@ability)
|
19
19
|
|
20
20
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
21
|
-
@
|
22
|
-
sign_in @
|
21
|
+
@logged_in_user = FactoryGirl.create(:user)
|
22
|
+
sign_in @logged_in_user
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
<%-
|
4
4
|
|
5
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
6
|
+
|
5
7
|
local_class_name = class_name.split('::')[-1] # Non-Namespaced class name
|
6
8
|
var_name = file_name # Non-namespaced variable name
|
7
9
|
|
@@ -9,28 +11,15 @@ output_attributes = attributes.reject{|attribute| [:timestamp].include? attrib
|
|
9
11
|
standard_attributes = attributes.reject{|attribute| [:time, :date, :datetime].include? attribute.type }
|
10
12
|
datetime_attributes = attributes.reject{|attribute| ![:time, :date, :datetime].include? attribute.type }
|
11
13
|
|
12
|
-
# Returns code that will generate attribute_value as an attribute_type
|
13
|
-
def factory_attribute_value(attribute_type, attribute_value)
|
14
|
-
case attribute_type
|
15
|
-
when :datetime
|
16
|
-
"DateTime.parse(#{attribute_value})"
|
17
|
-
when :time
|
18
|
-
value_as_time = attribute_value.to_time.strftime('%T')
|
19
|
-
"Time.parse(#{value_as_time.dump})"
|
20
|
-
when :date
|
21
|
-
value_as_date = attribute_value.to_time.strftime('%Y-%m-%d')
|
22
|
-
"Date.parse(#{value_as_date.dump})"
|
23
|
-
else
|
24
|
-
attribute_value
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
14
|
-%>
|
29
15
|
describe "<%= ns_table_name %>/edit" do
|
30
16
|
before(:each) do
|
17
|
+
<%- AuthorizedRailsScaffolds::PARENT_MODELS.each do |model| -%>
|
18
|
+
@<%= model.underscore %> = assign(:<%= model.underscore %>, FactoryGirl.build_stubbed(:<%= model.underscore %>))
|
19
|
+
<%- end -%>
|
31
20
|
@<%= var_name %> = assign(:<%= var_name %>, FactoryGirl.build_stubbed(:<%= var_name %><%= output_attributes.empty? ? '))' : ',' %>
|
32
21
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
33
|
-
:<%= attribute.name %> => <%= factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
22
|
+
:<%= attribute.name %> => <%= t_helper.factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
34
23
|
<% end -%>
|
35
24
|
<%= output_attributes.empty? ? "" : " ))\n" -%>
|
36
25
|
end
|
@@ -39,7 +28,7 @@ describe "<%= ns_table_name %>/edit" do
|
|
39
28
|
render
|
40
29
|
|
41
30
|
<% if webrat? -%>
|
42
|
-
rendered.should have_selector("form", :action => <%=
|
31
|
+
rendered.should have_selector("form", :action => <%= t_helper.controller_show_route "@#{var_name}" %>, :method => "post") do |form|
|
43
32
|
<% for attribute in standard_attributes -%>
|
44
33
|
<%- if attribute.type == :references -%>
|
45
34
|
form.should have_selector("select#<%= var_name %>_<%= attribute.name %>_id", :name => "<%= var_name %>[<%= attribute.name %>_id]")
|
@@ -50,7 +39,7 @@ describe "<%= ns_table_name %>/edit" do
|
|
50
39
|
end
|
51
40
|
<% else -%>
|
52
41
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
53
|
-
assert_select "form[action=?][method=?]", <%=
|
42
|
+
assert_select "form[action=?][method=?]", <%= t_helper.controller_show_route "@#{var_name}" %>, "post" do
|
54
43
|
<% for attribute in standard_attributes -%>
|
55
44
|
<%- if attribute.type == :references -%>
|
56
45
|
assert_select "select#<%= var_name %>_<%= attribute.name %>_id[name=?]", "<%= var_name %>[<%= attribute.name %>_id]"
|
@@ -67,7 +56,7 @@ describe "<%= ns_table_name %>/edit" do
|
|
67
56
|
render
|
68
57
|
|
69
58
|
<% if webrat? -%>
|
70
|
-
rendered.should have_selector("form", :action => <%=
|
59
|
+
rendered.should have_selector("form", :action => <%= t_helper.controller_show_route "@#{var_name}" %>, :method => "post") do |form|
|
71
60
|
<% for attribute in datetime_attributes -%>
|
72
61
|
<%- if [:date, :datetime].include? attribute.type -%>
|
73
62
|
form.should have_selector("select#<%= var_name %>_<%= attribute.name %>", :name => "<%= var_name %>[<%= attribute.name %>]")
|
@@ -82,7 +71,7 @@ describe "<%= ns_table_name %>/edit" do
|
|
82
71
|
end
|
83
72
|
<% else -%>
|
84
73
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
85
|
-
assert_select "form[action=?][method=?]", <%=
|
74
|
+
assert_select "form[action=?][method=?]", <%= t_helper.controller_show_route "@#{var_name}" %>, "post" do
|
86
75
|
<% for attribute in datetime_attributes -%>
|
87
76
|
# <%= attribute.name %> values
|
88
77
|
<%- if [:date, :datetime].include? attribute.type -%>
|
@@ -2,52 +2,24 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
<%-
|
4
4
|
|
5
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
6
|
+
|
5
7
|
local_class_name = class_name.split('::')[-1] # Non-Namespaced class name
|
6
8
|
var_name = file_name # Non-namespaced variable name
|
7
9
|
plural_var_name = var_name.pluralize # Pluralized non-namespaced variable name
|
8
10
|
|
9
11
|
output_attributes = attributes.reject{|attribute| [:timestamp].include? attribute.type }
|
10
12
|
|
11
|
-
# Returns code that will generate attribute_value as an attribute_type
|
12
|
-
def factory_attribute_value(attribute_type, attribute_value)
|
13
|
-
case attribute_type
|
14
|
-
when :datetime
|
15
|
-
"DateTime.parse(#{attribute_value})"
|
16
|
-
when :time
|
17
|
-
value_as_time = attribute_value.to_time.strftime('%T')
|
18
|
-
"Time.parse(#{value_as_time.dump})"
|
19
|
-
when :date
|
20
|
-
value_as_date = attribute_value.to_time.strftime('%Y-%m-%d')
|
21
|
-
"Date.parse(#{value_as_date.dump})"
|
22
|
-
else
|
23
|
-
attribute_value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns the expected output string of attribute_value if it is an attribute_type
|
28
|
-
def factory_attribute_string(attribute_type, attribute_value)
|
29
|
-
case attribute_type
|
30
|
-
when :datetime
|
31
|
-
attribute_value_as_date = DateTime.parse(attribute_value)
|
32
|
-
I18n.l(attribute_value_as_date, :format => :long).dump
|
33
|
-
when :time
|
34
|
-
attribute_value_as_time = Time.parse(attribute_value)
|
35
|
-
I18n.l(attribute_value_as_time, :format => :short).dump
|
36
|
-
when :date
|
37
|
-
attribute_value_as_date = Date.parse(attribute_value)
|
38
|
-
I18n.l(attribute_value_as_date).dump
|
39
|
-
else
|
40
|
-
attribute_value
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
13
|
-%>
|
45
14
|
describe "<%= ns_table_name %>/index" do
|
46
15
|
before(:each) do
|
16
|
+
<%- AuthorizedRailsScaffolds::PARENT_MODELS.each do |model| -%>
|
17
|
+
@<%= model.underscore %> = assign(:<%= model.underscore %>, FactoryGirl.build_stubbed(:<%= model.underscore %>))
|
18
|
+
<%- end -%>
|
47
19
|
<% [1,2].each_with_index do |id, model_index| -%>
|
48
20
|
@<%= var_name %>_<%= model_index + 1 %> = FactoryGirl.build_stubbed(:<%= var_name %><%= output_attributes.empty? ? ')' : ',' %>
|
49
21
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
50
|
-
:<%= attribute.name %> => <%= factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
22
|
+
:<%= attribute.name %> => <%= t_helper.factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
51
23
|
<% end -%>
|
52
24
|
<% if !output_attributes.empty? -%>
|
53
25
|
)
|
@@ -105,7 +77,7 @@ describe "<%= ns_table_name %>/index" do
|
|
105
77
|
<% if webrat? -%>
|
106
78
|
rendered.should have_selector("tr>td", :content => <%= factory_attribute_string attribute.type, value_for(attribute) %>.to_s, :count => 2)
|
107
79
|
<% else -%>
|
108
|
-
assert_select "tr>td", :text => <%= factory_attribute_string attribute.type, value_for(attribute) %>.to_s, :count => 2
|
80
|
+
assert_select "tr>td", :text => <%= t_helper.factory_attribute_string attribute.type, value_for(attribute) %>.to_s, :count => 2
|
109
81
|
<% end -%>
|
110
82
|
<% end -%>
|
111
83
|
end
|
@@ -115,9 +87,9 @@ describe "<%= ns_table_name %>/index" do
|
|
115
87
|
render
|
116
88
|
<% [1,2].each do |model_index| -%>
|
117
89
|
<% if webrat? -%>
|
118
|
-
rendered.should have_selector("td>a[href]:not([data-method])", :href => <%=
|
90
|
+
rendered.should have_selector("td>a[href]:not([data-method])", :href => <%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1)
|
119
91
|
<% else -%>
|
120
|
-
assert_select "td>a[href=?]:not([data-method])", <%=
|
92
|
+
assert_select "td>a[href=?]:not([data-method])", <%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1
|
121
93
|
<% end -%>
|
122
94
|
<% end -%>
|
123
95
|
end
|
@@ -129,9 +101,9 @@ describe "<%= ns_table_name %>/index" do
|
|
129
101
|
render
|
130
102
|
<% [1,2].each do |model_index| -%>
|
131
103
|
<% if webrat? -%>
|
132
|
-
rendered.should_not have_selector("td>a[href][disabled=disabled]", :href => edit_<%=
|
104
|
+
rendered.should_not have_selector("td>a[href][disabled=disabled]", :href => edit_<%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1)
|
133
105
|
<% else -%>
|
134
|
-
assert_select "td>a[href=?][disabled=disabled]", edit_<%=
|
106
|
+
assert_select "td>a[href=?][disabled=disabled]", edit_<%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1
|
135
107
|
<% end -%>
|
136
108
|
<% end -%>
|
137
109
|
end
|
@@ -142,9 +114,9 @@ describe "<%= ns_table_name %>/index" do
|
|
142
114
|
render
|
143
115
|
<% [1,2].each do |model_index| -%>
|
144
116
|
<% if webrat? -%>
|
145
|
-
rendered.should have_selector("td>a[href]:not([disabled])", :href => edit_<%=
|
117
|
+
rendered.should have_selector("td>a[href]:not([disabled])", :href => edit_<%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1)
|
146
118
|
<% else -%>
|
147
|
-
assert_select "td>a[href=?]:not([disabled])", edit_<%=
|
119
|
+
assert_select "td>a[href=?]:not([disabled])", edit_<%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1
|
148
120
|
<% end -%>
|
149
121
|
<% end -%>
|
150
122
|
end
|
@@ -157,9 +129,9 @@ describe "<%= ns_table_name %>/index" do
|
|
157
129
|
render
|
158
130
|
<% [1,2].each do |model_index| -%>
|
159
131
|
<% if webrat? -%>
|
160
|
-
rendered.should_not have_selector("td>a[href][data-method=delete][disabled=disabled]", :href => <%=
|
132
|
+
rendered.should_not have_selector("td>a[href][data-method=delete][disabled=disabled]", :href => <%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1)
|
161
133
|
<% else -%>
|
162
|
-
assert_select "td>a[href=?][data-method=delete][disabled=disabled]", <%=
|
134
|
+
assert_select "td>a[href=?][data-method=delete][disabled=disabled]", <%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1
|
163
135
|
<% end -%>
|
164
136
|
<% end -%>
|
165
137
|
end
|
@@ -170,9 +142,9 @@ describe "<%= ns_table_name %>/index" do
|
|
170
142
|
render
|
171
143
|
<% [1,2].each do |model_index| -%>
|
172
144
|
<% if webrat? -%>
|
173
|
-
rendered.should have_selector("td>a[href][data-method=delete]:not([disabled])", :href => <%=
|
145
|
+
rendered.should have_selector("td>a[href][data-method=delete]:not([disabled])", :href => <%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1)
|
174
146
|
<% else -%>
|
175
|
-
assert_select "td>a[href=?][data-method=delete]:not([disabled])", <%=
|
147
|
+
assert_select "td>a[href=?][data-method=delete]:not([disabled])", <%= t_helper.controller_show_route "@#{var_name}_#{model_index}" %>, :count => 1
|
176
148
|
<% end -%>
|
177
149
|
<% end -%>
|
178
150
|
end
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
<%-
|
4
4
|
|
5
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
6
|
+
|
5
7
|
local_class_name = class_name.split('::')[-1] # Non-Namespaced class name
|
6
8
|
var_name = file_name # Non-namespaced variable name
|
7
9
|
|
@@ -9,28 +11,15 @@ output_attributes = attributes.reject{|attribute| [:timestamp].include? attrib
|
|
9
11
|
standard_attributes = attributes.reject{|attribute| [:time, :date, :datetime].include? attribute.type }
|
10
12
|
datetime_attributes = attributes.reject{|attribute| ![:time, :date, :datetime].include? attribute.type }
|
11
13
|
|
12
|
-
# Returns code that will generate attribute_value as an attribute_type
|
13
|
-
def factory_attribute_value(attribute_type, attribute_value)
|
14
|
-
case attribute_type
|
15
|
-
when :datetime
|
16
|
-
"DateTime.parse(#{attribute_value})"
|
17
|
-
when :time
|
18
|
-
value_as_time = attribute_value.to_time.strftime('%T')
|
19
|
-
"Time.parse(#{value_as_time.dump})"
|
20
|
-
when :date
|
21
|
-
value_as_date = attribute_value.to_time.strftime('%Y-%m-%d')
|
22
|
-
"Date.parse(#{value_as_date.dump})"
|
23
|
-
else
|
24
|
-
attribute_value
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
14
|
-%>
|
29
15
|
describe "<%= ns_table_name %>/new" do
|
30
16
|
before(:each) do
|
17
|
+
<%- AuthorizedRailsScaffolds::PARENT_MODELS.each do |model| -%>
|
18
|
+
@<%= model.underscore %> = assign(:<%= model.underscore %>, FactoryGirl.build_stubbed(:<%= model.underscore %>))
|
19
|
+
<%- end -%>
|
31
20
|
assign(:<%= var_name %>, FactoryGirl.build(:<%= var_name %><%= output_attributes.empty? ? '))' : ',' %>
|
32
21
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
33
|
-
:<%= attribute.name %> => <%= factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
22
|
+
:<%= attribute.name %> => <%= t_helper.factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
34
23
|
<% end -%>
|
35
24
|
<%= !output_attributes.empty? ? " ))\n end" : " end" %>
|
36
25
|
|
@@ -38,7 +27,7 @@ describe "<%= ns_table_name %>/new" do
|
|
38
27
|
render
|
39
28
|
|
40
29
|
<% if webrat? -%>
|
41
|
-
rendered.should have_selector("form", :action => <%=
|
30
|
+
rendered.should have_selector("form", :action => <%= t_helper.controller_index_path %>, :method => "post") do |form|
|
42
31
|
<% for attribute in standard_attributes -%>
|
43
32
|
<%- if attribute.type == :references -%>
|
44
33
|
form.should have_selector("select#<%= var_name %>_<%= attribute.name %>_id", :name => "<%= var_name %>[<%= attribute.name %>_id]")
|
@@ -49,7 +38,7 @@ describe "<%= ns_table_name %>/new" do
|
|
49
38
|
end
|
50
39
|
<% else -%>
|
51
40
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
52
|
-
assert_select "form[action=?][method=?]", <%=
|
41
|
+
assert_select "form[action=?][method=?]", <%= t_helper.controller_index_path %>, "post" do
|
53
42
|
<% for attribute in standard_attributes -%>
|
54
43
|
<%- if attribute.type == :references -%>
|
55
44
|
assert_select "select#<%= var_name %>_<%= attribute.name %>_id[name=?]", "<%= var_name %>[<%= attribute.name %>_id]"
|
@@ -66,7 +55,7 @@ describe "<%= ns_table_name %>/new" do
|
|
66
55
|
render
|
67
56
|
|
68
57
|
<% if webrat? -%>
|
69
|
-
rendered.should have_selector("form", :action => <%=
|
58
|
+
rendered.should have_selector("form", :action => <%= t_helper.controller_index_path %>, :method => "post") do |form|
|
70
59
|
<% for attribute in datetime_attributes -%>
|
71
60
|
<%- if [:date, :datetime].include? attribute.type -%>
|
72
61
|
form.should have_selector("select#<%= var_name %>_<%= attribute.name %>", :name => "<%= var_name %>[<%= attribute.name %>]")
|
@@ -81,7 +70,7 @@ describe "<%= ns_table_name %>/new" do
|
|
81
70
|
end
|
82
71
|
<% else -%>
|
83
72
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
84
|
-
assert_select "form[action=?][method=?]", <%=
|
73
|
+
assert_select "form[action=?][method=?]", <%= t_helper.controller_index_path %>, "post" do
|
85
74
|
<% for attribute in datetime_attributes -%>
|
86
75
|
# <%= attribute.name %> values
|
87
76
|
<%- if [:date, :datetime].include? attribute.type -%>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
<% module_namespacing do -%>
|
4
|
+
<%-
|
5
|
+
|
6
|
+
parts = ns_table_name.split('/')[0..-2] || []
|
7
|
+
|
8
|
+
AuthorizedRailsScaffolds::PARENT_MODELS.each_with_index do |model, model_index|
|
9
|
+
parts << model.underscore.pluralize
|
10
|
+
parts << model_index + 2
|
11
|
+
end
|
12
|
+
|
13
|
+
parts << ns_table_name.split('/')[-1]
|
14
|
+
request_path = parts.join('/')
|
15
|
+
|
16
|
+
extra_arguments = ''
|
17
|
+
if AuthorizedRailsScaffolds::PARENT_MODELS.any?
|
18
|
+
AuthorizedRailsScaffolds::PARENT_MODELS.each_with_index do |model, model_index|
|
19
|
+
extra_arguments += ", :#{model.underscore}_id => \"#{model_index + 2}\""
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
-%>
|
24
|
+
describe <%= controller_class_name %>Controller do
|
25
|
+
describe "routing" do
|
26
|
+
|
27
|
+
<% unless options[:singleton] -%>
|
28
|
+
it "routes to #index" do
|
29
|
+
get("/<%= request_path %>").should route_to("<%= ns_table_name %>#index"<%= extra_arguments %>)
|
30
|
+
end
|
31
|
+
|
32
|
+
<% end -%>
|
33
|
+
it "routes to #new" do
|
34
|
+
get("/<%= request_path %>/new").should route_to("<%= ns_table_name %>#new"<%= extra_arguments %>)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "routes to #show" do
|
38
|
+
get("/<%= request_path %>/1").should route_to("<%= ns_table_name %>#show"<%= extra_arguments %>, :id => "1")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "routes to #edit" do
|
42
|
+
get("/<%= request_path %>/1/edit").should route_to("<%= ns_table_name %>#edit"<%= extra_arguments %>, :id => "1")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "routes to #create" do
|
46
|
+
post("/<%= request_path %>").should route_to("<%= ns_table_name %>#create"<%= extra_arguments %>)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "routes to #update" do
|
50
|
+
put("/<%= request_path %>/1").should route_to("<%= ns_table_name %>#update"<%= extra_arguments %>, :id => "1")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "routes to #destroy" do
|
54
|
+
delete("/<%= request_path %>/1").should route_to("<%= ns_table_name %>#destroy"<%= extra_arguments %>, :id => "1")
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
<% end -%>
|
@@ -2,53 +2,23 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
<%-
|
4
4
|
|
5
|
+
t_helper = AuthorizedRailsScaffolds::Helper.new(class_name, singular_table_name, file_name)
|
6
|
+
|
5
7
|
local_class_name = class_name.split('::')[-1] # Non-Namespaced class name
|
6
8
|
var_name = file_name # Non-namespaced variable name
|
7
9
|
|
8
10
|
output_attributes = attributes.reject{|attribute| [:timestamp, :references].include? attribute.type }
|
9
11
|
references_attributes = attributes.reject{|attribute| ![:references].include? attribute.type }
|
10
12
|
|
11
|
-
path_prefix = ns_file_name[0..-(file_name.length+1)]
|
12
|
-
|
13
|
-
# Returns code that will generate attribute_value as an attribute_type
|
14
|
-
def factory_attribute_value(attribute_type, attribute_value)
|
15
|
-
case attribute_type
|
16
|
-
when :datetime
|
17
|
-
"DateTime.parse(#{attribute_value})"
|
18
|
-
when :time
|
19
|
-
value_as_time = attribute_value.to_time.strftime('%T')
|
20
|
-
"Time.parse(#{value_as_time.dump})"
|
21
|
-
when :date
|
22
|
-
value_as_date = attribute_value.to_time.strftime('%Y-%m-%d')
|
23
|
-
"Date.parse(#{value_as_date.dump})"
|
24
|
-
else
|
25
|
-
attribute_value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns the expected output string of attribute_value if it is an attribute_type
|
30
|
-
def factory_attribute_string(attribute_type, attribute_value)
|
31
|
-
case attribute_type
|
32
|
-
when :datetime
|
33
|
-
attribute_value_as_date = DateTime.parse(attribute_value)
|
34
|
-
I18n.l(attribute_value_as_date, :format => :long).dump
|
35
|
-
when :time
|
36
|
-
attribute_value_as_time = Time.parse(attribute_value)
|
37
|
-
I18n.l(attribute_value_as_time, :format => :short).dump
|
38
|
-
when :date
|
39
|
-
attribute_value_as_date = Date.parse(attribute_value)
|
40
|
-
I18n.l(attribute_value_as_date).dump
|
41
|
-
else
|
42
|
-
attribute_value
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
13
|
-%>
|
47
14
|
describe "<%= ns_table_name %>/show" do
|
48
15
|
before(:each) do
|
16
|
+
<%- AuthorizedRailsScaffolds::PARENT_MODELS.each do |model| -%>
|
17
|
+
@<%= model.underscore %> = assign(:<%= model.underscore %>, FactoryGirl.build_stubbed(:<%= model.underscore %>))
|
18
|
+
<%- end -%>
|
49
19
|
@<%= var_name %> = FactoryGirl.build_stubbed(:<%= var_name %><%= output_attributes.empty? ? ')' : ',' %>
|
50
20
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
51
|
-
:<%= attribute.name %> => <%= factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
21
|
+
:<%= attribute.name %> => <%= t_helper.factory_attribute_value attribute.type, value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
52
22
|
<% end -%>
|
53
23
|
<% if !output_attributes.empty? -%>
|
54
24
|
)
|
@@ -66,10 +36,10 @@ describe "<%= ns_table_name %>/show" do
|
|
66
36
|
<% for attribute in output_attributes -%>
|
67
37
|
<% if webrat? -%>
|
68
38
|
rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>)
|
69
|
-
rendered.should have_selector("dl>dd", :content => <%= factory_attribute_string attribute.type, value_for(attribute) %>.to_s)
|
39
|
+
rendered.should have_selector("dl>dd", :content => <%= t_helper.factory_attribute_string attribute.type, value_for(attribute) %>.to_s)
|
70
40
|
<% else -%>
|
71
41
|
assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>
|
72
|
-
assert_select "dl>dd", :text => <%= factory_attribute_string attribute.type, value_for(attribute) %>.to_s
|
42
|
+
assert_select "dl>dd", :text => <%= t_helper.factory_attribute_string attribute.type, value_for(attribute) %>.to_s
|
73
43
|
<% end -%>
|
74
44
|
<% end -%>
|
75
45
|
end
|
@@ -84,10 +54,10 @@ describe "<%= ns_table_name %>/show" do
|
|
84
54
|
render
|
85
55
|
<% if webrat? -%>
|
86
56
|
rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>, :count => 0)
|
87
|
-
rendered.should have_selector("dl>dd>a[href]", :href => <%=
|
57
|
+
rendered.should have_selector("dl>dd>a[href]", :href => <%= t_helper.references_show_route attribute.name %>, :count => 0)
|
88
58
|
<% else -%>
|
89
59
|
assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>, :count => 0
|
90
|
-
assert_select "dl>dd>a[href=?]", <%=
|
60
|
+
assert_select "dl>dd>a[href=?]", <%= t_helper.references_show_route attribute.name %>, :count => 0
|
91
61
|
<% end -%>
|
92
62
|
end
|
93
63
|
end
|
@@ -99,10 +69,10 @@ describe "<%= ns_table_name %>/show" do
|
|
99
69
|
render
|
100
70
|
<% if webrat? -%>
|
101
71
|
rendered.should have_selector("dl>dt", :content => <%= "#{attribute.human_name}:".dump %>)
|
102
|
-
rendered.should have_selector("dl>dd>a[href]", :href => <%=
|
72
|
+
rendered.should have_selector("dl>dd>a[href]", :href => <%= t_helper.references_show_route attribute.name %>, :count => 1)
|
103
73
|
<% else -%>
|
104
74
|
assert_select "dl>dt", :text => <%= "#{attribute.human_name}:".dump %>
|
105
|
-
assert_select "dl>dd>a[href=?]", <%=
|
75
|
+
assert_select "dl>dd>a[href=?]", <%= t_helper.references_show_route attribute.name %>, :count => 1
|
106
76
|
<% end -%>
|
107
77
|
end
|
108
78
|
end
|
metadata
CHANGED
@@ -1,49 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authorized_rails_scaffolds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- bmorrall
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: railties
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.1'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: bundler
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '1.3'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: rake
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
45
|
- - ! '>='
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '0'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
description: Creates scaffolds for Twitter Bootstrap with generated RSpec coverage
|
48
56
|
email:
|
49
57
|
- bemo56@hotmail.com
|
@@ -65,6 +73,7 @@ files:
|
|
65
73
|
- lib/generators/authorized_rails_scaffolds/install_scaffold/templates/controller.rb
|
66
74
|
- lib/generators/authorized_rails_scaffolds/install_scaffold/templates/edit.html.erb
|
67
75
|
- lib/generators/authorized_rails_scaffolds/install_scaffold/templates/index.html.erb
|
76
|
+
- lib/generators/authorized_rails_scaffolds/install_scaffold/templates/initializer.rb
|
68
77
|
- lib/generators/authorized_rails_scaffolds/install_scaffold/templates/new.html.erb
|
69
78
|
- lib/generators/authorized_rails_scaffolds/install_scaffold/templates/show.html.erb
|
70
79
|
- lib/generators/authorized_rails_scaffolds/install_spec/USAGE
|
@@ -76,31 +85,31 @@ files:
|
|
76
85
|
- lib/generators/authorized_rails_scaffolds/install_spec/templates/index_spec.rb
|
77
86
|
- lib/generators/authorized_rails_scaffolds/install_spec/templates/model_spec.rb
|
78
87
|
- lib/generators/authorized_rails_scaffolds/install_spec/templates/new_spec.rb
|
88
|
+
- lib/generators/authorized_rails_scaffolds/install_spec/templates/routing_spec.rb
|
79
89
|
- lib/generators/authorized_rails_scaffolds/install_spec/templates/show_spec.rb
|
80
90
|
homepage: https://github.com/bmorrall/authorized_rails_scaffolds
|
81
91
|
licenses:
|
82
92
|
- MIT
|
93
|
+
metadata: {}
|
83
94
|
post_install_message:
|
84
95
|
rdoc_options: []
|
85
96
|
require_paths:
|
86
97
|
- lib
|
87
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
99
|
requirements:
|
90
100
|
- - ! '>='
|
91
101
|
- !ruby/object:Gem::Version
|
92
102
|
version: '0'
|
93
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
104
|
requirements:
|
96
105
|
- - ! '>='
|
97
106
|
- !ruby/object:Gem::Version
|
98
107
|
version: '0'
|
99
108
|
requirements: []
|
100
109
|
rubyforge_project:
|
101
|
-
rubygems_version:
|
110
|
+
rubygems_version: 2.0.3
|
102
111
|
signing_key:
|
103
|
-
specification_version:
|
112
|
+
specification_version: 4
|
104
113
|
summary: Replaces Rails and RSpec's default generators with templates taking full
|
105
114
|
advantage of Authentication (Devise), Authorization (CanCan) and Test Coverage (RSpec)
|
106
115
|
test_files: []
|