質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,9 +154,9 @@
|
|
154
154
|
|
155
155
|
title: recruit.title,
|
156
156
|
|
157
|
-
e_st:
|
157
|
+
e_st: entry.present? ? entry.pluck(:status).first : "test",
|
158
|
-
|
158
|
+
|
159
|
-
r_st: recru
|
159
|
+
r_st: entry.present? && entry.pluck(:result) ? entry.pluck(:result).first : "pending",
|
160
160
|
|
161
161
|
}
|
162
162
|
|
1
補足
test
CHANGED
File without changes
|
test
CHANGED
@@ -168,6 +168,98 @@
|
|
168
168
|
|
169
169
|
```
|
170
170
|
|
171
|
+
|
172
|
+
|
173
|
+
spec
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
|
177
|
+
require 'rails_helper'
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
RSpec.describe "User::Offer", type: :request do
|
182
|
+
|
183
|
+
describe "GET /user_offer" do
|
184
|
+
|
185
|
+
let!(:user) {create(:user)}
|
186
|
+
|
187
|
+
let!(:offer) { create(:offer_b) }
|
188
|
+
|
189
|
+
let!(:recruits) do
|
190
|
+
|
191
|
+
FactoryBot.create_list(:recruit, 3)
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
let!(:entry) {create(:entry)}
|
196
|
+
|
197
|
+
let(:res) { JSON.parse(response.body).deep_symbolize_keys }
|
198
|
+
|
199
|
+
context "正常系" do
|
200
|
+
|
201
|
+
it "詳細が有効" do
|
202
|
+
|
203
|
+
get '/api/user/offers/2'
|
204
|
+
|
205
|
+
pp JSON.parse(response.body)
|
206
|
+
|
207
|
+
expect(res).to eq(
|
208
|
+
|
209
|
+
{
|
210
|
+
|
211
|
+
:work => {
|
212
|
+
|
213
|
+
id: offer.id,
|
214
|
+
|
215
|
+
offer_name: "offer_name"
|
216
|
+
|
217
|
+
},
|
218
|
+
|
219
|
+
:recruits =>[
|
220
|
+
|
221
|
+
{
|
222
|
+
|
223
|
+
id: 1,
|
224
|
+
|
225
|
+
title: "title",
|
226
|
+
|
227
|
+
entry_status: "pending",
|
228
|
+
|
229
|
+
result_status: "pending"
|
230
|
+
|
231
|
+
},
|
232
|
+
|
233
|
+
{
|
234
|
+
|
235
|
+
id: 2,
|
236
|
+
|
237
|
+
title: "title",
|
238
|
+
|
239
|
+
e_st: "pending",
|
240
|
+
|
241
|
+
r_st: "pending"
|
242
|
+
|
243
|
+
}
|
244
|
+
|
245
|
+
],
|
246
|
+
|
247
|
+
errors: []
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
)
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
```
|
262
|
+
|
171
263
|
こちらのdef recruit_as_json recruit, is_loginの中のe_st: recruit.entries.status,の書き方が悪いのだと思うのですが、どう直したらいいのかわからず困っています。
|
172
264
|
|
173
265
|
少しでもアドバイスなどいただければ助かります。
|