Sha256: 62c509ba0644b57e934f92ba2c7d630e878de81dc36ae752b68f11157b0c5465

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe "adding an item using the provided bookmarklet", :type => :feature do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
  let(:search) { exhibit.searches.first }
  before { login_as curator }

  before do
    Spotlight::Engine.config.new_resource_partials += ["spotlight/resources/bookmarklet"]
  end

  it "should have an exhibit-specific bookmarklet" do
    visit spotlight.admin_exhibit_catalog_index_path(exhibit)
    click_link "Add repository item"

    expect(page).to have_content "Drag this button to the bookmarks toolbar in your web browser"
    expect(page).to have_link "#{exhibit.title} - Blacklight widget"
  end

  it "should trigger the bookmarklet" do
    # magic.
  end

  it "should submit the form to create a new item" do
    allow_any_instance_of(Spotlight::Resource).to receive(:reindex)
    visit spotlight.new_exhibit_resource_path(exhibit, popup: true, resource: { url: "info:url" })
    expect(page).to have_content "Add Resource"
    expect(first('#resource_url', visible: false).value).to eq 'info:url'
    click_button "Create Resource"
    expect(Spotlight::Resource.last.url).to eq "info:url"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/features/add_item_bookmarklet_spec.rb
blacklight-spotlight-0.3.1 spec/features/add_item_bookmarklet_spec.rb
blacklight-spotlight-0.3.0 spec/features/add_item_bookmarklet_spec.rb
blacklight-spotlight-0.2.0 spec/features/add_item_bookmarklet_spec.rb