genesis_rails 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c9a4db021003c7fea7b1660cd22d960d387c987
4
- data.tar.gz: 5ecad4eef16b9582eec752cd0ece7d8053ded68e
3
+ metadata.gz: 36f07cca581a0890575ac3fbf3173f1d02310df6
4
+ data.tar.gz: 2d5e841cf1478d9577ee68486b6fb7d94131393a
5
5
  SHA512:
6
- metadata.gz: d873f72af1f5c8947520d2f5c8d8f9746dcda68547d72c9a5baa713f0686a5078e3d737c01b176f1514fc1e95f4fa4bddba6fdeede335507e05bbe2847cd9e42
7
- data.tar.gz: c83b3f2c36b9b2f7bbe0f3101ae52daa03208f5b832d5e6e27ade57702a8ea41def904127304472abf400071044cf184693d877183d9a1b12078e9c43460deed
6
+ metadata.gz: f55d892cc41c94f627f06b191dc7572d819c0206a082cdcec45ee4a92d60e2527309bcfb11c8625c0c6a84451bf1cc37fd234c058620903a463a2b60034da801
7
+ data.tar.gz: 7d850697c7856e3ae576f28be1df33a1ffe5653d35da421d5c4d7f889d8e9661a27a03c74786ea720fa5e1accfa6f3f9bdfec68d9442e83e11fd7302e023e95a
data/Rakefile CHANGED
@@ -33,5 +33,27 @@ Rake::TestTask.new(:test) do |t|
33
33
  t.verbose = false
34
34
  end
35
35
 
36
-
37
36
  task default: :test
37
+
38
+ namespace :spec do
39
+ namespace :templates do
40
+ # desc "Copy all the templates from rspec to the application directory for customization. Already existing local copies will be overwritten"
41
+ task :copy do
42
+ generators_lib = File.join(Gem.loaded_specs["rspec-rails"].full_gem_path, "lib/generators")
43
+ project_templates = "#{Rails.root}/lib/templates"
44
+
45
+ default_templates = { "rspec" => %w{controller helper integration mailer model observer scaffold view} }
46
+
47
+ default_templates.each do |type, names|
48
+ local_template_type_dir = File.join(project_templates, type)
49
+ FileUtils.mkdir_p local_template_type_dir
50
+
51
+ names.each do |name|
52
+ dst_name = File.join(local_template_type_dir, name)
53
+ src_name = File.join(generators_lib, type, name, "templates")
54
+ FileUtils.cp_r src_name, dst_name
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,3 +1,3 @@
1
1
  module GenesisRails
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genesis_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kelvinst
@@ -96,7 +96,6 @@ files:
96
96
  - lib/genesis_rails/templates/erb/scaffold/new.html.erb
97
97
  - lib/genesis_rails/templates/erb/scaffold/show.html.erb
98
98
  - lib/genesis_rails/templates/rails/scaffold_controller/controller.rb
99
- - lib/genesis_rails/templates/rspec/scaffold/controller_spec.rb
100
99
  - lib/genesis_rails/version.rb
101
100
  - lib/tasks/genesis_rails_tasks.rake
102
101
  - test/dummy/README.rdoc
@@ -129,7 +128,6 @@ files:
129
128
  - test/dummy/config/locales/en.yml
130
129
  - test/dummy/config/routes.rb
131
130
  - test/dummy/config/secrets.yml
132
- - test/dummy/log/development.log
133
131
  - test/dummy/public/404.html
134
132
  - test/dummy/public/422.html
135
133
  - test/dummy/public/500.html
@@ -190,7 +188,6 @@ test_files:
190
188
  - test/dummy/config/routes.rb
191
189
  - test/dummy/config/secrets.yml
192
190
  - test/dummy/config.ru
193
- - test/dummy/log/development.log
194
191
  - test/dummy/public/404.html
195
192
  - test/dummy/public/422.html
196
193
  - test/dummy/public/500.html
