blob: 8744369550ebea8b83f0b8f8cd417580ed6d7766 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
require 'rails_helper'
describe TutorialsController do
let(:user){ create(:user) }
before { http_login(user) }
describe "#index" do
let(:tutorial) { create(:tutorial) }
before :each do
user.tutorials << tutorial
get :index
end
it "assigns all tutorials as @tutorials" do
expect(assigns(:tutorials)).to match_array([tutorial])
end
end
describe "#show" do
let(:tutorial) { create(:tutorial) }
before :each do
user.tutorials << tutorial
get :show, params: { id: tutorial.to_param }
end
it "assigns the requested tutorial" do
expect(assigns(:tutorial)).to eql(tutorial)
end
end
end
|