enju_biblio 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/icons/book.png +0 -0
- data/app/assets/images/icons/cd.png +0 -0
- data/app/assets/images/icons/dvd.png +0 -0
- data/app/assets/images/icons/monitor.png +0 -0
- data/app/controllers/carrier_types_controller.rb +8 -3
- data/app/controllers/manifestations_controller.rb +17 -4
- data/app/controllers/picture_files_controller.rb +1 -1
- data/app/controllers/series_statements_controller.rb +6 -0
- data/app/helpers/manifestations_helper.rb +1 -1
- data/app/models/agent_import_file_transition.rb +1 -0
- data/app/models/carrier_type.rb +11 -7
- data/app/models/import_request_transition.rb +1 -0
- data/app/models/manifestation.rb +5 -0
- data/app/models/resource_export_file_transition.rb +1 -0
- data/app/models/resource_import_file_transition.rb +1 -0
- data/app/views/carrier_types/index.html.erb +4 -1
- data/app/views/manifestations/_show_detail_librarian.html.erb +4 -0
- data/app/views/manifestations/index.html.erb +3 -0
- data/config/locales/translation_en.yml +2 -0
- data/config/locales/translation_ja.yml +2 -0
- data/lib/enju_biblio/biblio_helper.rb +1 -12
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/generators/enju_biblio/setup/templates/config/schedule.rb +3 -3
- data/lib/tasks/carrier_type.rb +30 -18
- data/lib/tasks/enju_biblio_tasks.rake +2 -0
- data/spec/controllers/agent_import_files_controller_spec.rb +87 -87
- data/spec/controllers/agent_import_results_controller_spec.rb +22 -22
- data/spec/controllers/agent_merge_lists_controller_spec.rb +157 -157
- data/spec/controllers/agent_merges_controller_spec.rb +151 -151
- data/spec/controllers/agent_relationship_types_controller_spec.rb +152 -152
- data/spec/controllers/agent_relationships_controller_spec.rb +153 -153
- data/spec/controllers/agent_types_controller_spec.rb +49 -50
- data/spec/controllers/agents_controller_spec.rb +234 -234
- data/spec/controllers/carrier_types_controller_spec.rb +123 -103
- data/spec/controllers/content_types_controller_spec.rb +51 -52
- data/spec/controllers/countries_controller_spec.rb +156 -156
- data/spec/controllers/create_types_controller_spec.rb +48 -49
- data/spec/controllers/creates_controller_spec.rb +154 -154
- data/spec/controllers/donates_controller_spec.rb +153 -153
- data/spec/controllers/form_of_works_controller_spec.rb +48 -49
- data/spec/controllers/frequencies_controller_spec.rb +51 -52
- data/spec/controllers/identifier_types_controller_spec.rb +48 -49
- data/spec/controllers/import_requests_controller_spec.rb +165 -164
- data/spec/controllers/items_controller_spec.rb +214 -216
- data/spec/controllers/languages_controller_spec.rb +109 -109
- data/spec/controllers/licenses_controller_spec.rb +48 -49
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +152 -152
- data/spec/controllers/manifestation_relationships_controller_spec.rb +153 -153
- data/spec/controllers/manifestations_controller_spec.rb +319 -289
- data/spec/controllers/medium_of_performances_controller_spec.rb +48 -49
- data/spec/controllers/owns_controller_spec.rb +153 -153
- data/spec/controllers/picture_files_controller_spec.rb +156 -156
- data/spec/controllers/produce_types_controller_spec.rb +48 -49
- data/spec/controllers/produces_controller_spec.rb +154 -154
- data/spec/controllers/realize_types_controller_spec.rb +48 -49
- data/spec/controllers/realizes_controller_spec.rb +155 -155
- data/spec/controllers/resource_export_files_controller_spec.rb +72 -72
- data/spec/controllers/resource_import_files_controller_spec.rb +90 -90
- data/spec/controllers/resource_import_results_controller_spec.rb +43 -43
- data/spec/controllers/series_statement_merge_lists_controller_spec.rb +153 -153
- data/spec/controllers/series_statement_merges_controller_spec.rb +151 -151
- data/spec/controllers/series_statements_controller_spec.rb +154 -154
- data/spec/factories/checkout.rb +9 -0
- data/spec/factories/library.rb +13 -0
- data/spec/factories/shelf.rb +6 -0
- data/spec/fixtures/carrier_types.yml +11 -7
- data/spec/models/carrier_type_spec.rb +11 -7
- data/spec/models/resource_export_file_spec.rb +58 -16
- data/spec/support/resque.rb +0 -1
- data/spec/views/manifestations/show.html.erb_spec.rb +5 -0
- data/spec/views/resource_import_files/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_files/show.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/index.html.erb_spec.rb +1 -1
- data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
- metadata +49 -39
@@ -29,113 +29,113 @@ describe RealizeTypesController do
|
|
29
29
|
FactoryGirl.attributes_for(:realize_type)
|
30
30
|
end
|
31
31
|
|
32
|
-
describe
|
33
|
-
it
|
32
|
+
describe 'GET index' do
|
33
|
+
it 'assigns all realize_types as @realize_types' do
|
34
34
|
realize_type = RealizeType.create! valid_attributes
|
35
35
|
get :index
|
36
36
|
expect(assigns(:realize_types)).to eq(RealizeType.order(:position))
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
it
|
40
|
+
describe 'GET show' do
|
41
|
+
it 'assigns the requested realize_type as @realize_type' do
|
42
42
|
realize_type = RealizeType.create! valid_attributes
|
43
|
-
get :show, :
|
43
|
+
get :show, id: realize_type.id
|
44
44
|
expect(assigns(:realize_type)).to eq(realize_type)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
it
|
48
|
+
describe 'GET new' do
|
49
|
+
it 'assigns a new realize_type as @realize_type' do
|
50
50
|
get :new
|
51
51
|
expect(assigns(:realize_type)).to be_a_new(RealizeType)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe
|
56
|
-
it
|
55
|
+
describe 'GET edit' do
|
56
|
+
it 'assigns the requested realize_type as @realize_type' do
|
57
57
|
realize_type = RealizeType.create! valid_attributes
|
58
|
-
get :edit, :
|
58
|
+
get :edit, id: realize_type.id
|
59
59
|
expect(assigns(:realize_type)).to eq(realize_type)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
describe
|
64
|
-
describe
|
65
|
-
it
|
66
|
-
expect
|
67
|
-
post :create, :
|
68
|
-
|
63
|
+
describe 'POST create' do
|
64
|
+
describe 'with valid params' do
|
65
|
+
it 'creates a new RealizeType' do
|
66
|
+
expect do
|
67
|
+
post :create, realize_type: valid_attributes
|
68
|
+
end.to change(RealizeType, :count).by(1)
|
69
69
|
end
|
70
70
|
|
71
|
-
it
|
72
|
-
post :create, :
|
71
|
+
it 'assigns a newly created realize_type as @realize_type' do
|
72
|
+
post :create, realize_type: valid_attributes
|
73
73
|
expect(assigns(:realize_type)).to be_a(RealizeType)
|
74
74
|
expect(assigns(:realize_type)).to be_persisted
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
post :create, :
|
77
|
+
it 'redirects to the created realize_type' do
|
78
|
+
post :create, realize_type: valid_attributes
|
79
79
|
expect(response).to redirect_to(RealizeType.last)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
describe
|
84
|
-
it
|
83
|
+
describe 'with invalid params' do
|
84
|
+
it 'assigns a newly created but unsaved realize_type as @realize_type' do
|
85
85
|
# Trigger the behavior that occurs when invalid params are submitted
|
86
86
|
RealizeType.any_instance.stub(:save).and_return(false)
|
87
|
-
post :create, :
|
87
|
+
post :create, realize_type: { name: 'test' }
|
88
88
|
expect(assigns(:realize_type)).to be_a_new(RealizeType)
|
89
89
|
end
|
90
90
|
|
91
91
|
it "re-renders the 'new' template" do
|
92
92
|
# Trigger the behavior that occurs when invalid params are submitted
|
93
93
|
RealizeType.any_instance.stub(:save).and_return(false)
|
94
|
-
post :create, :
|
95
|
-
#expect(response).to render_template("new")
|
94
|
+
post :create, realize_type: { name: 'test' }
|
95
|
+
# expect(response).to render_template("new")
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
describe
|
101
|
-
describe
|
102
|
-
it
|
100
|
+
describe 'PUT update' do
|
101
|
+
describe 'with valid params' do
|
102
|
+
it 'updates the requested realize_type' do
|
103
103
|
realize_type = RealizeType.create! valid_attributes
|
104
104
|
# Assuming there are no other realize_types in the database, this
|
105
105
|
# specifies that the RealizeType created on the previous line
|
106
106
|
# receives the :update_attributes message with whatever params are
|
107
107
|
# submitted in the request.
|
108
|
-
RealizeType.any_instance.should_receive(:update_attributes).with(
|
109
|
-
put :update, :
|
108
|
+
RealizeType.any_instance.should_receive(:update_attributes).with('name' => 'test')
|
109
|
+
put :update, id: realize_type.id, realize_type: { 'name' => 'test' }
|
110
110
|
end
|
111
111
|
|
112
|
-
it
|
112
|
+
it 'assigns the requested realize_type as @realize_type' do
|
113
113
|
realize_type = RealizeType.create! valid_attributes
|
114
|
-
put :update, :
|
114
|
+
put :update, id: realize_type.id, realize_type: valid_attributes
|
115
115
|
expect(assigns(:realize_type)).to eq(realize_type)
|
116
116
|
end
|
117
117
|
|
118
|
-
it
|
118
|
+
it 'redirects to the realize_type' do
|
119
119
|
realize_type = RealizeType.create! valid_attributes
|
120
|
-
put :update, :
|
120
|
+
put :update, id: realize_type.id, realize_type: valid_attributes
|
121
121
|
expect(response).to redirect_to(realize_type)
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
124
|
+
it 'moves its position when specified' do
|
125
125
|
realize_type = RealizeType.create! valid_attributes
|
126
126
|
position = realize_type.position
|
127
|
-
put :update, :
|
127
|
+
put :update, id: realize_type.id, move: 'higher'
|
128
128
|
expect(response).to redirect_to realize_types_url
|
129
129
|
assigns(:realize_type).reload.position.should eq position - 1
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
describe
|
134
|
-
it
|
133
|
+
describe 'with invalid params' do
|
134
|
+
it 'assigns the realize_type as @realize_type' do
|
135
135
|
realize_type = RealizeType.create! valid_attributes
|
136
136
|
# Trigger the behavior that occurs when invalid params are submitted
|
137
137
|
RealizeType.any_instance.stub(:save).and_return(false)
|
138
|
-
put :update, :
|
138
|
+
put :update, id: realize_type.id, realize_type: { name: 'test' }
|
139
139
|
expect(assigns(:realize_type)).to eq(realize_type)
|
140
140
|
end
|
141
141
|
|
@@ -143,25 +143,24 @@ describe RealizeTypesController do
|
|
143
143
|
realize_type = RealizeType.create! valid_attributes
|
144
144
|
# Trigger the behavior that occurs when invalid params are submitted
|
145
145
|
RealizeType.any_instance.stub(:save).and_return(false)
|
146
|
-
put :update, :
|
147
|
-
#expect(response).to render_template("edit")
|
146
|
+
put :update, id: realize_type.id, realize_type: { name: 'test' }
|
147
|
+
# expect(response).to render_template("edit")
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
|
-
describe
|
153
|
-
it
|
152
|
+
describe 'DELETE destroy' do
|
153
|
+
it 'destroys the requested realize_type' do
|
154
154
|
realize_type = RealizeType.create! valid_attributes
|
155
|
-
expect
|
156
|
-
delete :destroy, :
|
157
|
-
|
155
|
+
expect do
|
156
|
+
delete :destroy, id: realize_type.id
|
157
|
+
end.to change(RealizeType, :count).by(-1)
|
158
158
|
end
|
159
159
|
|
160
|
-
it
|
160
|
+
it 'redirects to the realize_types list' do
|
161
161
|
realize_type = RealizeType.create! valid_attributes
|
162
|
-
delete :destroy, :
|
162
|
+
delete :destroy, id: realize_type.id
|
163
163
|
expect(response).to redirect_to(realize_types_url)
|
164
164
|
end
|
165
165
|
end
|
166
|
-
|
167
166
|
end
|
@@ -5,113 +5,113 @@ describe RealizesController do
|
|
5
5
|
fixtures :all
|
6
6
|
disconnect_sunspot
|
7
7
|
|
8
|
-
describe
|
9
|
-
describe
|
8
|
+
describe 'GET index' do
|
9
|
+
describe 'When logged in as Administrator' do
|
10
10
|
login_fixture_admin
|
11
11
|
|
12
|
-
it
|
12
|
+
it 'assigns all realizes as @realizes' do
|
13
13
|
get :index
|
14
14
|
expect(assigns(:realizes)).to eq(Realize.page(1))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
describe
|
18
|
+
describe 'When logged in as Librarian' do
|
19
19
|
login_fixture_librarian
|
20
20
|
|
21
|
-
it
|
21
|
+
it 'assigns all realizes as @realizes' do
|
22
22
|
get :index
|
23
23
|
expect(assigns(:realizes)).to eq(Realize.page(1))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
27
|
+
describe 'When logged in as User' do
|
28
28
|
login_fixture_user
|
29
29
|
|
30
|
-
it
|
30
|
+
it 'assigns all realizes as @realizes' do
|
31
31
|
get :index
|
32
32
|
expect(assigns(:realizes)).to eq(Realize.page(1))
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe
|
37
|
-
it
|
36
|
+
describe 'When not logged in' do
|
37
|
+
it 'assigns all realizes as @realizes' do
|
38
38
|
get :index
|
39
39
|
expect(assigns(:realizes)).to eq(Realize.page(1))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
describe
|
45
|
-
describe
|
44
|
+
describe 'GET show' do
|
45
|
+
describe 'When logged in as Administrator' do
|
46
46
|
login_fixture_admin
|
47
47
|
|
48
|
-
it
|
48
|
+
it 'assigns the requested realize as @realize' do
|
49
49
|
realize = FactoryGirl.create(:realize)
|
50
|
-
get :show, :
|
50
|
+
get :show, id: realize.id
|
51
51
|
expect(assigns(:realize)).to eq(realize)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe
|
55
|
+
describe 'When logged in as Librarian' do
|
56
56
|
login_fixture_librarian
|
57
57
|
|
58
|
-
it
|
58
|
+
it 'assigns the requested realize as @realize' do
|
59
59
|
realize = FactoryGirl.create(:realize)
|
60
|
-
get :show, :
|
60
|
+
get :show, id: realize.id
|
61
61
|
expect(assigns(:realize)).to eq(realize)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
describe
|
65
|
+
describe 'When logged in as User' do
|
66
66
|
login_fixture_user
|
67
67
|
|
68
|
-
it
|
68
|
+
it 'assigns the requested realize as @realize' do
|
69
69
|
realize = FactoryGirl.create(:realize)
|
70
|
-
get :show, :
|
70
|
+
get :show, id: realize.id
|
71
71
|
expect(assigns(:realize)).to eq(realize)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
describe
|
76
|
-
it
|
75
|
+
describe 'When not logged in' do
|
76
|
+
it 'assigns the requested realize as @realize' do
|
77
77
|
realize = FactoryGirl.create(:realize)
|
78
|
-
get :show, :
|
78
|
+
get :show, id: realize.id
|
79
79
|
expect(assigns(:realize)).to eq(realize)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
describe
|
85
|
-
describe
|
84
|
+
describe 'GET new' do
|
85
|
+
describe 'When logged in as Administrator' do
|
86
86
|
login_fixture_admin
|
87
87
|
|
88
|
-
it
|
88
|
+
it 'assigns the requested realize as @realize' do
|
89
89
|
get :new
|
90
90
|
expect(assigns(:realize)).not_to be_valid
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
describe
|
94
|
+
describe 'When logged in as Librarian' do
|
95
95
|
login_fixture_librarian
|
96
96
|
|
97
|
-
it
|
97
|
+
it 'assigns the requested realize as @realize' do
|
98
98
|
get :new
|
99
99
|
expect(assigns(:realize)).not_to be_valid
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
describe
|
103
|
+
describe 'When logged in as User' do
|
104
104
|
login_fixture_user
|
105
105
|
|
106
|
-
it
|
106
|
+
it 'should not assign the requested realize as @realize' do
|
107
107
|
get :new
|
108
108
|
expect(assigns(:realize)).to be_nil
|
109
109
|
expect(response).to be_forbidden
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
describe
|
114
|
-
it
|
113
|
+
describe 'When not logged in' do
|
114
|
+
it 'should not assign the requested realize as @realize' do
|
115
115
|
get :new
|
116
116
|
expect(assigns(:realize)).to be_nil
|
117
117
|
expect(response).to redirect_to(new_user_session_url)
|
@@ -119,327 +119,327 @@ describe RealizesController do
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
describe
|
123
|
-
describe
|
122
|
+
describe 'GET edit' do
|
123
|
+
describe 'When logged in as Administrator' do
|
124
124
|
login_fixture_admin
|
125
125
|
|
126
|
-
it
|
126
|
+
it 'assigns the requested realize as @realize' do
|
127
127
|
realize = FactoryGirl.create(:realize)
|
128
|
-
get :edit, :
|
128
|
+
get :edit, id: realize.id
|
129
129
|
expect(assigns(:realize)).to eq(realize)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
describe
|
133
|
+
describe 'When logged in as Librarian' do
|
134
134
|
login_fixture_librarian
|
135
135
|
|
136
|
-
it
|
136
|
+
it 'assigns the requested realize as @realize' do
|
137
137
|
realize = FactoryGirl.create(:realize)
|
138
|
-
get :edit, :
|
138
|
+
get :edit, id: realize.id
|
139
139
|
expect(assigns(:realize)).to eq(realize)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
describe
|
143
|
+
describe 'When logged in as User' do
|
144
144
|
login_fixture_user
|
145
145
|
|
146
|
-
it
|
146
|
+
it 'assigns the requested realize as @realize' do
|
147
147
|
realize = FactoryGirl.create(:realize)
|
148
|
-
get :edit, :
|
148
|
+
get :edit, id: realize.id
|
149
149
|
expect(response).to be_forbidden
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
describe
|
154
|
-
it
|
153
|
+
describe 'When not logged in' do
|
154
|
+
it 'should not assign the requested realize as @realize' do
|
155
155
|
realize = FactoryGirl.create(:realize)
|
156
|
-
get :edit, :
|
156
|
+
get :edit, id: realize.id
|
157
157
|
expect(response).to redirect_to(new_user_session_url)
|
158
158
|
end
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
describe
|
162
|
+
describe 'POST create' do
|
163
163
|
before(:each) do
|
164
164
|
@attrs = FactoryGirl.attributes_for(:realize)
|
165
|
-
@invalid_attrs = {:
|
165
|
+
@invalid_attrs = { expression_id: '' }
|
166
166
|
end
|
167
167
|
|
168
|
-
describe
|
168
|
+
describe 'When logged in as Administrator' do
|
169
169
|
login_fixture_admin
|
170
170
|
|
171
|
-
describe
|
172
|
-
it
|
173
|
-
post :create, :
|
171
|
+
describe 'with valid params' do
|
172
|
+
it 'assigns a newly created realize as @realize' do
|
173
|
+
post :create, realize: @attrs
|
174
174
|
expect(assigns(:realize)).to be_valid
|
175
175
|
end
|
176
176
|
|
177
|
-
it
|
178
|
-
post :create, :
|
177
|
+
it 'redirects to the created realize' do
|
178
|
+
post :create, realize: @attrs
|
179
179
|
expect(response).to redirect_to(realize_url(assigns(:realize)))
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
describe
|
184
|
-
it
|
185
|
-
post :create, :
|
183
|
+
describe 'with invalid params' do
|
184
|
+
it 'assigns a newly created but unsaved realize as @realize' do
|
185
|
+
post :create, realize: @invalid_attrs
|
186
186
|
expect(assigns(:realize)).not_to be_valid
|
187
187
|
end
|
188
188
|
|
189
189
|
it "re-renders the 'new' template" do
|
190
|
-
post :create, :
|
191
|
-
expect(response).to render_template(
|
190
|
+
post :create, realize: @invalid_attrs
|
191
|
+
expect(response).to render_template('new')
|
192
192
|
end
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
-
describe
|
196
|
+
describe 'When logged in as Librarian' do
|
197
197
|
login_fixture_librarian
|
198
198
|
|
199
|
-
describe
|
200
|
-
it
|
201
|
-
post :create, :
|
199
|
+
describe 'with valid params' do
|
200
|
+
it 'assigns a newly created realize as @realize' do
|
201
|
+
post :create, realize: @attrs
|
202
202
|
expect(assigns(:realize)).to be_valid
|
203
203
|
end
|
204
204
|
|
205
|
-
it
|
206
|
-
post :create, :
|
205
|
+
it 'redirects to the created realize' do
|
206
|
+
post :create, realize: @attrs
|
207
207
|
expect(response).to redirect_to(realize_url(assigns(:realize)))
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
-
describe
|
212
|
-
it
|
213
|
-
post :create, :
|
211
|
+
describe 'with invalid params' do
|
212
|
+
it 'assigns a newly created but unsaved realize as @realize' do
|
213
|
+
post :create, realize: @invalid_attrs
|
214
214
|
expect(assigns(:realize)).not_to be_valid
|
215
215
|
end
|
216
216
|
|
217
217
|
it "re-renders the 'new' template" do
|
218
|
-
post :create, :
|
219
|
-
expect(response).to render_template(
|
218
|
+
post :create, realize: @invalid_attrs
|
219
|
+
expect(response).to render_template('new')
|
220
220
|
end
|
221
221
|
end
|
222
222
|
end
|
223
223
|
|
224
|
-
describe
|
224
|
+
describe 'When logged in as User' do
|
225
225
|
login_fixture_user
|
226
226
|
|
227
|
-
describe
|
228
|
-
it
|
229
|
-
post :create, :
|
227
|
+
describe 'with valid params' do
|
228
|
+
it 'assigns a newly created realize as @realize' do
|
229
|
+
post :create, realize: @attrs
|
230
230
|
expect(assigns(:realize)).to be_nil
|
231
231
|
end
|
232
232
|
|
233
|
-
it
|
234
|
-
post :create, :
|
233
|
+
it 'should be forbidden' do
|
234
|
+
post :create, realize: @attrs
|
235
235
|
expect(response).to be_forbidden
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
-
describe
|
240
|
-
it
|
241
|
-
post :create, :
|
239
|
+
describe 'with invalid params' do
|
240
|
+
it 'assigns a newly created but unsaved realize as @realize' do
|
241
|
+
post :create, realize: @invalid_attrs
|
242
242
|
expect(assigns(:realize)).to be_nil
|
243
243
|
end
|
244
244
|
|
245
|
-
it
|
246
|
-
post :create, :
|
245
|
+
it 'should be forbidden' do
|
246
|
+
post :create, realize: @invalid_attrs
|
247
247
|
expect(response).to be_forbidden
|
248
248
|
end
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
-
describe
|
253
|
-
describe
|
254
|
-
it
|
255
|
-
post :create, :
|
252
|
+
describe 'When not logged in' do
|
253
|
+
describe 'with valid params' do
|
254
|
+
it 'assigns a newly created realize as @realize' do
|
255
|
+
post :create, realize: @attrs
|
256
256
|
expect(assigns(:realize)).to be_nil
|
257
257
|
end
|
258
258
|
|
259
|
-
it
|
260
|
-
post :create, :
|
259
|
+
it 'should redirect to new_user_session_url' do
|
260
|
+
post :create, realize: @attrs
|
261
261
|
expect(response).to redirect_to(new_user_session_url)
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
265
|
-
describe
|
266
|
-
it
|
267
|
-
post :create, :
|
265
|
+
describe 'with invalid params' do
|
266
|
+
it 'assigns a newly created but unsaved realize as @realize' do
|
267
|
+
post :create, realize: @invalid_attrs
|
268
268
|
expect(assigns(:realize)).to be_nil
|
269
269
|
end
|
270
270
|
|
271
|
-
it
|
272
|
-
post :create, :
|
271
|
+
it 'should redirect to new_user_session_url' do
|
272
|
+
post :create, realize: @invalid_attrs
|
273
273
|
expect(response).to redirect_to(new_user_session_url)
|
274
274
|
end
|
275
275
|
end
|
276
276
|
end
|
277
277
|
end
|
278
278
|
|
279
|
-
describe
|
279
|
+
describe 'PUT update' do
|
280
280
|
before(:each) do
|
281
281
|
@realize = realizes(:realize_00001)
|
282
282
|
@attrs = FactoryGirl.attributes_for(:realize)
|
283
|
-
@invalid_attrs = {:
|
283
|
+
@invalid_attrs = { expression_id: '' }
|
284
284
|
end
|
285
285
|
|
286
|
-
describe
|
286
|
+
describe 'When logged in as Administrator' do
|
287
287
|
login_fixture_admin
|
288
288
|
|
289
|
-
describe
|
290
|
-
it
|
291
|
-
put :update, :
|
289
|
+
describe 'with valid params' do
|
290
|
+
it 'updates the requested realize' do
|
291
|
+
put :update, id: @realize.id, realize: @attrs
|
292
292
|
end
|
293
293
|
|
294
|
-
it
|
295
|
-
put :update, :
|
294
|
+
it 'assigns the requested realize as @realize' do
|
295
|
+
put :update, id: @realize.id, realize: @attrs
|
296
296
|
expect(assigns(:realize)).to eq(@realize)
|
297
297
|
expect(response).to redirect_to(@realize)
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
|
-
describe
|
302
|
-
it
|
303
|
-
put :update, :
|
301
|
+
describe 'with invalid params' do
|
302
|
+
it 'assigns the requested realize as @realize' do
|
303
|
+
put :update, id: @realize.id, realize: @invalid_attrs
|
304
304
|
end
|
305
305
|
|
306
306
|
it "re-renders the 'edit' template" do
|
307
|
-
put :update, :
|
308
|
-
expect(response).to render_template(
|
307
|
+
put :update, id: @realize.id, realize: @invalid_attrs
|
308
|
+
expect(response).to render_template('edit')
|
309
309
|
end
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
313
|
-
describe
|
313
|
+
describe 'When logged in as Librarian' do
|
314
314
|
login_fixture_librarian
|
315
315
|
|
316
|
-
describe
|
317
|
-
it
|
318
|
-
put :update, :
|
316
|
+
describe 'with valid params' do
|
317
|
+
it 'updates the requested realize' do
|
318
|
+
put :update, id: @realize.id, realize: @attrs
|
319
319
|
end
|
320
320
|
|
321
|
-
it
|
322
|
-
put :update, :
|
321
|
+
it 'assigns the requested realize as @realize' do
|
322
|
+
put :update, id: @realize.id, realize: @attrs
|
323
323
|
expect(assigns(:realize)).to eq(@realize)
|
324
324
|
expect(response).to redirect_to(@realize)
|
325
325
|
end
|
326
326
|
|
327
|
-
it
|
327
|
+
it 'moves its position when specified' do
|
328
328
|
position = @realize.position
|
329
|
-
put :update, :
|
329
|
+
put :update, id: @realize.id, expression_id: @realize.expression.id, move: 'lower'
|
330
330
|
expect(response).to redirect_to realizes_url(expression_id: @realize.expression_id)
|
331
331
|
assigns(:realize).reload.position.should eq position + 1
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
335
|
-
describe
|
336
|
-
it
|
337
|
-
put :update, :
|
335
|
+
describe 'with invalid params' do
|
336
|
+
it 'assigns the realize as @realize' do
|
337
|
+
put :update, id: @realize.id, realize: @invalid_attrs
|
338
338
|
expect(assigns(:realize)).not_to be_valid
|
339
339
|
end
|
340
340
|
|
341
341
|
it "re-renders the 'edit' template" do
|
342
|
-
put :update, :
|
343
|
-
expect(response).to render_template(
|
342
|
+
put :update, id: @realize.id, realize: @invalid_attrs
|
343
|
+
expect(response).to render_template('edit')
|
344
344
|
end
|
345
345
|
end
|
346
346
|
end
|
347
347
|
|
348
|
-
describe
|
348
|
+
describe 'When logged in as User' do
|
349
349
|
login_fixture_user
|
350
350
|
|
351
|
-
describe
|
352
|
-
it
|
353
|
-
put :update, :
|
351
|
+
describe 'with valid params' do
|
352
|
+
it 'updates the requested realize' do
|
353
|
+
put :update, id: @realize.id, realize: @attrs
|
354
354
|
end
|
355
355
|
|
356
|
-
it
|
357
|
-
put :update, :
|
356
|
+
it 'assigns the requested realize as @realize' do
|
357
|
+
put :update, id: @realize.id, realize: @attrs
|
358
358
|
expect(assigns(:realize)).to eq(@realize)
|
359
359
|
expect(response).to be_forbidden
|
360
360
|
end
|
361
361
|
end
|
362
362
|
|
363
|
-
describe
|
364
|
-
it
|
365
|
-
put :update, :
|
363
|
+
describe 'with invalid params' do
|
364
|
+
it 'assigns the requested realize as @realize' do
|
365
|
+
put :update, id: @realize.id, realize: @invalid_attrs
|
366
366
|
expect(response).to be_forbidden
|
367
367
|
end
|
368
368
|
end
|
369
369
|
end
|
370
370
|
|
371
|
-
describe
|
372
|
-
describe
|
373
|
-
it
|
374
|
-
put :update, :
|
371
|
+
describe 'When not logged in' do
|
372
|
+
describe 'with valid params' do
|
373
|
+
it 'updates the requested realize' do
|
374
|
+
put :update, id: @realize.id, realize: @attrs
|
375
375
|
end
|
376
376
|
|
377
|
-
it
|
378
|
-
put :update, :
|
377
|
+
it 'should be forbidden' do
|
378
|
+
put :update, id: @realize.id, realize: @attrs
|
379
379
|
expect(response).to redirect_to(new_user_session_url)
|
380
380
|
end
|
381
381
|
end
|
382
382
|
|
383
|
-
describe
|
384
|
-
it
|
385
|
-
put :update, :
|
383
|
+
describe 'with invalid params' do
|
384
|
+
it 'assigns the requested realize as @realize' do
|
385
|
+
put :update, id: @realize.id, realize: @invalid_attrs
|
386
386
|
expect(response).to redirect_to(new_user_session_url)
|
387
387
|
end
|
388
388
|
end
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
392
|
-
describe
|
392
|
+
describe 'DELETE destroy' do
|
393
393
|
before(:each) do
|
394
394
|
@realize = FactoryGirl.create(:realize)
|
395
395
|
end
|
396
396
|
|
397
|
-
describe
|
397
|
+
describe 'When logged in as Administrator' do
|
398
398
|
login_fixture_admin
|
399
399
|
|
400
|
-
it
|
401
|
-
delete :destroy, :
|
400
|
+
it 'destroys the requested realize' do
|
401
|
+
delete :destroy, id: @realize.id
|
402
402
|
end
|
403
403
|
|
404
|
-
it
|
405
|
-
delete :destroy, :
|
404
|
+
it 'redirects to the realizes list' do
|
405
|
+
delete :destroy, id: @realize.id
|
406
406
|
expect(response).to redirect_to(realizes_url)
|
407
407
|
end
|
408
408
|
end
|
409
409
|
|
410
|
-
describe
|
410
|
+
describe 'When logged in as Librarian' do
|
411
411
|
login_fixture_librarian
|
412
412
|
|
413
|
-
it
|
414
|
-
delete :destroy, :
|
413
|
+
it 'destroys the requested realize' do
|
414
|
+
delete :destroy, id: @realize.id
|
415
415
|
end
|
416
416
|
|
417
|
-
it
|
418
|
-
delete :destroy, :
|
417
|
+
it 'redirects to the realizes list' do
|
418
|
+
delete :destroy, id: @realize.id
|
419
419
|
expect(response).to redirect_to(realizes_url)
|
420
420
|
end
|
421
421
|
end
|
422
422
|
|
423
|
-
describe
|
423
|
+
describe 'When logged in as User' do
|
424
424
|
login_fixture_user
|
425
425
|
|
426
|
-
it
|
427
|
-
delete :destroy, :
|
426
|
+
it 'destroys the requested realize' do
|
427
|
+
delete :destroy, id: @realize.id
|
428
428
|
end
|
429
429
|
|
430
|
-
it
|
431
|
-
delete :destroy, :
|
430
|
+
it 'should be forbidden' do
|
431
|
+
delete :destroy, id: @realize.id
|
432
432
|
expect(response).to be_forbidden
|
433
433
|
end
|
434
434
|
end
|
435
435
|
|
436
|
-
describe
|
437
|
-
it
|
438
|
-
delete :destroy, :
|
436
|
+
describe 'When not logged in' do
|
437
|
+
it 'destroys the requested realize' do
|
438
|
+
delete :destroy, id: @realize.id
|
439
439
|
end
|
440
440
|
|
441
|
-
it
|
442
|
-
delete :destroy, :
|
441
|
+
it 'should be forbidden' do
|
442
|
+
delete :destroy, id: @realize.id
|
443
443
|
expect(response).to redirect_to(new_user_session_url)
|
444
444
|
end
|
445
445
|
end
|