Sha256: aca9f653743804ed2f7db46f576677e5a8eb05eaf44ef32cac5f720a1da52f3f

Contents?: true

Size: 958 Bytes

Versions: 8

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'

class IgnoreSpec < MiniTest::Spec
  describe Recommendable::Ignore do
    before :each do
      @user = User.create(:username => "dave")
    end
    
    it "should not be created for an object that does not act_as_recommendedable" do
      web2py = PhpFramework.create(:name => "web2py")
      proc { @user.ignore(web2py) }.must_raise Recommendable::RecordNotRecommendableError
    end
    
    it "should be created for an object that does act_as_recommendable" do
     movie = Movie.create(:title => "Star Wars: Episode I - The Phantom Menace", :year => 1999)
     @user.ignore(movie).must_equal true
    end
    
    it "should not be created twice for the same user-object pair" do
      movie = Movie.create(:title => "Star Wars: Episode I - The Phantom Menace", :year => 1999)
      
      @user.ignore(movie).must_equal true
      @user.ignore(movie).must_be_nil
      Recommendable::Ignore.count.must_equal 1
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
recommendable-1.0.0 spec/models/ignore_spec.rb
recommendable-0.2.1.1 spec/models/ignore_spec.rb
recommendable-0.1.8 spec/models/ignore_spec.rb
recommendable-0.1.6 spec/models/ignore_spec.rb
recommendable-0.1.5 spec/models/ignore_spec.rb
recommendable-0.1.4 spec/models/ignore_spec.rb
recommendable-0.1.3 spec/models/ignore_spec.rb
recommendable-0.1.2 spec/models/ignore_spec.rb