Skip to content

Commit e855ed0

Browse files
committed
Added spec user controller follow just once
1 parent 1f1f79f commit e855ed0

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

spec/controllers/user_controller_spec.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,31 @@
2323

2424
describe 'Following actions' do
2525
before { sign_in bob }
26-
it('#follow') do
26+
it('Try to follow himself') do
27+
post :follow, user_id: bob, :user => {:followee => bob.id}
28+
expect(flash[:notice]).to eq("You can't follow yourself silly!")
29+
end
30+
31+
it('#follow just once') do
2732
post :follow, user_id: bob, :user => {:followee => mozart.id}
2833
expect(flash[:notice]).to eq("You're following #{mozart.username} now")
34+
post :follow, user_id: bob, :user => {:followee => mozart.id}
35+
expect(flash[:notice]).to eq("You're already following #{mozart.username}")
2936
end
37+
3038
it('#following?') do
3139
get :following, user_id: bob
3240
response.should be_success
3341
end
42+
3443
it ('#followers') do
3544
get :followers, user_id: bob
3645
response.should be_success
3746
end
47+
48+
it ('#unfollow') do
49+
post :unfollow, user_id: bob, :user => {:followee => mozart.id}
50+
expect(flash[:notice]).to eq("You're no longer following #{mozart.username}")
51+
end
3852
end
3953
end

0 commit comments

Comments
 (0)