Sha256: 19bc0fe637785c77a01c860d5d177cbe337da80fd557b0ba942135b074a3bb18

Contents?: true

Size: 1.84 KB

Versions: 27

Compression:

Stored size: 1.84 KB

Contents

# -*- encoding: utf-8 -*-
require 'spec_helper'

describe Bookmark do
  #pending "add some examples to (or delete) #{__FILE__}"
  fixtures :all

  it "should be shelved" do
    bookmarks(:bookmark_00001).shelved?.should be_true
  end

  it "should create bookmark with url" do
    old_manifestation_count = Manifestation.count
    old_item_count = Item.count
    lambda{
      bookmark = FactoryGirl.create(:user).bookmarks.create(:url => 'http://www.example.com/', :title => 'test')
    }.should change(Bookmark, :count)
    Manifestation.count.should eq old_manifestation_count + 1
    Item.count.should eq old_item_count + 1
  end

  it "should create bookmark with local resource url" do
    old_manifestation_count = Manifestation.count
    old_item_count = Item.count
    lambda{
      bookmark = FactoryGirl.create(:user).bookmarks.create(:url => "#{LibraryGroup.site_config.url}manifestations/1", :title => 'test')
    }.should change(Bookmark, :count)
    assert_equal old_manifestation_count, Manifestation.count
    assert_equal old_item_count, Item.count
  end

  it "should not create bookmark with local resource url" do
    old_manifestation_count = Manifestation.count
    old_item_count = Item.count
    lambda{
      bookmark = FactoryGirl.create(:user).bookmarks.create(:url => "#{LibraryGroup.site_config.url}libraries/1", :title => 'test')
    }.should_not change(Bookmark, :count)
    assert_equal old_manifestation_count, Manifestation.count
    assert_equal old_item_count, Item.count
  end
end

# == Schema Information
#
# Table name: bookmarks
#
#  id               :integer         not null, primary key
#  user_id          :integer         not null
#  manifestation_id :integer
#  title            :text
#  url              :string(255)
#  note             :text
#  created_at       :datetime
#  updated_at       :datetime
#  shared           :boolean
#

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
enju_bookmark-0.1.2.pre4 spec/models/bookmark_spec.rb
enju_bookmark-0.1.2.pre3 spec/models/bookmark_spec.rb
enju_bookmark-0.1.2.pre2 spec/models/bookmark_spec.rb
enju_bookmark-0.1.2.pre spec/models/bookmark_spec.rb
enju_bookmark-0.1.1 spec/models/bookmark_spec.rb
enju_bookmark-0.1.0.pre spec/models/bookmark_spec.rb
enju_bookmark-0.1.0 spec/models/bookmark_spec.rb
enju_bookmark-0.0.22 spec/models/bookmark_spec.rb
enju_bookmark-0.0.21 spec/models/bookmark_spec.rb
enju_bookmark-0.0.20 spec/models/bookmark_spec.rb
enju_bookmark-0.0.19 spec/models/bookmark_spec.rb
enju_bookmark-0.0.18 spec/models/bookmark_spec.rb
enju_bookmark-0.0.17 spec/models/bookmark_spec.rb
enju_bookmark-0.0.16 spec/models/bookmark_spec.rb
enju_bookmark-0.0.15 spec/models/bookmark_spec.rb
enju_bookmark-0.0.14 spec/models/bookmark_spec.rb
enju_bookmark-0.0.13 spec/models/bookmark_spec.rb
enju_bookmark-0.0.12 spec/models/bookmark_spec.rb
enju_bookmark-0.0.11 spec/models/bookmark_spec.rb
enju_bookmark-0.0.10 spec/models/bookmark_spec.rb