Sha256: 4b3f10d392c9b1a5bdb9c115098bcc556951982b51b5cbb1ab2e22673b23d10b

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe 'embargo' do
  let(:user) { FactoryGirl.create(:user) }
  before do
    sign_in user
  end
  describe "creating an embargoed object" do
    before do
      visit '/'
    end

    let(:future_date) { 2.days.from_now }

    it "can be created, displayed and updated" do
      click_link 'New Generic Work'
      fill_in 'Title', with: 'Embargo test'
      check 'I have read and accept the contributor license agreement'
      choose 'Embargo'
      select 'Private', from: 'Restricted to'
      select 'Open Access', from: 'then open it up to'
      click_button 'Create Generic work'

      click_link "Edit This Generic Work"
      click_link "Embargo Management Page"

      expect(page).to have_content("This work is under embargo.")

      fill_in "until", with: future_date.to_s

      click_button "Update Embargo"
      expect(page).to have_content(future_date.to_date.to_formatted_s(:long_ordinal))
    end
  end

  describe "managing embargoes" do
    before do
      # admin privs
      allow_any_instance_of(Ability).to receive(:user_groups).and_return(['admin'])
    end

    it "should show lists of objects under lease" do
      visit '/embargoes'
      expect(page).to have_content 'Manage Embargoes'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
worthwhile-0.1.2 spec/features/embargo_spec.rb
worthwhile-0.1.1 spec/features/embargo_spec.rb
worthwhile-0.1.0 spec/features/embargo_spec.rb
worthwhile-0.0.3 spec/features/embargo_spec.rb