Sha256: 6708263adf2fdeac92269b5377528560879b2369e436428435f0e6879212b8f2

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 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

    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: 2.days.from_now.to_s

      click_button "Update Lease"
      expect(page).to have_content(2.days.from_now.strftime '%F')
    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

2 entries across 2 versions & 1 rubygems

Version Path
worthwhile-0.0.2 spec/features/lease_spec.rb
worthwhile-0.0.1 spec/features/lease_spec.rb