Sha256: 5e8bcca361d21490910c20ed093272029ecd7742e53fef4f2f67eee5ed94ba4f

Contents?: true

Size: 877 Bytes

Versions: 21

Compression:

Stored size: 877 Bytes

Contents

# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

module BookmarkSpecHelper
  def valid_bookmark_attributes
    {
      :id => 1,
      :user_id => 1,
      :document_id => 'u001'
    }
  end
end

describe Bookmark do
  include BookmarkSpecHelper
  before(:each) do
    @bookmark = Bookmark.new
  end
  
  it "should be valid" do
    @bookmark.assign_attributes valid_bookmark_attributes, :without_protection => true
    @bookmark.should be_valid
  end
   
  it "should require user_id" do
    @bookmark.should have(1).error_on(:user_id)
  end

  it "should belong to user" do
    Bookmark.reflect_on_association(:user).should_not be_nil
  end

  it "should be valid after saving" do
    @bookmark.assign_attributes valid_bookmark_attributes, :without_protection => true
    @bookmark.save
    @bookmark.should be_valid
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
blacklight-4.2.0 spec/models/bookmark_spec.rb
blacklight-4.1.0 test_support/spec/models/bookmark_spec.rb
blacklight-4.0.1 test_support/spec/models/bookmark_spec.rb
blacklight-3.8.2 test_support/spec/models/bookmark_spec.rb
blacklight-4.0.0 test_support/spec/models/bookmark_spec.rb
blacklight-4.0.0.rc2 test_support/spec/models/bookmark_spec.rb
blacklight-4.0.0.rc1 test_support/spec/models/bookmark_spec.rb
blacklight-4.0.0.pre7 test_support/spec/models/bookmark_spec.rb
blacklight-4.0.0.pre6 test_support/spec/models/bookmark_spec.rb
blacklight-3.8.1 test_support/spec/models/bookmark_spec.rb
blacklight-3.8.0 test_support/spec/models/bookmark_spec.rb
blacklight-3.7.2 test_support/spec/models/bookmark_spec.rb
blacklight-3.7.1 test_support/spec/models/bookmark_spec.rb
blacklight-3.7.0 test_support/spec/models/bookmark_spec.rb
blacklight-3.6.1.1 test_support/spec/models/bookmark_spec.rb
blacklight-3.6.0 test_support/spec/models/bookmark_spec.rb
blacklight-3.5.0 test_support/spec/models/bookmark_spec.rb
blacklight-3.4.2 test_support/spec/models/bookmark_spec.rb
blacklight-3.4.1 test_support/spec/models/bookmark_spec.rb
blacklight-3.4.0 test_support/spec/models/bookmark_spec.rb