@@ -1,163 +0,0 @@
1
- require 'rails_helper'
2
-
3
- # This spec was generated by rspec-rails when you ran the scaffold generator.
4
- # It demonstrates how one might use RSpec to specify the controller code that
5
- # was generated by Rails when you ran the scaffold generator.
6
- #
7
- # It assumes that the implementation code is generated by the rails scaffold
8
- # generator. If you are using any extension libraries to generate different
9
- # controller code, this generated spec may or may not pass.
10
- #
11
- # It only uses APIs available in rails and/or rspec-rails. There are a number
12
- # of tools you can use to make these specs even more expressive, but we're
13
- # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
- #
15
- # Compared to earlier versions of this generator, there is very limited use of
16
- # stubs and message expectations in this spec. Stubs are only used when there
17
- # is no simpler way to get a handle on the object needed for the example.
18
- # Message expectations are only used when there is no simpler way to specify
19
- # that an instance is receiving a specific message.
20
-
21
- <% module_namespacing do -%>
22
- RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:controller) %> do
23
-
24
- # This should return the minimal set of attributes required to create a valid
25
- # <%= class_name %>. As you add validations to <%= class_name %>, be sure to
26
- # adjust the attributes here as well.
27
- let(:valid_attributes) {
28
- skip("Add a hash of attributes valid for your model")
29
- }
30
-
31
- let(:invalid_attributes) {
32
- skip("Add a hash of attributes invalid for your model")
33
- }
34
-
35
- # This should return the minimal set of values that should be in the session
36
- # in order to pass any filters (e.g. authentication) defined in
37
- # <%= controller_class_name %>Controller. Be sure to keep this updated too.
38
- let(:valid_session) { valid_session_hash }
39
-
40
- <% unless options[:singleton] -%>
41
- describe "GET #index" do
42
- it "assigns all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do
43
- <%= file_name %> = <%= class_name %>.create! valid_attributes
44
- get :index, {}, valid_session
45
- expect(assigns(:<%= table_name %>)).to eq([<%= file_name %>])
46
- end
47
- end
48
-
49
- <% end -%>
50
- describe "GET #show" do
51
- it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
52
- <%= file_name %> = <%= class_name %>.create! valid_attributes
53
- get :show, {:id => <%= file_name %>.to_param}, valid_session
54
- expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
55
- end
56
- end
57
-
58
- describe "GET #new" do
59
- it "assigns a new <%= ns_file_name %> as @<%= ns_file_name %>" do
60
- get :new, {}, valid_session
61
- expect(assigns(:<%= ns_file_name %>)).to be_a_new(<%= class_name %>)
62
- end
63
- end
64
-
65
- describe "GET #edit" do
66
- it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
67
- <%= file_name %> = <%= class_name %>.create! valid_attributes
68
- get :edit, {:id => <%= file_name %>.to_param}, valid_session
69
- expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
70
- end
71
- end
72
-
73
- describe "POST #create" do
74
- context "with valid params" do
75
- it "creates a new <%= class_name %>" do
76
- expect {
77
- post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
78
- }.to change(<%= class_name %>, :count).by(1)
79
- end
80
-
81
- it "assigns a newly created <%= ns_file_name %> as @<%= ns_file_name %>" do
82
- post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
83
- expect(assigns(:<%= ns_file_name %>)).to be_a(<%= class_name %>)
84
- expect(assigns(:<%= ns_file_name %>)).to be_persisted
85
- end
86
-
87
- it "redirects to the created <%= ns_file_name %>" do
88
- post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
89
- expect(response).to redirect_to(<%= class_name %>.last)
90
- end
91
- end
92
-
93
- context "with invalid params" do
94
- it "assigns a newly created but unsaved <%= ns_file_name %> as @<%= ns_file_name %>" do
95
- post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
96
- expect(assigns(:<%= ns_file_name %>)).to be_a_new(<%= class_name %>)
97
- end
98
-
99
- it "re-renders the 'new' template" do
100
- post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
101
- expect(response).to render_template("new")
102
- end
103
- end
104
- end
105
-
106
- describe "PUT #update" do
107
- context "with valid params" do
108
- let(:new_attributes) {
109
- skip("Add a hash of attributes valid for your model")
110
- }
111
-
112
- it "updates the requested <%= ns_file_name %>" do
113
- <%= file_name %> = <%= class_name %>.create! valid_attributes
114
- put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => new_attributes}, valid_session
115
- <%= file_name %>.reload
116
- skip("Add assertions for updated state")
117
- end
118
-
119
- it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
120
- <%= file_name %> = <%= class_name %>.create! valid_attributes
121
- put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
122
- expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
123
- end
124
-
125
- it "redirects to the <%= ns_file_name %>" do
126
- <%= file_name %> = <%= class_name %>.create! valid_attributes
127
- put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
128
- expect(response).to redirect_to(<%= file_name %>)
129
- end
130
- end
131
-
132
- context "with invalid params" do
133
- it "assigns the <%= ns_file_name %> as @<%= ns_file_name %>" do
134
- <%= file_name %> = <%= class_name %>.create! valid_attributes
135
- put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
136
- expect(assigns(:<%= ns_file_name %>)).to eq(<%= file_name %>)
137
- end
138
-
139
- it "re-renders the 'edit' template" do
140
- <%= file_name %> = <%= class_name %>.create! valid_attributes
141
- put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
142
- expect(response).to render_template("edit")
143
- end
144
- end
145
- end
146
-
147
- describe "DELETE #destroy" do
148
- it "destroys the requested <%= ns_file_name %>" do
149
- <%= file_name %> = <%= class_name %>.create! valid_attributes
150
- expect {
151
- delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
152
- }.to change(<%= class_name %>, :count).by(-1)
153
- end
154
-
155
- it "redirects to the <%= table_name %> list" do
156
- <%= file_name %> = <%= class_name %>.create! valid_attributes
157
- delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
158
- expect(response).to redirect_to(<%= index_helper %>_url)
159
- end
160
- end
161
-
162
- end
163
- <% end -%>
File without changes