silmarails 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -9
  3. data/Rakefile +1 -7
  4. data/lib/generators/silmarails/install/files/templates/rspec/scaffold/controller_spec.rb +64 -0
  5. data/lib/silmarails/version.rb +1 -1
  6. metadata +27 -121
  7. data/test/dummy/README.rdoc +0 -28
  8. data/test/dummy/Rakefile +0 -6
  9. data/test/dummy/app/assets/javascripts/application.js +0 -13
  10. data/test/dummy/app/assets/stylesheets/application.css +0 -15
  11. data/test/dummy/app/controllers/application_controller.rb +0 -5
  12. data/test/dummy/app/helpers/application_helper.rb +0 -2
  13. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  14. data/test/dummy/bin/bundle +0 -3
  15. data/test/dummy/bin/rails +0 -4
  16. data/test/dummy/bin/rake +0 -4
  17. data/test/dummy/bin/setup +0 -29
  18. data/test/dummy/config.ru +0 -4
  19. data/test/dummy/config/application.rb +0 -26
  20. data/test/dummy/config/boot.rb +0 -5
  21. data/test/dummy/config/database.yml +0 -25
  22. data/test/dummy/config/environment.rb +0 -5
  23. data/test/dummy/config/environments/development.rb +0 -41
  24. data/test/dummy/config/environments/production.rb +0 -79
  25. data/test/dummy/config/environments/test.rb +0 -42
  26. data/test/dummy/config/initializers/assets.rb +0 -11
  27. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  28. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  29. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  30. data/test/dummy/config/initializers/inflections.rb +0 -16
  31. data/test/dummy/config/initializers/mime_types.rb +0 -4
  32. data/test/dummy/config/initializers/session_store.rb +0 -3
  33. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  34. data/test/dummy/config/locales/en.yml +0 -23
  35. data/test/dummy/config/routes.rb +0 -56
  36. data/test/dummy/config/secrets.yml +0 -22
  37. data/test/dummy/lib/templates/rspec/controller/controller_spec.rb +0 -16
  38. data/test/dummy/lib/templates/rspec/controller/view_spec.rb +0 -5
  39. data/test/dummy/lib/templates/rspec/helper/helper_spec.rb +0 -17
  40. data/test/dummy/lib/templates/rspec/integration/request_spec.rb +0 -10
  41. data/test/dummy/lib/templates/rspec/mailer/fixture +0 -3
  42. data/test/dummy/lib/templates/rspec/mailer/mailer_spec.rb +0 -25
  43. data/test/dummy/lib/templates/rspec/mailer/preview.rb +0 -13
  44. data/test/dummy/lib/templates/rspec/model/fixtures.yml +0 -19
  45. data/test/dummy/lib/templates/rspec/model/model_spec.rb +0 -7
  46. data/test/dummy/lib/templates/rspec/observer/observer_spec.rb +0 -7
  47. data/test/dummy/lib/templates/rspec/scaffold/controller_spec.rb +0 -163
  48. data/test/dummy/lib/templates/rspec/scaffold/edit_spec.rb +0 -23
  49. data/test/dummy/lib/templates/rspec/scaffold/index_spec.rb +0 -25
  50. data/test/dummy/lib/templates/rspec/scaffold/new_spec.rb +0 -22
  51. data/test/dummy/lib/templates/rspec/scaffold/routing_spec.rb +0 -45
  52. data/test/dummy/lib/templates/rspec/scaffold/show_spec.rb +0 -21
  53. data/test/dummy/lib/templates/rspec/view/view_spec.rb +0 -5
  54. data/test/dummy/public/404.html +0 -67
  55. data/test/dummy/public/422.html +0 -67
  56. data/test/dummy/public/500.html +0 -66
  57. data/test/dummy/public/favicon.ico +0 -0
  58. data/test/integration/navigation_test.rb +0 -8
  59. data/test/silmarails_test.rb +0 -7
  60. data/test/test_helper.rb +0 -20
