Sha256: e4044d3b9ee1804967afb975a6b05848e0073667d4181f4cdac4ea5d4316cfdf

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe "leases" do
  let(:user) { FactoryGirl.create(:user) }
  before do
    sign_in user
  end
  describe "create a new leased object" do

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

    it "can be created, displayed and updated" do
      visit '/'
      click_link 'New Generic Work'
      fill_in 'Title', with: 'Lease test'
      check 'I have read and accept the contributor license agreement'
      choose 'Lease'
      select 'Open Access', from: 'Is available for'
      select 'Private', from: 'then restrict it to'
      click_button 'Create Generic work'

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

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

      fill_in "until", with: future_date.to_s

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

  end

  describe "managing leases" 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 '/leases'
      expect(page).to have_content 'Manage Leases'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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