Sha256: bb5ae3b584aa568956d8dc894916f6a40908d421c74bcee9e201db6f099afac0
Contents?: true
Size: 1.17 KB
Versions: 5
Compression:
Stored size: 1.17 KB
Contents
require 'spec_helper' class LikeableIncludedInSetup end class SetupCleanTestClassForLikeable include Likeable def like_key "like_key" end def to_hash(*args); {} end def foo end def id @id ||= rand(100) end end describe Likeable do before(:each) do reload_user! Likeable.user_class = User @user = User.new @target = SetupCleanTestClassForLikeable.new end describe "Likeable setup" do it "adds Likeable::UserMethods to User" do describe User.ancestors do it {should_not include Likeable::UserMethods} end Likeable.setup describe User.ancestors do it {should include Likeable::UserMethods} end end it "adds likeable to class" do Likeable.setup do |like| like.classes = LikeableIncludedInSetup end describe LikeableIncludedInSetup.ancestors do it {should include Likeable} end end it "" do result = "foo" Likeable.setup Likeable.after_like do |like| result = "after_like_called_successfully" end @user.like! @target result.should == "after_like_called_successfully" end end end
Version data entries
5 entries across 5 versions & 1 rubygems