Sha256: ddd8a80b10aa4e7ea04dee9de36ad9b375a018fa41df352ff5acf729b99973c7
Contents?: true
Size: 1.17 KB
Versions: 2
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 describe "setup" do context "when the User class is defined" do before(:each) do reload_user! Likeable.user_class = User @user = User.new @target = SetupCleanTestClassForLikeable.new 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 context "when the User class doesn't exist" do before do # Need a cleaner way to do this, but the setter # prevents it Likeable.instance_variable_set(:@user_class, nil) unload_user! end after do build_user! Likeable.setup end it "won't raise an exception" do lambda { Likeable.setup }.should_not raise_error end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
likeable-0.1.1 | spec/likeable/setup_spec.rb |
likeable-0.1.0 | spec/likeable/setup_spec.rb |