Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'testing' of github.com:hcarreras/hackety-hack.com into …

…hcarreras-testing
  • Loading branch information...
commit 1e8228c2287bcdf5a82aedf1e46ec2e1d998bb4c 2 parents aa595b5 + bd8fee2
@PragTob PragTob authored
Showing with 25 additions and 5 deletions.
  1. +5 −5 spec/following_policy_spec.rb
  2. +20 −0 spec/models/user_spec.rb
View
10 spec/following_policy_spec.rb
@@ -1,28 +1,28 @@
require_relative '../app/models/following_policy'
describe FollowingPolicy do
- before(:each) do
+ before(:each) do
@followee = double 'followee'
@follower = double 'follower'
end
-
+
it 'can follow another' do
@follower.should_receive(:following?).with(@followee).and_return(false)
policy = FollowingPolicy.new(@follower)
policy.can_follow?(@followee).should be_true
end
-
+
it "cannot follow self" do
policy = FollowingPolicy.new(@follower)
policy.following_self?(@follower).should be_true
policy.can_follow?(@follower).should be_false
end
-
+
it "cannot follow twice" do
@follower.should_receive(:following?).twice.with(@followee).and_return(true)
policy = FollowingPolicy.new(@follower)
policy.already_following?(@followee).should be_true
policy.can_follow?(@followee).should be_false
end
-
+
end
View
20 spec/models/user_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe User do
+
+ let(:bob){Fabricate(:user)}
+ let(:mozart){Fabricate(:user)}
+
+ it 'can be created validly' do
+ bob.should be_valid
+ mozart.should be_valid
+ end
+
+ it 'Users can follow and unfollow' do
+ bob.follow!(mozart)
+ bob.following?(mozart).should be_true
+ bob.unfollow!(mozart)
+ bob.reload
+ bob.following?(mozart).should be_false
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.