質問編集履歴
1
Rspec記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -125,3 +125,47 @@
|
|
125
125
|
なぜかはわかりません。。。
|
126
126
|
|
127
127
|
テストも書いているのですが、テストは成功します。。。
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
```Rspec
|
134
|
+
|
135
|
+
RSpec.describe "Api::UserSkills", type: :request do
|
136
|
+
|
137
|
+
let(:user) { create(:user) }
|
138
|
+
|
139
|
+
let(:skill) { create(:skill)}
|
140
|
+
|
141
|
+
let(:us) { create(:user_skill)}
|
142
|
+
|
143
|
+
let(:uid) { response.headers["uid"] }
|
144
|
+
|
145
|
+
let(:client) { response.headers["client"] }
|
146
|
+
|
147
|
+
let(:access_token) { response.headers["access-token"]}
|
148
|
+
|
149
|
+
before do
|
150
|
+
|
151
|
+
post "/api/user/sign_in", params: { email: user.email, password: user.password }
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
describe "POST /create" do
|
158
|
+
|
159
|
+
it "ログインすれば登録できる" do
|
160
|
+
|
161
|
+
post "/api/skills/#{skill.id}/user_skills", headers: {uid: uid, client: client, "access-token": access_token}
|
162
|
+
|
163
|
+
expect(user.skills.count).to eq(1)
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
```
|