Skip to content

Instantly share code, notes, and snippets.

@Arcolye
Last active January 26, 2017 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arcolye/bb5b95bee1d66f241b989971b122d066 to your computer and use it in GitHub Desktop.
Save Arcolye/bb5b95bee1d66f241b989971b122d066 to your computer and use it in GitHub Desktop.
GoToStudy - Agency Office Spec
require 'spec_helper'
feature "AgencyOffice" do
let(:agency) { create(:agency) }
scenario "makes agency visible on relevant country page" do
visit country_path(agency.offices.first.country)
expect(page).to have_content agency.name
end
context "on university page" do
let(:university) { create :university }
before(:each) {
create :agency_university_contract, agency: agency, university: university
}
scenario "makes agency visible for local users" do
set_user_country(agency.offices.first.country)
visit university_path(university, locale: nil)
expect(page).to have_content agency.name
end
scenario "keeps agency invisible for non-local users" do
other_country = create :country
set_user_country(other_country)
visit university_path(university, locale: nil)
expect(page).not_to have_content agency.name
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment