enju_message 0.3.0 → 0.3.1

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
- SHA1:
3
- metadata.gz: f0045a198b296280a01ed907ced3a537c3d9b3a2
4
- data.tar.gz: 6364cfbc156327eda16d31457863730175c98124
2
+ SHA256:
3
+ metadata.gz: 86af615e611c78aa7455cb247a37fbfcbe4fabbf97ea75e7e3f7299ae33e30e2
4
+ data.tar.gz: e1f6331fbe4e8fd6d3831b3f26e4682bbde914acb4303b80cc91ec7b84276202
5
5
  SHA512:
6
- metadata.gz: 3b2aff3a93e8415b4f67bd3a656ed5d0bec4c6ffb1365f586088aab31d114dea6a0400eae9dd91cce663e53948a5d4a9c3877df47caff5c5a245551d7ad2082f
7
- data.tar.gz: 89d26b6191564dca081a7302188ca3b5d4295344271920f4797dd21a2dc1ac238ac5fdefd603330dd4477c0422b13db925ca931548ac05b203b93fdde23f37ee
6
+ metadata.gz: 808920419efade6ae75412f1a4aa8472c87dab8682ad9265bd7da02bf9f47623b7ddcde775a511031b599cae3359340148b5e372f878b1dcb87ef5606f7e5cc0
7
+ data.tar.gz: c5ba1032e2438e86ee5eedce8bd934c0de010cb75b9ff603541238f43c2edce5169ffd781bd605c6bc883cbb6e997faff97a5420087fcb005516513411a9d594
@@ -1,3 +1,3 @@
1
1
  module EnjuMessage
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -0,0 +1,275 @@
1
+ require 'rails_helper'
2
+ require 'sunspot/rails/spec_helper'
3
+
4
+ describe MessageRequestsController do
5
+ fixtures :all
6
+ disconnect_sunspot
7
+
8
+ describe 'GET index' do
9
+ describe 'When logged in as Administrator' do
10
+ login_fixture_admin
11
+
12
+ it 'assigns all message_requests as @message_requests' do
13
+ get :index
14
+ assigns(:message_requests).should eq(MessageRequest.not_sent.order('created_at DESC').page(1))
15
+ end
16
+ end
17
+
18
+ describe 'When logged in as Librarian' do
19
+ login_fixture_librarian
20
+
21
+ it 'assigns all message_requests as @message_requests' do
22
+ get :index
23
+ assigns(:message_requests).should eq(MessageRequest.not_sent.order('created_at DESC').page(1))
24
+ end
25
+ end
26
+
27
+ describe 'When logged in as User' do
28
+ login_fixture_user
29
+
30
+ it 'assigns all message_requests as @message_requests' do
31
+ get :index
32
+ assigns(:message_requests).should be_nil
33
+ end
34
+ end
35
+
36
+ describe 'When not logged in' do
37
+ it 'assigns all message_requests as @message_requests' do
38
+ get :index
39
+ assigns(:message_requests).should be_nil
40
+ end
41
+ end
42
+ end
43
+
44
+ describe 'GET show' do
45
+ describe 'When logged in as Administrator' do
46
+ login_fixture_admin
47
+
48
+ it 'assigns the requested message_request as @message_request' do
49
+ message_request = FactoryBot.create(:message_request)
50
+ get :show, params: { id: message_request.id }
51
+ assigns(:message_request).should eq(message_request)
52
+ end
53
+ end
54
+
55
+ describe 'When logged in as Librarian' do
56
+ login_fixture_librarian
57
+
58
+ it 'assigns the requested message_request as @message_request' do
59
+ message_request = FactoryBot.create(:message_request)
60
+ get :show, params: { id: message_request.id }
61
+ assigns(:message_request).should eq(message_request)
62
+ end
63
+ end
64
+
65
+ describe 'When logged in as User' do
66
+ login_fixture_user
67
+
68
+ it 'assigns the requested message_request as @message_request' do
69
+ message_request = FactoryBot.create(:message_request)
70
+ get :show, params: { id: message_request.id }
71
+ assigns(:message_request).should eq(message_request)
72
+ end
73
+ end
74
+
75
+ describe 'When not logged in' do
76
+ it 'assigns the requested message_request as @message_request' do
77
+ message_request = FactoryBot.create(:message_request)
78
+ get :show, params: { id: message_request.id }
79
+ assigns(:message_request).should eq(message_request)
80
+ end
81
+ end
82
+ end
83
+
84
+ describe 'GET edit' do
85
+ describe 'When logged in as Administrator' do
86
+ login_fixture_admin
87
+
88
+ it 'assigns the requested message_request as @message_request' do
89
+ message_request = FactoryBot.create(:message_request)
90
+ get :edit, params: { id: message_request.id }
91
+ assigns(:message_request).should eq(message_request)
92
+ end
93
+ end
94
+
95
+ describe 'When logged in as Librarian' do
96
+ login_fixture_librarian
97
+
98
+ it 'assigns the requested message_request as @message_request' do
99
+ message_request = FactoryBot.create(:message_request)
100
+ get :edit, params: { id: message_request.id }
101
+ assigns(:message_request).should eq(message_request)
102
+ end
103
+ end
104
+
105
+ describe 'When logged in as User' do
106
+ login_fixture_user
107
+
108
+ it 'assigns the requested message_request as @message_request' do
109
+ message_request = FactoryBot.create(:message_request)
110
+ get :edit, params: { id: message_request.id }
111
+ response.should be_forbidden
112
+ end
113
+ end
114
+
115
+ describe 'When not logged in' do
116
+ it 'should not assign the requested message_request as @message_request' do
117
+ message_request = FactoryBot.create(:message_request)
118
+ get :edit, params: { id: message_request.id }
119
+ response.should redirect_to(new_user_session_url)
120
+ end
121
+ end
122
+ end
123
+
124
+ describe 'PUT update' do
125
+ before(:each) do
126
+ @message_request = FactoryBot.create(:message_request)
127
+ @attrs = FactoryBot.attributes_for(:message_request).merge(body: 'test')
128
+ @invalid_attrs = { body: '' }
129
+ end
130
+
131
+ describe 'When logged in as Administrator' do
132
+ login_fixture_admin
133
+
134
+ describe 'with valid params' do
135
+ it 'updates the requested message_request' do
136
+ put :update, params: { id: @message_request.id, message_request: @attrs }
137
+ end
138
+
139
+ it 'assigns the requested message_request as @message_request' do
140
+ put :update, params: { id: @message_request.id, message_request: @attrs }
141
+ assigns(:message_request).should eq(@message_request)
142
+ end
143
+ end
144
+
145
+ describe 'with invalid params' do
146
+ it 'assigns the requested message_request as @message_request' do
147
+ put :update, params: { id: @message_request.id, message_request: @invalid_attrs }
148
+ response.should render_template('edit')
149
+ end
150
+ end
151
+ end
152
+
153
+ describe 'When logged in as Librarian' do
154
+ login_fixture_librarian
155
+
156
+ describe 'with valid params' do
157
+ it 'updates the requested message_request' do
158
+ put :update, params: { id: @message_request.id, message_request: @attrs }
159
+ end
160
+
161
+ it 'assigns the requested message_request as @message_request' do
162
+ put :update, params: { id: @message_request.id, message_request: @attrs }
163
+ assigns(:message_request).should eq(@message_request)
164
+ response.should redirect_to(@message_request)
165
+ end
166
+ end
167
+
168
+ describe 'with invalid params' do
169
+ it 'assigns the requested message_request as @message_request' do
170
+ put :update, params: { id: @message_request.id, message_request: @invalid_attrs }
171
+ response.should render_template('edit')
172
+ end
173
+ end
174
+ end
175
+
176
+ describe 'When logged in as User' do
177
+ login_fixture_user
178
+
179
+ describe 'with valid params' do
180
+ it 'updates the requested message_request' do
181
+ put :update, params: { id: @message_request.id, message_request: @attrs }
182
+ end
183
+
184
+ it 'assigns the requested message_request as @message_request' do
185
+ put :update, params: { id: @message_request.id, message_request: @attrs }
186
+ assigns(:message_request).should eq(@message_request)
187
+ response.should be_forbidden
188
+ end
189
+ end
190
+
191
+ describe 'with invalid params' do
192
+ it 'assigns the requested message_request as @message_request' do
193
+ put :update, params: { id: @message_request.id, message_request: @invalid_attrs }
194
+ response.should be_forbidden
195
+ end
196
+ end
197
+ end
198
+
199
+ describe 'When not logged in' do
200
+ describe 'with valid params' do
201
+ it 'updates the requested message_request' do
202
+ put :update, params: { id: @message_request.id, message_request: @attrs }
203
+ end
204
+
205
+ it 'should be forbidden' do
206
+ put :update, params: { id: @message_request.id, message_request: @attrs }
207
+ response.should redirect_to(new_user_session_url)
208
+ end
209
+ end
210
+
211
+ describe 'with invalid params' do
212
+ it 'assigns the requested message_request as @message_request' do
213
+ put :update, params: { id: @message_request.id, message_request: @invalid_attrs }
214
+ response.should redirect_to(new_user_session_url)
215
+ end
216
+ end
217
+ end
218
+ end
219
+
220
+ describe 'DELETE destroy' do
221
+ before(:each) do
222
+ @message_request = FactoryBot.create(:message_request)
223
+ end
224
+
225
+ describe 'When logged in as Administrator' do
226
+ login_fixture_admin
227
+
228
+ it 'destroys the requested message_request' do
229
+ delete :destroy, params: { id: @message_request.id }
230
+ end
231
+
232
+ it 'redirects to the harvesting_requests list' do
233
+ delete :destroy, params: { id: @message_request.id }
234
+ response.should redirect_to(message_requests_url)
235
+ end
236
+ end
237
+
238
+ describe 'When logged in as Librarian' do
239
+ login_fixture_librarian
240
+
241
+ it 'destroys the requested message_request' do
242
+ delete :destroy, params: { id: @message_request.id }
243
+ end
244
+
245
+ it 'redirects to the harvesting_requests list' do
246
+ delete :destroy, params: { id: @message_request.id }
247
+ response.should redirect_to(message_requests_url)
248
+ end
249
+ end
250
+
251
+ describe 'When logged in as User' do
252
+ login_fixture_user
253
+
254
+ it 'destroys the requested message_request' do
255
+ delete :destroy, params: { id: @message_request.id }
256
+ end
257
+
258
+ it 'should be forbidden' do
259
+ delete :destroy, params: { id: @message_request.id }
260
+ response.should be_forbidden
261
+ end
262
+ end
263
+
264
+ describe 'When not logged in' do
265
+ it 'destroys the requested message_request' do
266
+ delete :destroy, params: { id: @message_request.id }
267
+ end
268
+
269
+ it 'should be forbidden' do
270
+ delete :destroy, params: { id: @message_request.id }
271
+ response.should redirect_to(new_user_session_url)
272
+ end
273
+ end
274
+ end
275
+ end
@@ -264,15 +264,17 @@ describe MessagesController do
264
264
  response.should be_successful
