Sha256: 9a86c0fcdab77ea98659d590ad8d2926b40ffd7fe83c2ac974156034efb46ea1
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Mongoid::Likes do describe User do before :all do @joe = User.create(name: 'Joe') @max = User.create(name: 'Max') end it "should have no likes" do [@joe, @max].each {|u| u.all_likes.should be_empty} end describe Track do before :all do @track1 = Track.create @track2 = Track.create end it "should have no likers" do [@track1, @track2].each { |t| t.all_likers.should be_empty } end it "should be likeable" do @joe.like(@track1) end it "should be liked by liker" do @track1.liker?(@joe).should be_true end it "should not be liked by others" do @track1.liker?(@max).should_not be_true end it "should have the liker as liker" do @track1.all_likers.should include @joe end it "should not have others as liker" do @track1.all_likers.should_not include @max end it "should be likeable by multiple likers" do @max.like(@track1) end it "should be liked by multiple likers" do @track1.all_likers.should include @joe, @max end it "should have the correct likers count" do @track1.likers_count.should be 2 @max.likes_count.should be 1 @joe.likes_count.should be 1 end it "should be unlikable" do @max.unlike(@track1) end it "should not include former liker" do @track1.all_likers.should_not include @max end it "should not be included in former likes" do @max.all_likes.should_not include @track1 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid_likes-0.1.0 | spec/mongoid/mongoid_likes/likes_spec.rb |
mongoid_likes-0.0.2 | spec/mongoid/mongoid_likes/likes_spec.rb |
mongoid_likes-0.0.1 | spec/mongoid/mongoid_likes/likes_spec.rb |