Given(/^I am logged in$/) do
  ENV['PDS_HANDLE'] = 'PDS_HANDLE'
end

Given(/^I am not logged in$/) do
  ENV['PDS_HANDLE'] = nil
end

Then(/^I should a login link$/) do
  expect(page).to have_css('.nyu-login i.icons-famfamfam-lock_open')
  expect(page).to have_css('.nyu-login a.login')
end

Then(/^I should see "(.*?)" as the text of the login link$/) do |text|
  login_link = find(:css, '.nyu-login a.login')
  expect(login_link).to have_text text
end

Then(/^I should a logout link$/) do
  expect(page).to have_css('.nyu-login i.icons-famfamfam-lock')
  expect(page).to have_css('.nyu-login a.logout')
end

Then(/^I should see "(.*?)" as the text of the logout link$/) do |text|
  logout_link = find(:css, '.nyu-login a.logout')
  expect(logout_link).to have_text text
end

Then(/^I should see the login page in the current window$/) do
  expect(current_host).to eq 'https://logindev.library.nyu.edu'
end

Given(/^I am logged in$/) do
  ENV['PDS_HANDLE'] = 'PDS_HANDLE'
end

Given(/^I am not logged in$/) do
  ENV['PDS_HANDLE'] = nil
end

Then(/^I should a login link$/) do
  expect(page).to have_css('.nyu-login i.icons-famfamfam-lock_open')
  expect(page).to have_css('.nyu-login a.login')
end

Then(/^I should see "(.*?)" as the text of the login link$/) do |text|
  login_link = find(:css, '.nyu-login a.login')
  expect(login_link).to have_text text
end

Then(/^I should a logout link$/) do
  expect(page).to have_css('.nyu-login i.icons-famfamfam-lock')
  expect(page).to have_css('.nyu-login a.logout')
end

Then(/^I should see "(.*?)" as the text of the logout link$/) do |text|
  logout_link = find(:css, '.nyu-login a.logout')
  expect(logout_link).to have_text text
end

Then(/^I should see the login page in the current window$/) do
  expect(current_host).to match /^https:\/\/login(dev)?\.library\.nyu\.edu$/
end

Change the login URL expectation to a RegExp that takes logindev into account for Travis
Change the login URL expectation to a RegExp that takes logindev into account for Travis