265
265
  end
266
266
  end
267
+
267
268
  describe 'with invalid recipient' do
268
269
  it "re-renders the 'new' template" do
269
270
  post :create, params: { message: @invalid_user_attrs }
270
271
  message = assigns(:message)
271
272
  message.should_not be_valid
272
273
  message.errors.should have_key :receiver
273
- message.errors.added?(:receiver, :invalid).should be_truthy
274
+ message.errors.added?(:receiver, :blank).should be_truthy
274
275
  response.should render_template('new')
275
276
  end
277
+
276
278
  it "re-renders the 'new' template" do
277
279
  post :create, params: { message: @blank_user_attrs }
278
280
  message = assigns(:message)
@@ -9,7 +9,7 @@ require "enju_leaf"
9
9
  module Dummy
10
10
  class Application < Rails::Application
11
11
  # Initialize configuration defaults for originally generated Rails version.
12
- config.load_defaults 5.1
12
+ config.load_defaults 5.2
13
13
 
14
14
  # Settings in config/environments/* take precedence over those specified here.
15
15
  # Application configuration should go into files in config/initializers
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 20180107162711) do
13
+ ActiveRecord::Schema.define(version: 2018_01_07_162711) do
14
14
 
15
15
  create_table "accepts", force: :cascade do |t|