@@ -1,56 +0,0 @@
1
- Rails.application.routes.draw do
2
- # The priority is based upon order of creation: first created -> highest priority.
3
- # See how all your routes lay out with "rake routes".
4
-
5
- # You can have the root of your site routed with "root"
6
- # root 'welcome#index'
7
-
8
- # Example of regular route:
9
- # get 'products/:id' => 'catalog#view'
10
-
11
- # Example of named route that can be invoked with purchase_url(id: product.id)
12
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
-
14
- # Example resource route (maps HTTP verbs to controller actions automatically):
15
- # resources :products
16
-
17
- # Example resource route with options:
18
- # resources :products do
19
- # member do
20
- # get 'short'
21
- # post 'toggle'
22
- # end
23
- #
24
- # collection do
25
- # get 'sold'
26
- # end
27
- # end
28
-
29
- # Example resource route with sub-resources:
30
- # resources :products do
31
- # resources :comments, :sales
32
- # resource :seller
33
- # end
34
-
35
- # Example resource route with more complex sub-resources:
36
- # resources :products do
37
- # resources :comments
38
- # resources :sales do
39
- # get 'recent', on: :collection
40
- # end
41
- # end
42
-
43
- # Example resource route with concerns:
44
- # concern :toggleable do
45
- # post 'toggle'
46
- # end
47
- # resources :posts, concerns: :toggleable
48
- # resources :photos, concerns: :toggleable
49
-
50
- # Example resource route within a namespace:
51
- # namespace :admin do
52
- # # Directs /admin/products/* to Admin::ProductsController
53
- # # (app/controllers/admin/products_controller.rb)
54
- # resources :products
55
- # end
56
- end
@@ -1,22 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure the secrets in this file are kept private
11
- # if you're sharing your code publicly.
12
-
13
- development:
14
- secret_key_base: 0df984cb47df1ec397284d41fe4e65c6cf9c1b149dbfdbdc34b4af7e2bf0323484a6aeaa87fe96e8d223c7aadfcdabad9cd00f2fb3d94b731d629174a0290279
15
-
16
- test:
17
- secret_key_base: 8557f019102a1082114f4b870ee3c07b24ae2a13aaa46f14d142ed0e3a617f2335356e18bee0da0f74fe7df78be00c5709164c55c767fcf3d1c7cf5679f0f4cb
18
-
19
- # Do not keep production secrets in the repository,
20
- # instead read values from the environment.
21
- production:
22
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -1,16 +0,0 @@
1
- require 'rails_helper'
2
-
3
- <% module_namespacing do -%>
4
- RSpec.describe <%= class_name %>Controller, <%= type_metatag(:controller) %> do
5
-
6
- <% for action in actions -%>
7
- describe "GET #<%= action %>" do
8
- it "returns http success" do
9
- get :<%= action %>
10
- expect(response).to have_http_status(:success)
11
- end
12
- end
13
-
14
- <% end -%>
15
- end
16
- <% end -%>
@@ -1,5 +0,0 @@
1
- require 'rails_helper'
2
-
3
- RSpec.describe "<%= file_name %>/<%= @action %>.html.<%= options[:template_engine] %>", <%= type_metatag(:view) %> do
4
- pending "add some examples to (or delete) #{__FILE__}"
5
- end
@@ -1,17 +0,0 @@
1
- require 'rails_helper'
2
-
3
- # Specs in this file have access to a helper object that includes
4
- # the <%= class_name %>Helper. For example:
5
- #
6
- # describe <%= class_name %>Helper do
7
- # describe "string concat" do
8
- # it "concats two strings with spaces" do
9
- # expect(helper.concat_strings("this","that")).to eq("this that")
10
- # end
11
- # end
12
- # end
13
- <% module_namespacing do -%>
14
- RSpec.describe <%= class_name %>Helper, <%= type_metatag(:helper) %> do
15
- pending "add some examples to (or delete) #{__FILE__}"
16
- end
17
- <% end -%>
@@ -1,10 +0,0 @@
1
- require 'rails_helper'
2
-
3
- RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:request) %> do
4
- describe "GET /<%= table_name %>" do
5
- it "works! (now write some real specs)" do
6
- get <%= index_helper %>_path
7
- expect(response).to have_http_status(200)
8
- end
9
- end
10
- end
@@ -1,3 +0,0 @@
1
- <%= class_name %>#<%= @action %>
2
-
3
- Hi, find me in app/views/<%= @path %>
@@ -1,25 +0,0 @@
1
- require "rails_helper"
2
-
3
- <% module_namespacing do -%>
4
- RSpec.describe <%= class_name %>, <%= type_metatag(:mailer) %> do
5
- <% for action in actions -%>
6
- describe "<%= action %>" do
7
- let(:mail) { <%= class_name %>.<%= action %> }
8
-
9
- it "renders the headers" do
10
- expect(mail.subject).to eq(<%= action.to_s.humanize.inspect %>)
11
- expect(mail.to).to eq(["to@example.org"])
12
- expect(mail.from).to eq(["from@example.com"])
13
- end
14
-
15
- it "renders the body" do
16
- expect(mail.body.encoded).to match("Hi")
17
- end
18
- end
19
-
20
- <% end -%>
21
- <% if actions.blank? -%>
22
- pending "add some examples to (or delete) #{__FILE__}"
23
- <% end -%>
24
- end
25
- <% end -%>
@@ -1,13 +0,0 @@
1
- <% module_namespacing do -%>
2
- # Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>
3
- class <%= class_name %>Preview < ActionMailer::Preview
4
- <% actions.each do |action| -%>
5
-
6
- # Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>/<%= action %>
7
- def <%= action %>
8
- <%= class_name %>.<%= action %>
9
- end
10
- <% end -%>
11
-
12
- end
13
- <% end -%>
@@ -1,19 +0,0 @@
1
- # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
-
3
- <% unless attributes.empty? -%>
4
- one:
5
- <% for attribute in attributes -%>
6
- <%= attribute.name %>: <%= attribute.default %>
7
- <% end -%>
8
-
9
- two:
10
- <% for attribute in attributes -%>
11
- <%= attribute.name %>: <%= attribute.default %>
12
- <% end -%>
13
- <% else -%>
14
- # one:
15
- # column: value
16
- #
17
- # two:
18
- # column: value
19
- <% end -%>
@@ -1,7 +0,0 @@
1
- require 'rails_helper'
2
-
3
- <% module_namespacing do -%>
4
- RSpec.describe <%= class_name %>, <%= type_metatag(:model) %> do
5
- pending "add some examples to (or delete) #{__FILE__}"
6
- end
7
- <% end -%>
@@ -1,7 +0,0 @@
1
- require 'rails_helper'
2
-
3
- <% module_namespacing do -%>
4
- RSpec.describe <%= class_name %>Observer, <%= type_metatag(:observer) %> do
5
- pending "add some examples to (or delete) #{__FILE__}"
6
- end
7
- <% end -%>
@@ -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) { {} }
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 -%>
@@ -1,23 +0,0 @@
1
- require 'rails_helper'
2
-
3
- <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
- RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
5
- before(:each) do
6
- @<%= ns_file_name %> = assign(:<%= ns_file_name %>, <%= class_name %>.create!(<%= '))' if output_attributes.empty? %>
7
- <% output_attributes.each_with_index do |attribute, attribute_index| -%>
8
- :<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
9
- <% end -%>
10
- <%= output_attributes.empty? ? "" : " ))\n" -%>
11
- end
12
-
13
- it "renders the edit <%= ns_file_name %> form" do
14
- render
15
-
16
- assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(@<%= ns_file_name %>), "post" do
17
- <% for attribute in output_attributes -%>
18
- <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
19
- assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
20
- <% end -%>
21
- end
22
- end
23
- end
@@ -1,25 +0,0 @@
1
- require 'rails_helper'
2
-
3
- <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
- RSpec.describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
5
- before(:each) do
6
- assign(:<%= table_name %>, [
7
- <% [1,2].each_with_index do |id, model_index| -%>
8
- <%= class_name %>.create!(<%= output_attributes.empty? ? (model_index == 1 ? ')' : '),') : '' %>
9
- <% output_attributes.each_with_index do |attribute, attribute_index| -%>
10
- :<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
11
- <% end -%>
12
- <% if !output_attributes.empty? -%>
13
- <%= model_index == 1 ? ')' : '),' %>
14
- <% end -%>
15
- <% end -%>
16
- ])
17
- end
18
-
19
- it "renders a list of <%= ns_table_name %>" do
20
- render
21
- <% for attribute in output_attributes -%>
22
- assert_select "tr>td", :text => <%= value_for(attribute) %>.to_s, :count => 2
23
- <% end -%>
24
- end
25
- end
@@ -1,22 +0,0 @@
1
- require 'rails_helper'
2
-
3
- <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4
- RSpec.describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do
5
- before(:each) do
6
- assign(:<%= ns_file_name %>, <%= class_name %>.new(<%= '))' if output_attributes.empty? %>
7
- <% output_attributes.each_with_index do |attribute, attribute_index| -%>
8
- :<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
9
- <% end -%>
10
- <%= !output_attributes.empty? ? " ))\n end" : " end" %>
11
-
12
- it "renders new <%= ns_file_name %> form" do
13
- render
14
-
15
- assert_select "form[action=?][method=?]", <%= index_helper %>_path, "post" do
16
- <% for attribute in output_attributes -%>
17
- <%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
18
- assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
19
- <% end -%>
20
- end
21
- end
22
- end