Skip to content

Commit

Permalink
Got rid of contest gem to get 1.9.3 to work.
Browse files Browse the repository at this point in the history
  • Loading branch information
balvig committed Apr 13, 2012
1 parent 033e093 commit fd8cb4a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 65 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ gemspec


# jquery-rails is used by the dummy application # jquery-rails is used by the dummy application
gem 'jquery-rails' gem 'jquery-rails'
gem 'contest'


# Declare any dependencies that are still in development here instead of in # Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or # your gemspec. These might include edge Rails or gems from your path or
Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
arel (3.0.2) arel (3.0.2)
builder (3.0.0) builder (3.0.0)
contest (0.1.3)
erubis (2.7.0) erubis (2.7.0)
hike (1.2.1) hike (1.2.1)
i18n (0.6.0) i18n (0.6.0)
Expand Down Expand Up @@ -94,6 +93,5 @@ PLATFORMS


DEPENDENCIES DEPENDENCIES
connections! connections!
contest
jquery-rails jquery-rails
sqlite3 sqlite3
120 changes: 58 additions & 62 deletions test/connections_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,78 +8,74 @@ class ConnectionsTest < ActiveSupport::TestCase
@post = Post.create! @post = Post.create!
end end


context 'No Follow class defined for join table' do # No explicit Follow class defined
test '#follow' do test '#follow' do
assert !@follower.follows?(@user) assert !@follower.follows?(@user)
@follower.follow(@user) @follower.follow(@user)
assert @follower.follows?(@user) assert @follower.follows?(@user)
end end

test '#unfollow' do
@follower.follow(@user)
assert @follower.follows?(@user)
@follower.unfollow(@user)
assert !@follower.follows?(@user)
end

test '#toggle_follow' do
@follower.toggle_follow(@user)
assert @follower.follows?(@user)
@follower.toggle_follow(@user)
assert !@follower.follows?(@user)
end


test '#following' do test '#unfollow' do
@follower.follow(@user) @follower.follow(@user)
@follower.follow(@post) assert @follower.follows?(@user)
assert_equal [@user], @follower.following(:user) @follower.unfollow(@user)
assert_equal [@post], @follower.following(:post) assert !@follower.follows?(@user)
end end


test '#follows' do test '#toggle_follow' do
#TODO: What should happen if the Follow model isn't defined? @follower.toggle_follow(@user)
#assert !@user.respond_to?(:follows) assert @follower.follows?(@user)
end @follower.toggle_follow(@user)
assert !@follower.follows?(@user)
end


test '#followers' do test '#following' do
@follower.follow(@user) @follower.follow(@user)
@follower.follow(@post) @follower.follow(@post)
assert_equal [@follower], @user.followers(:user) assert_equal [@user], @follower.following(:user)
assert_equal [@follower], @post.followers(:user) assert_equal [@post], @follower.following(:post)
end
end end


context 'Like class defined for join table' do test '#follows' do
#TODO: What should happen if the Follow model isn't defined?
#assert !@user.respond_to?(:follows)
end


test '#like' do test '#followers' do
assert !@user.likes?(@post) @follower.follow(@user)
@user.like(@post) @follower.follow(@post)
assert @user.likes?(@post) assert_equal [@follower], @user.followers(:user)
end assert_equal [@follower], @post.followers(:user)
end


test '#unlike' do # Explicit Like class defined
@user.like(@post) test '#like' do
assert @user.likes?(@post) assert !@user.likes?(@post)
@user.unlike(@post) @user.like(@post)
assert !@user.likes?(@post) assert @user.likes?(@post)
end end


test '#toggle_like' do test '#unlike' do
@user.toggle_like(@post) @user.like(@post)
assert @user.likes?(@post) assert @user.likes?(@post)
@user.toggle_like(@post) @user.unlike(@post)
assert !@user.likes?(@post) assert !@user.likes?(@post)
end end


test '#liking' do test '#toggle_like' do
@user.like(@post) @user.toggle_like(@post)
assert_equal [@post], @user.liking(:post) assert @user.likes?(@post)
end @user.toggle_like(@post)
assert !@user.likes?(@post)
end


test '#likes' do test '#liking' do
@user.like(@post) @user.like(@post)
assert_equal [@post], @user.likes.map(&:connectable) assert_equal [@post], @user.liking(:post)
end end


test '#likes' do
@user.like(@post)
assert_equal [@post], @user.likes.map(&:connectable)
end end
end end

0 comments on commit fd8cb4a

Please sign in to comment.