16
16
  t.integer "basket_id"
@@ -2,8 +2,8 @@ FactoryBot.define do
2
2
  factory :message do
3
3
  recipient{FactoryBot.create(:profile).user.username}
4
4
  sender{FactoryBot.create(:profile).user}
5
- subject 'new message'
6
- body 'new message body is really short'
5
+ subject { 'new message' }
6
+ body { 'new message body is really short' }
7
7
  association :message_request
8
8
  end
9
9
  end
@@ -3,6 +3,6 @@ FactoryBot.define do
3
3
  sender_id{FactoryBot.create(:user).id}
4
4
  receiver_id{FactoryBot.create(:user).id}
5
5
  message_template_id{FactoryBot.create(:message_template).id}
6
- body 'test'
6
+ body { 'test' }
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_message
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kosuke Tanabe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2019-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_nested_set
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: 0.3.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: 0.3.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: erubis
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,42 +72,42 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.3.0.rc.1
75
+ version: 0.3.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.3.0.rc.1
82
+ version: 0.3.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: enju_leaf
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.3.0.rc.1
89
+ version: 1.3.2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.3.0.rc.1
96
+ version: 1.3.2
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: factory_bot_rails
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '4.11'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '4.11'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: mysql2
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '3.7'
159
+ version: '3.8'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '3.7'
166
+ version: '3.8'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: simplecov
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -530,8 +530,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
530
530
  - !ruby/object:Gem::Version
531
531
  version: '0'
532
532
  requirements: []
533
- rubyforge_project:
534
- rubygems_version: 2.6.14.3
533
+ rubygems_version: 3.0.3
535
534
  signing_key:
536
535
  specification_version: 4
537
536
  summary: enju_message plugin