model_base_generators 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/example/.gitignore +1 -0
- data/example/.model_base/controllers +5 -0
- data/example/.rubocop.yml +31 -0
- data/example/Gemfile +1 -1
- data/example/Gemfile.lock +14 -1
- data/example/app/controllers/concerns/authentication.rb +2 -2
- data/example/app/models/ability.rb +1 -2
- data/example/app/models/issue.rb +0 -1
- data/example/app/models/user.rb +3 -2
- data/example/app/views/issue_comments/_issue_comment.json.jbuilder +1 -1
- data/example/app/views/issue_comments/_table.html.erb +1 -1
- data/example/app/views/issue_comments/index.html.erb +1 -1
- data/example/app/views/issue_comments/index.json.jbuilder +1 -1
- data/example/app/views/issue_comments/show.json.jbuilder +1 -1
- data/example/app/views/issues/_table.html.erb +1 -1
- data/example/app/views/issues/index.html.erb +1 -1
- data/example/app/views/phases/_table.html.erb +1 -1
- data/example/app/views/phases/index.html.erb +1 -1
- data/example/app/views/project_assignments/_table.html.erb +1 -1
- data/example/app/views/project_assignments/index.html.erb +1 -1
- data/example/app/views/projects/_table.html.erb +1 -1
- data/example/app/views/projects/index.html.erb +1 -1
- data/example/config/application.rb +1 -1
- data/example/config/environments/development.rb +1 -1
- data/example/config/environments/production.rb +2 -2
- data/example/config/environments/test.rb +1 -1
- data/example/config/initializers/pretty_validation.rb +1 -1
- data/example/config/puma.rb +3 -3
- data/example/db/schema.rb +9 -9
- data/example/spec/controllers/issue_comments_controller_spec.rb +73 -61
- data/example/spec/controllers/issues_controller_spec.rb +71 -59
- data/example/spec/controllers/phases_controller_spec.rb +72 -60
- data/example/spec/controllers/project_assignments_controller_spec.rb +72 -60
- data/example/spec/controllers/projects_controller_spec.rb +70 -58
- data/example/spec/factories/issue_comments.rb +1 -1
- data/example/spec/factories/issues.rb +1 -1
- data/example/spec/factories/phases.rb +3 -3
- data/example/spec/factories/project_assignments.rb +2 -2
- data/example/spec/factories/projects.rb +1 -1
- data/example/spec/factories/users.rb +2 -2
- data/example/spec/rails_helper.rb +1 -1
- data/example/spec/requests/issue_comments_spec.rb +4 -4
- data/example/spec/routing/issue_comments_routing_spec.rb +18 -20
- data/example/spec/routing/issues_routing_spec.rb +18 -20
- data/example/spec/routing/phases_routing_spec.rb +18 -20
- data/example/spec/routing/project_assignments_routing_spec.rb +18 -20
- data/example/spec/routing/projects_routing_spec.rb +18 -20
- data/example/spec/spec_helper.rb +47 -49
- data/example/spec/support/controller_macros.rb +3 -3
- data/example/spec/support/devise.rb +2 -2
- data/example/spec/support/time_match_support.rb +9 -0
- data/example/spec/views/issue_comments/edit.html.erb_spec.rb +12 -11
- data/example/spec/views/issue_comments/index.html.erb_spec.rb +12 -12
- data/example/spec/views/issue_comments/new.html.erb_spec.rb +12 -11
- data/example/spec/views/issue_comments/show.html.erb_spec.rb +7 -6
- data/example/spec/views/issues/edit.html.erb_spec.rb +12 -11
- data/example/spec/views/issues/index.html.erb_spec.rb +13 -13
- data/example/spec/views/issues/new.html.erb_spec.rb +12 -11
- data/example/spec/views/issues/show.html.erb_spec.rb +6 -5
- data/example/spec/views/phases/edit.html.erb_spec.rb +9 -8
- data/example/spec/views/phases/index.html.erb_spec.rb +12 -12
- data/example/spec/views/phases/new.html.erb_spec.rb +9 -8
- data/example/spec/views/phases/show.html.erb_spec.rb +8 -7
- data/example/spec/views/project_assignments/edit.html.erb_spec.rb +10 -9
- data/example/spec/views/project_assignments/index.html.erb_spec.rb +11 -11
- data/example/spec/views/project_assignments/new.html.erb_spec.rb +10 -9
- data/example/spec/views/project_assignments/show.html.erb_spec.rb +8 -7
- data/example/spec/views/projects/edit.html.erb_spec.rb +9 -8
- data/example/spec/views/projects/index.html.erb_spec.rb +10 -10
- data/example/spec/views/projects/new.html.erb_spec.rb +9 -8
- data/example/spec/views/projects/show.html.erb_spec.rb +5 -4
- data/exe/model_base +33 -0
- data/lib/generators/model_base/install_generator.rb +1 -0
- data/lib/generators/model_base/templates/app/controllers/concerns/authentication.rb +2 -2
- data/lib/generators/model_base/templates/spec/support/time_match_support.rb +9 -0
- data/lib/model_base/column_attribute.rb +2 -2
- data/lib/model_base/config.rb +6 -0
- data/lib/model_base/generators/model_support.rb +8 -0
- data/lib/model_base/generators/rails/scaffold_controller.rb +25 -0
- data/lib/model_base/generators.rb +33 -0
- data/lib/model_base/meta_model.rb +2 -2
- data/lib/model_base/railtie.rb +1 -1
- data/lib/model_base/version.rb +1 -1
- data/lib/model_base.rb +24 -13
- data/lib/templates/erb/scaffold/_table.html.erb +1 -1
- data/lib/templates/erb/scaffold/index.html.erb +1 -1
- data/lib/templates/factory_girl/factory.rb +1 -1
- data/lib/templates/rspec/scaffold/controller_spec.rb +71 -59
- data/lib/templates/rspec/scaffold/edit_spec.rb +5 -4
- data/lib/templates/rspec/scaffold/index_spec.rb +8 -8
- data/lib/templates/rspec/scaffold/new_spec.rb +5 -4
- data/lib/templates/rspec/scaffold/routing_spec.rb +18 -20
- data/lib/templates/rspec/scaffold/show_spec.rb +4 -3
- metadata +11 -3
@@ -19,149 +19,161 @@ require 'rails_helper'
|
|
19
19
|
# that an instance is receiving a specific message.
|
20
20
|
|
21
21
|
RSpec.describe ProjectsController, type: :controller do
|
22
|
-
|
23
|
-
let(:
|
24
|
-
before{ devise_user_login(user) }
|
25
|
-
|
26
|
-
let(:project){ FactoryGirl.create(:project, owner: user) }
|
22
|
+
let(:user) { FactoryGirl.create(:user) }
|
23
|
+
let(:project) { FactoryGirl.create(:project, owner: user) }
|
24
|
+
before { devise_user_login(user) }
|
27
25
|
|
28
26
|
# This should return the minimal set of attributes required to create a valid
|
29
27
|
# Project. As you add validations to Project, be sure to
|
30
28
|
# adjust the attributes here as well.
|
31
|
-
let(:valid_parameters)
|
29
|
+
let(:valid_parameters) do
|
32
30
|
FactoryGirl.attributes_for(:project).merge(owner_id: user.id)
|
33
|
-
|
31
|
+
end
|
34
32
|
|
35
|
-
let(:invalid_parameters)
|
33
|
+
let(:invalid_parameters) do
|
36
34
|
valid_parameters.symbolize_keys.merge(name: '')
|
37
|
-
|
35
|
+
end
|
38
36
|
|
39
37
|
# This should return the minimal set of values that should be in the session
|
40
38
|
# in order to pass any filters (e.g. authentication) defined in
|
41
39
|
# ProjectsController. Be sure to keep this updated too.
|
42
40
|
let(:valid_session) { {} }
|
43
41
|
|
44
|
-
describe
|
45
|
-
it
|
46
|
-
get :index,
|
42
|
+
describe 'GET #index' do
|
43
|
+
it 'assigns all projects as @projects' do
|
44
|
+
get :index, session: valid_session,
|
45
|
+
params: {}
|
47
46
|
expect(assigns(:projects)).to eq([project])
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
|
-
describe
|
52
|
-
it
|
50
|
+
describe 'GET #show' do
|
51
|
+
it 'assigns the requested project as @project' do
|
53
52
|
project # To create project
|
54
|
-
get :show,
|
53
|
+
get :show, session: valid_session,
|
54
|
+
params: { id: project.to_param }
|
55
55
|
expect(assigns(:project)).to eq(project)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
describe
|
60
|
-
it
|
61
|
-
get :new,
|
59
|
+
describe 'GET #new' do
|
60
|
+
it 'assigns a new project as @project' do
|
61
|
+
get :new, session: valid_session,
|
62
|
+
params: {}
|
62
63
|
expect(assigns(:project)).to be_a_new(Project)
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
|
-
describe
|
67
|
-
it
|
67
|
+
describe 'GET #edit' do
|
68
|
+
it 'assigns the requested project as @project' do
|
68
69
|
project # To create project
|
69
|
-
get :edit,
|
70
|
+
get :edit, session: valid_session,
|
71
|
+
params: { id: project.to_param }
|
70
72
|
expect(assigns(:project)).to eq(project)
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
74
|
-
describe
|
75
|
-
context
|
76
|
-
it
|
76
|
+
describe 'POST #create' do
|
77
|
+
context 'with valid params' do
|
78
|
+
it 'creates a new Project' do
|
77
79
|
expect {
|
78
|
-
post :create,
|
80
|
+
post :create, session: valid_session,
|
81
|
+
params: { project: valid_parameters }
|
79
82
|
}.to change(Project, :count).by(1)
|
80
83
|
end
|
81
84
|
|
82
|
-
it
|
83
|
-
post :create,
|
85
|
+
it 'assigns a newly created project as @project' do
|
86
|
+
post :create, session: valid_session,
|
87
|
+
params: { project: valid_parameters }
|
84
88
|
expect(assigns(:project)).to be_a(Project)
|
85
89
|
expect(assigns(:project)).to be_persisted
|
86
90
|
end
|
87
91
|
|
88
|
-
it
|
89
|
-
post :create,
|
92
|
+
it 'redirects to the created project' do
|
93
|
+
post :create, session: valid_session,
|
94
|
+
params: { project: valid_parameters }
|
90
95
|
expect(response).to redirect_to(Project.last)
|
91
96
|
end
|
92
97
|
end
|
93
98
|
|
94
|
-
context
|
95
|
-
it
|
96
|
-
post :create,
|
99
|
+
context 'with invalid params' do
|
100
|
+
it 'assigns a newly created but unsaved project as @project' do
|
101
|
+
post :create, session: valid_session,
|
102
|
+
params: { project: invalid_parameters }
|
97
103
|
expect(assigns(:project)).to be_a_new(Project)
|
98
104
|
end
|
99
105
|
|
100
106
|
it "re-renders the 'new' template" do
|
101
|
-
post :create,
|
102
|
-
|
107
|
+
post :create, session: valid_session,
|
108
|
+
params: { project: invalid_parameters }
|
109
|
+
expect(response).to render_template('new')
|
103
110
|
end
|
104
111
|
end
|
105
112
|
end
|
106
113
|
|
107
|
-
describe
|
108
|
-
context
|
109
|
-
let(:new_name){ valid_parameters[:name].succ }
|
110
|
-
let(:new_closed){ valid_parameters[:closed].! }
|
111
|
-
|
112
|
-
let(:new_parameters) {
|
114
|
+
describe 'PUT #update' do
|
115
|
+
context 'with valid params' do
|
116
|
+
let(:new_name) { valid_parameters[:name].succ }
|
117
|
+
let(:new_closed) { valid_parameters[:closed].! }
|
118
|
+
let(:new_parameters) do
|
113
119
|
valid_parameters.merge(name: new_name, closed: new_closed)
|
114
|
-
|
120
|
+
end
|
115
121
|
|
116
|
-
it
|
122
|
+
it 'updates the requested project' do
|
117
123
|
project # To create project
|
118
|
-
put :update,
|
124
|
+
put :update, session: valid_session,
|
125
|
+
params: { id: project.to_param, project: new_parameters }
|
119
126
|
project.reload
|
120
127
|
expect(project.name).to eq new_name
|
121
128
|
expect(project.closed).to eq new_closed
|
122
129
|
end
|
123
130
|
|
124
|
-
it
|
131
|
+
it 'assigns the requested project as @project' do
|
125
132
|
project # To create project
|
126
|
-
put :update,
|
133
|
+
put :update, session: valid_session,
|
134
|
+
params: { id: project.to_param, project: new_parameters }
|
127
135
|
expect(assigns(:project)).to eq(project)
|
128
136
|
end
|
129
137
|
|
130
|
-
it
|
138
|
+
it 'redirects to the project' do
|
131
139
|
project # To create project
|
132
|
-
put :update,
|
140
|
+
put :update, session: valid_session,
|
141
|
+
params: { id: project.to_param, project: new_parameters }
|
133
142
|
expect(response).to redirect_to(project)
|
134
143
|
end
|
135
144
|
end
|
136
145
|
|
137
|
-
context
|
138
|
-
it
|
146
|
+
context 'with invalid params' do
|
147
|
+
it 'assigns the project as @project' do
|
139
148
|
project # To create project
|
140
|
-
put :update,
|
149
|
+
put :update, session: valid_session,
|
150
|
+
params: { id: project.to_param, project: invalid_parameters }
|
141
151
|
expect(assigns(:project)).to eq(project)
|
142
152
|
end
|
143
153
|
|
144
154
|
it "re-renders the 'edit' template" do
|
145
155
|
project # To create project
|
146
|
-
put :update,
|
147
|
-
|
156
|
+
put :update, session: valid_session,
|
157
|
+
params: { id: project.to_param, project: invalid_parameters }
|
158
|
+
expect(response).to render_template('edit')
|
148
159
|
end
|
149
160
|
end
|
150
161
|
end
|
151
162
|
|
152
|
-
describe
|
153
|
-
it
|
163
|
+
describe 'DELETE #destroy' do
|
164
|
+
it 'destroys the requested project' do
|
154
165
|
project # To create project
|
155
166
|
expect {
|
156
|
-
delete :destroy,
|
167
|
+
delete :destroy, session: valid_session,
|
168
|
+
params: { id: project.to_param }
|
157
169
|
}.to change(Project, :count).by(-1)
|
158
170
|
end
|
159
171
|
|
160
|
-
it
|
172
|
+
it 'redirects to the projects list' do
|
161
173
|
project # To create project
|
162
|
-
delete :destroy,
|
174
|
+
delete :destroy, session: valid_session,
|
175
|
+
params: { id: project.to_param }
|
163
176
|
expect(response).to redirect_to(projects_url)
|
164
177
|
end
|
165
178
|
end
|
166
|
-
|
167
179
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :phase do
|
3
3
|
association :project, factory: :project
|
4
|
-
name
|
5
|
-
started_at
|
6
|
-
finished_at
|
4
|
+
name 'phase1'
|
5
|
+
started_at '2020-01-29 02:50:00 +09:00'
|
6
|
+
finished_at '2020-01-29 16:40:00 +09:00'
|
7
7
|
end
|
8
8
|
end
|
@@ -2,7 +2,7 @@ FactoryGirl.define do
|
|
2
2
|
factory :project_assignment do
|
3
3
|
association :project, factory: :project
|
4
4
|
association :user, factory: :user
|
5
|
-
started_at
|
6
|
-
finished_at
|
5
|
+
started_at '2020-03-22 09:50:00 +09:00'
|
6
|
+
finished_at '2020-03-22 23:40:00 +09:00'
|
7
7
|
end
|
8
8
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
ENV['RAILS_ENV'] ||= 'test'
|
3
3
|
require File.expand_path('../../config/environment', __FILE__)
|
4
4
|
# Prevent database truncation if the environment is production
|
5
|
-
abort(
|
5
|
+
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
6
6
|
require 'spec_helper'
|
7
7
|
require 'rspec/rails'
|
8
8
|
# Add additional requires below this line. Rails is not loaded until this point!
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe 'IssueComments', type: :request do
|
4
4
|
let(:user) { FactoryGirl.create(:user) }
|
5
|
-
before{ login_as(user, :
|
5
|
+
before { login_as(user, scope: :user) }
|
6
6
|
|
7
|
-
describe
|
8
|
-
it
|
7
|
+
describe 'GET /issue_comments' do
|
8
|
+
it 'works! (now write some real specs)' do
|
9
9
|
get issue_comments_path
|
10
10
|
expect(response).to have_http_status(200)
|
11
11
|
end
|
@@ -1,39 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
3
|
RSpec.describe IssueCommentsController, type: :routing do
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
7
|
-
expect(:get => "/issue_comments").to route_to("issue_comments#index")
|
4
|
+
describe 'routing' do
|
5
|
+
it 'routes to #index' do
|
6
|
+
expect(get: '/issue_comments').to route_to('issue_comments#index')
|
8
7
|
end
|
9
8
|
|
10
|
-
it
|
11
|
-
expect(:
|
9
|
+
it 'routes to #new' do
|
10
|
+
expect(get: '/issue_comments/new').to route_to('issue_comments#new')
|
12
11
|
end
|
13
12
|
|
14
|
-
it
|
15
|
-
expect(:
|
13
|
+
it 'routes to #show' do
|
14
|
+
expect(get: '/issue_comments/1').to route_to('issue_comments#show', id: '1')
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
19
|
-
expect(:
|
17
|
+
it 'routes to #edit' do
|
18
|
+
expect(get: '/issue_comments/1/edit').to route_to('issue_comments#edit', id: '1')
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
23
|
-
expect(:
|
21
|
+
it 'routes to #create' do
|
22
|
+
expect(post: '/issue_comments').to route_to('issue_comments#create')
|
24
23
|
end
|
25
24
|
|
26
|
-
it
|
27
|
-
expect(:
|
25
|
+
it 'routes to #update via PUT' do
|
26
|
+
expect(put: '/issue_comments/1').to route_to('issue_comments#update', id: '1')
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
31
|
-
expect(:
|
29
|
+
it 'routes to #update via PATCH' do
|
30
|
+
expect(patch: '/issue_comments/1').to route_to('issue_comments#update', id: '1')
|
32
31
|
end
|
33
32
|
|
34
|
-
it
|
35
|
-
expect(:
|
33
|
+
it 'routes to #destroy' do
|
34
|
+
expect(delete: '/issue_comments/1').to route_to('issue_comments#destroy', id: '1')
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|
@@ -1,39 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
3
|
RSpec.describe IssuesController, type: :routing do
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
7
|
-
expect(:get => "/issues").to route_to("issues#index")
|
4
|
+
describe 'routing' do
|
5
|
+
it 'routes to #index' do
|
6
|
+
expect(get: '/issues').to route_to('issues#index')
|
8
7
|
end
|
9
8
|
|
10
|
-
it
|
11
|
-
expect(:
|
9
|
+
it 'routes to #new' do
|
10
|
+
expect(get: '/issues/new').to route_to('issues#new')
|
12
11
|
end
|
13
12
|
|
14
|
-
it
|
15
|
-
expect(:
|
13
|
+
it 'routes to #show' do
|
14
|
+
expect(get: '/issues/1').to route_to('issues#show', id: '1')
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
19
|
-
expect(:
|
17
|
+
it 'routes to #edit' do
|
18
|
+
expect(get: '/issues/1/edit').to route_to('issues#edit', id: '1')
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
23
|
-
expect(:
|
21
|
+
it 'routes to #create' do
|
22
|
+
expect(post: '/issues').to route_to('issues#create')
|
24
23
|
end
|
25
24
|
|
26
|
-
it
|
27
|
-
expect(:
|
25
|
+
it 'routes to #update via PUT' do
|
26
|
+
expect(put: '/issues/1').to route_to('issues#update', id: '1')
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
31
|
-
expect(:
|
29
|
+
it 'routes to #update via PATCH' do
|
30
|
+
expect(patch: '/issues/1').to route_to('issues#update', id: '1')
|
32
31
|
end
|
33
32
|
|
34
|
-
it
|
35
|
-
expect(:
|
33
|
+
it 'routes to #destroy' do
|
34
|
+
expect(delete: '/issues/1').to route_to('issues#destroy', id: '1')
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|
@@ -1,39 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
3
|
RSpec.describe PhasesController, type: :routing do
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
7
|
-
expect(:get => "/phases").to route_to("phases#index")
|
4
|
+
describe 'routing' do
|
5
|
+
it 'routes to #index' do
|
6
|
+
expect(get: '/phases').to route_to('phases#index')
|
8
7
|
end
|
9
8
|
|
10
|
-
it
|
11
|
-
expect(:
|
9
|
+
it 'routes to #new' do
|
10
|
+
expect(get: '/phases/new').to route_to('phases#new')
|
12
11
|
end
|
13
12
|
|
14
|
-
it
|
15
|
-
expect(:
|
13
|
+
it 'routes to #show' do
|
14
|
+
expect(get: '/phases/1').to route_to('phases#show', id: '1')
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
19
|
-
expect(:
|
17
|
+
it 'routes to #edit' do
|
18
|
+
expect(get: '/phases/1/edit').to route_to('phases#edit', id: '1')
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
23
|
-
expect(:
|
21
|
+
it 'routes to #create' do
|
22
|
+
expect(post: '/phases').to route_to('phases#create')
|
24
23
|
end
|
25
24
|
|
26
|
-
it
|
27
|
-
expect(:
|
25
|
+
it 'routes to #update via PUT' do
|
26
|
+
expect(put: '/phases/1').to route_to('phases#update', id: '1')
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
31
|
-
expect(:
|
29
|
+
it 'routes to #update via PATCH' do
|
30
|
+
expect(patch: '/phases/1').to route_to('phases#update', id: '1')
|
32
31
|
end
|
33
32
|
|
34
|
-
it
|
35
|
-
expect(:
|
33
|
+
it 'routes to #destroy' do
|
34
|
+
expect(delete: '/phases/1').to route_to('phases#destroy', id: '1')
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|
@@ -1,39 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
3
|
RSpec.describe ProjectAssignmentsController, type: :routing do
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
7
|
-
expect(:get => "/project_assignments").to route_to("project_assignments#index")
|
4
|
+
describe 'routing' do
|
5
|
+
it 'routes to #index' do
|
6
|
+
expect(get: '/project_assignments').to route_to('project_assignments#index')
|
8
7
|
end
|
9
8
|
|
10
|
-
it
|
11
|
-
expect(:
|
9
|
+
it 'routes to #new' do
|
10
|
+
expect(get: '/project_assignments/new').to route_to('project_assignments#new')
|
12
11
|
end
|
13
12
|
|
14
|
-
it
|
15
|
-
expect(:
|
13
|
+
it 'routes to #show' do
|
14
|
+
expect(get: '/project_assignments/1').to route_to('project_assignments#show', id: '1')
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
19
|
-
expect(:
|
17
|
+
it 'routes to #edit' do
|
18
|
+
expect(get: '/project_assignments/1/edit').to route_to('project_assignments#edit', id: '1')
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
23
|
-
expect(:
|
21
|
+
it 'routes to #create' do
|
22
|
+
expect(post: '/project_assignments').to route_to('project_assignments#create')
|
24
23
|
end
|
25
24
|
|
26
|
-
it
|
27
|
-
expect(:
|
25
|
+
it 'routes to #update via PUT' do
|
26
|
+
expect(put: '/project_assignments/1').to route_to('project_assignments#update', id: '1')
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
31
|
-
expect(:
|
29
|
+
it 'routes to #update via PATCH' do
|
30
|
+
expect(patch: '/project_assignments/1').to route_to('project_assignments#update', id: '1')
|
32
31
|
end
|
33
32
|
|
34
|
-
it
|
35
|
-
expect(:
|
33
|
+
it 'routes to #destroy' do
|
34
|
+
expect(delete: '/project_assignments/1').to route_to('project_assignments#destroy', id: '1')
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|
@@ -1,39 +1,37 @@
|
|
1
|
-
require
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
3
|
RSpec.describe ProjectsController, type: :routing do
|
4
|
-
describe
|
5
|
-
|
6
|
-
|
7
|
-
expect(:get => "/projects").to route_to("projects#index")
|
4
|
+
describe 'routing' do
|
5
|
+
it 'routes to #index' do
|
6
|
+
expect(get: '/projects').to route_to('projects#index')
|
8
7
|
end
|
9
8
|
|
10
|
-
it
|
11
|
-
expect(:
|
9
|
+
it 'routes to #new' do
|
10
|
+
expect(get: '/projects/new').to route_to('projects#new')
|
12
11
|
end
|
13
12
|
|
14
|
-
it
|
15
|
-
expect(:
|
13
|
+
it 'routes to #show' do
|
14
|
+
expect(get: '/projects/1').to route_to('projects#show', id: '1')
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
19
|
-
expect(:
|
17
|
+
it 'routes to #edit' do
|
18
|
+
expect(get: '/projects/1/edit').to route_to('projects#edit', id: '1')
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
23
|
-
expect(:
|
21
|
+
it 'routes to #create' do
|
22
|
+
expect(post: '/projects').to route_to('projects#create')
|
24
23
|
end
|
25
24
|
|
26
|
-
it
|
27
|
-
expect(:
|
25
|
+
it 'routes to #update via PUT' do
|
26
|
+
expect(put: '/projects/1').to route_to('projects#update', id: '1')
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
31
|
-
expect(:
|
29
|
+
it 'routes to #update via PATCH' do
|
30
|
+
expect(patch: '/projects/1').to route_to('projects#update', id: '1')
|
32
31
|
end
|
33
32
|
|
34
|
-
it
|
35
|
-
expect(:
|
33
|
+
it 'routes to #destroy' do
|
34
|
+
expect(delete: '/projects/1').to route_to('projects#destroy', id: '1')
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
37
|
end
|