source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/locations/update_hours_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,265 | require 'rails_helper'
describe 'Update hours' do
before do
@location = create(:location)
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid hours', :js do
add_hour(
weekday: 'Tuesday',
opens_at_hour: '9 AM', opens_at_minute: '30',
closes_at_hour: '5 PM'... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/locations/update_holiday_hours_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,512 | require 'rails_helper'
describe 'Update holiday schedule' do
before do
@location = create(:location)
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'when closed', :js do
add_holiday_schedule(
start_month: 'January',
start_day: '1',
end_month: 'January',
en... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/locations/visit_location_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,671 | require 'rails_helper'
describe 'Visiting a specific location' do
before(:all) do
@location = create(:location)
end
before do
@location.reload
end
after(:all) do
Organization.find_each(&:destroy)
end
it "when location doesn't include generic email" do
admin = create(:admin_with_generic... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_regular_schedules_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 671 | require 'rails_helper'
describe 'Downloading Regular Schedules CSV' do
before do
login_super_admin
create_service
@regular_schedule = @location.regular_schedules.
create!(attributes_for(:regular_schedule))
visit admin_csv_regular_schedules_path(format: 'csv')
end
it 'cont... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_services_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,813 | require 'rails_helper'
describe 'Downloading Services CSV' do
before { login_super_admin }
context 'services has non-empty array attributes' do
before do
@food = create(:category)
@health = create(:health)
@jobs = create(:jobs)
@service = create(
:service_with_extra_whitespace,... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_holiday_schedules_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,390 | require 'rails_helper'
describe 'Downloading Holiday Schedules CSV' do
before { login_super_admin }
context 'when holiday_schedule contains nil date attributes' do
before do
create_service
@holiday_schedule = @location.holiday_schedules.
create!(attributes_for(:holiday_sc... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_organizations_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,517 | require 'rails_helper'
describe 'Downloading Organizations CSV' do
before { login_super_admin }
context 'organization has non-empty array attributes' do
before do
@org = create(:org_with_extra_whitespace)
visit admin_csv_organizations_path(format: 'csv')
end
it 'contains the same headers ... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_contacts_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 833 | require 'rails_helper'
describe 'Downloading Contacts CSV' do
before do
login_super_admin
@service = create(:service)
@location = @service.location
@org_id = @location.organization_id
@contact = create(
:contact_with_extra_whitespace,
location_id: @location.id,
organization_id: ... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_addresses_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 615 | require 'rails_helper'
describe 'Downloading Addresses CSV' do
before do
login_super_admin
@address = create(:address, location_id: 1)
visit admin_csv_addresses_path(format: 'csv')
end
it 'contains the same headers as in the import Wiki' do
expect(csv.first).to eq %w[id location_id address_1 add... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_mail_addresses_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 646 | require 'rails_helper'
describe 'Downloading Mail Addresses CSV' do
before do
login_super_admin
@mail_address = create(:mail_address)
visit admin_csv_mail_addresses_path(format: 'csv')
end
it 'contains the same headers as in the import Wiki' do
expect(csv.first).to eq %w[id location_id attention... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_phones_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 892 | require 'rails_helper'
describe 'Downloading Phones CSV' do
before do
login_super_admin
@service = create(:service)
@location = @service.location
@org_id = @location.organization_id
@phone = create(
:phone,
location_id: @location.id,
organization_id: @org_id,
service_id: @... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_locations_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,624 | require 'rails_helper'
describe 'Downloading Locations CSV' do
before { login_super_admin }
context 'location has non-empty array attributes' do
before do
@loc = create(
:loc_with_extra_whitespace,
accessibility: %i[tape_braille disabled_parking]
)
visit admin_csv_locations_p... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/csv/download_programs_csv_spec.rb | Ruby | bsd-3-clause | 187 | master | 516 | require 'rails_helper'
describe 'Downloading Programs CSV' do
before do
login_super_admin
@program = create(:program)
visit admin_csv_programs_path(format: 'csv')
end
it 'contains the same headers as in the import Wiki' do
expect(csv.first).to eq %w[id organization_id alternate_name name]
end
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/contacts/delete_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 542 | require 'rails_helper'
describe 'Delete contact' do
before do
@location = create(:location)
@location.contacts.create!(attributes_for(:contact))
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Moncef Belyamani'
end
it 'when deleting contact' do
find_link(I18n.t('admin... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/contacts/create_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,521 | require 'rails_helper'
describe 'Create a new contact' do
before do
create(:location)
login_super_admin
visit('/admin/locations/vrs-services')
click_link I18n.t('admin.buttons.add_contact')
end
it 'with all fields' do
fill_in 'contact_name', with: 'New VRS Services contact'
fill_in 'cont... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/contacts/update_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,301 | require 'rails_helper'
describe 'Update contact' do
before do
location = create(:location)
location.contacts.create!(attributes_for(:contact))
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Moncef Belyamani'
end
it 'with valid values' do
fill_in 'contact_department',... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_accepted_payments_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,288 | require 'rails_helper'
describe 'Update accepted_payments' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with no accepted_payments' do
click_button I18n.t('admin.buttons.save_changes')
expect(@service.reload.acce... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_email_spec.rb | Ruby | bsd-3-clause | 187 | master | 660 | require 'rails_helper'
describe 'Update email' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with invalid email' do
fill_in 'service_email', with: 'foobar.com'
click_button I18n.t('admin.buttons.save_changes')
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_service_areas_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,344 | require 'rails_helper'
describe 'Update service areas' do
before do
location = create(:location)
@service = location.services.
create!(attributes_for(:service).merge(keywords: []))
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'wh... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_description_spec.rb | Ruby | bsd-3-clause | 187 | master | 708 | require 'rails_helper'
describe 'Update description' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with empty description' do
fill_in 'service_description', with: ''
click_button I18n.t('admin.buttons.save_change... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/delete_service_spec.rb | Ruby | bsd-3-clause | 187 | master | 824 | require 'rails_helper'
describe 'Delete service' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'when submitting warning', :js do
click_link 'Literacy Program'
find_link(I18n.t('admin.buttons.delete_service')).click
find_link(I18n.t('admin.butt... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_contact_name_spec.rb | Ruby | bsd-3-clause | 187 | master | 955 | require 'rails_helper'
describe 'Update contact name' do
before do
create_service
@service.contacts.create!(attributes_for(:contact))
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
click_link 'Moncef Belyamani'
end
it 'with empty name' do
fill_i... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/visit_services_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,549 | require 'rails_helper'
describe 'Services page' do
context 'when not signed in' do
before do
visit '/admin/services'
end
it 'redirects to the admin sign in page' do
expect(page).to have_current_path(new_admin_session_path, ignore_query: true)
end
it 'prompts the user to sign in or s... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_interpretation_services_spec.rb | Ruby | bsd-3-clause | 187 | master | 544 | require 'rails_helper'
describe 'Update interpretation_services' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid interpretation_services' do
click_link 'Literacy Program'
fill_in 'service_interpretation_services', with: 'CTS LanguageLink... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/create_service_spec.rb | Ruby | bsd-3-clause | 187 | master | 9,641 | require 'rails_helper'
describe 'Create a new service' do
before do
@loc = create(:location)
login_super_admin
visit('/admin/locations/vrs-services')
click_link I18n.t('admin.buttons.add_service')
end
it 'with all required fields' do
fill_in_required_service_fields
click_button I18n.t('a... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_alternate_name_spec.rb | Ruby | bsd-3-clause | 187 | master | 508 | require 'rails_helper'
describe 'Update alternate_name' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with valid alternate_name' do
fill_in 'service_alternate_name', with: 'Youth Counseling'
click_button I18n.t('... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_languages_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,191 | require 'rails_helper'
describe 'Update languages' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with no languages' do
click_button I18n.t('admin.buttons.save_changes')
expect(@service.reload.languages).to eq []
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_website_spec.rb | Ruby | bsd-3-clause | 187 | master | 706 | require 'rails_helper'
describe 'Update website' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with invalid website' do
fill_in 'service_website', with: 'www.monfresh.com'
click_button I18n.t('admin.buttons.save_... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_eligibility_spec.rb | Ruby | bsd-3-clause | 187 | master | 496 | require 'rails_helper'
describe 'Update eligibility' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid eligibility' do
click_link 'Literacy Program'
fill_in 'service_eligibility', with: 'Youth Counseling'
click_button I18n.t('admin.but... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_holiday_hours_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,561 | require 'rails_helper'
describe 'Update holiday schedule' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'when closed', :js do
add_holiday_schedule(
start_month: 'January',
start_day: '1',
end_month: ... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_audience_spec.rb | Ruby | bsd-3-clause | 187 | master | 484 | require 'rails_helper'
describe 'Update audience' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid audience' do
click_link 'Literacy Program'
fill_in 'service_audience', with: 'Youth Counseling'
click_button I18n.t('admin.buttons.save... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_categories_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,566 | require 'rails_helper'
describe 'Update categories' do
before do
create_service
emergency = Category.create!(name: 'Emergency', taxonomy_id: '101')
emergency.children.create!(name: 'Disaster Response', taxonomy_id: '101-01')
emergency.children.create!(name: 'Subcategory 2', taxonomy_id: '101-02')
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_name_spec.rb | Ruby | bsd-3-clause | 187 | master | 659 | require 'rails_helper'
describe 'Update name' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with empty name' do
fill_in 'service_name', with: ''
click_button I18n.t('admin.buttons.save_changes')
expect(page).... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_status_spec.rb | Ruby | bsd-3-clause | 187 | master | 457 | require 'rails_helper'
describe 'Update status' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid status' do
click_link 'Literacy Program'
select 'Defunct', from: 'service_status'
click_button I18n.t('admin.buttons.save_changes')
e... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_phone_numbers_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,211 | require 'rails_helper'
describe 'Update phones' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'when no phones exist' do
expect(page).to have_link I18n.t('admin.buttons.add_phone')
end
it 'by adding a new phone', ... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_program_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,056 | require 'rails_helper'
describe "Update service's program" do
before do
create_service
@prog = @location.organization.programs.create!(attributes_for(:program))
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with valid program' do
select 'Co... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/delete_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 618 | require 'rails_helper'
describe 'Delete contact' do
before do
create_service
@service.contacts.create!(attributes_for(:contact))
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
click_link 'Moncef Belyamani'
end
it 'when deleting contact' do
find_... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_wait_time_spec.rb | Ruby | bsd-3-clause | 187 | master | 488 | require 'rails_helper'
describe 'Update wait_time' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid wait_time' do
click_link 'Literacy Program'
fill_in 'service_wait_time', with: 'Youth Counseling'
click_button I18n.t('admin.buttons.s... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/create_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,327 | require 'rails_helper'
describe 'Create a new contact for service' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
click_link I18n.t('admin.buttons.add_contact')
end
it 'creates a contact for the right service' do
expect(p... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_how_to_apply_spec.rb | Ruby | bsd-3-clause | 187 | master | 528 | require 'rails_helper'
describe 'Update application_process' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid application_process' do
click_link 'Literacy Program'
fill_in 'service_application_process', with: 'Youth Counseling'
click_... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_required_documents_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,377 | require 'rails_helper'
describe 'Update required_documents' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with no required_documents' do
click_button I18n.t('admin.buttons.save_changes')
expect(@service.reload.re... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_keywords_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,296 | require 'rails_helper'
describe 'Update keywords' do
before do
location = create(:location)
@service = location.services.create!(
attributes_for(:service).merge(keywords: [])
)
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'when no key... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_funding_sources_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,268 | require 'rails_helper'
describe 'Update funding_sources' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with no funding_sources' do
click_button I18n.t('admin.buttons.save_changes')
expect(@service.reload.funding_... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/copy_service_to_location_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,457 | require 'rails_helper'
describe 'Copy service to other locations' do
context 'when organization has more than one location' do
before do
@location = create(:location)
@new_loc = create(:far_loc, organization_id: @location.organization.id)
@service = @location.services.create!(attributes_for(:se... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_hours_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,315 | require 'rails_helper'
describe 'Update hours' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
click_link 'Literacy Program'
end
it 'with valid hours', :js do
add_hour(
weekday: 'Tuesday',
opens_at_hour: '9 AM', opens_at_minute: '30',
clo... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/features/admin/services/update_fees_spec.rb | Ruby | bsd-3-clause | 187 | master | 468 | require 'rails_helper'
describe 'Update fees' do
before do
create_service
login_super_admin
visit '/admin/locations/vrs-services'
end
it 'with valid fees' do
click_link 'Literacy Program'
fill_in 'service_fees', with: 'Youth Counseling'
click_button I18n.t('admin.buttons.save_changes')
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/create_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,661 | require 'rails_helper'
describe 'POST /locations/:location_id/contacts' do
before(:all) do
@loc = create(:location)
end
before do
@contact_attributes = { name: 'Moncef', title: 'Consultant' }
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'creates a contact with valid attribut... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/delete_location_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,145 | require 'rails_helper'
describe 'DELETE /locations/:id' do
before :all do
create_service
end
before do
delete api_location_url(@location, subdomain: ENV.fetch('API_SUBDOMAIN', nil)), {}
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'deletes the location' do
get api_locati... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_location_spec.rb | Ruby | bsd-3-clause | 187 | master | 10,191 | require 'rails_helper'
describe 'GET /locations/:id' do
context 'with valid id' do
before :all do
create_service
end
before do
@location.reload
get api_location_url(@location, subdomain: ENV.fetch('API_SUBDOMAIN', nil))
end
after(:all) do
Organization.find_each(&:destroy... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/patch_mail_address_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,824 | require 'rails_helper'
describe 'PATCH mail_address' do
before do
@mail_address = create(:mail_address)
@loc = @mail_address.location
@attrs = {
attention: 'Jane Doe',
address_1: 'foo',
address_2: 'apt 101',
city: 'bar',
state_province: 'CA',
postal_code: '90210',
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/patch_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,427 | require 'rails_helper'
describe 'PATCH contact' do
before(:all) do
@loc = create(:location)
@contact = @loc.contacts.create!(attributes_for(:contact))
end
before do
@attrs = { name: 'Moncef', title: 'Consultant', email: 'bar@foo.com' }
end
after(:all) do
Organization.find_each(&:destroy)
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_organization_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,426 | require 'rails_helper'
describe 'GET /organizations/:id' do
context 'with valid id' do
before :all do
@org = create(:location).organization
end
before do
get api_organization_url(@org, subdomain: ENV.fetch('API_SUBDOMAIN', nil))
end
after(:all) do
Organization.find_each(&:dest... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_location_services_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,178 | require 'rails_helper'
describe 'GET /locations/:location_id/services' do
context 'when location has services' do
before do
create_service
get api_location_services_url(@location, subdomain: ENV.fetch('API_SUBDOMAIN', nil))
end
it 'returns a 200 status' do
expect(response).to have_http... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/pagination_headers_spec.rb | Ruby | bsd-3-clause | 187 | master | 4,219 | require 'rails_helper'
describe 'Pagination Headers' do
before do
@prefix = api_search_index_url(subdomain: ENV.fetch('API_SUBDOMAIN', nil))
end
context 'when on page 1 of 2' do
before(:all) do
create(:location)
create(:nearby_loc)
end
before do
get api_search_index_url(
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/nearby_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,026 | require 'rails_helper'
describe "GET 'nearby'" do
before do
@loc = create(:location)
@nearby = create(:nearby_loc)
create(:far_loc)
end
it 'is paginated' do
get api_location_nearby_url(
@loc, page: 2, per_page: 1, radius: 5, subdomain: ENV.fetch('API_SUBDOMAIN', nil)
)
expect(json.... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/delete_mail_address_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,479 | require 'rails_helper'
describe 'DELETE /locations/:location_id/mail_address/:id' do
before do
@mail_address = create(:mail_address)
@loc = @mail_address.location
end
it 'deletes the mail_address' do
delete(
api_location_mail_address_url(@loc, @mail_address,
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_location_contacts_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,829 | require 'rails_helper'
describe 'GET /locations/:location_id/contacts' do
context 'when location has contacts' do
before :all do
@loc = create(:location)
@first_contact = @loc.contacts.
create!(attributes_for(:contact_with_extra_whitespace))
end
before do
get api... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/delete_contact_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,006 | require 'rails_helper'
describe 'DELETE /locations/:location_id/contacts/:id' do
before(:all) do
@loc = create(:location)
@contact = @loc.contacts.create!(attributes_for(:contact))
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'deletes the contact' do
delete(
api_locatio... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/create_mail_address_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,506 | require 'rails_helper'
describe 'POST /locations/:location_id/mail_address' do
context 'when location does not already have an mail_address' do
before(:all) do
@loc = create(:nearby_loc)
end
before do
@attrs = { address_1: 'foo', city: 'bar', state_province: 'CA',
postal_cod... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/put_service_categories_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,258 | require 'rails_helper'
describe 'PUT /services/:service_id/categories' do
before(:all) do
create_service
@food = Category.create!(name: 'Food', taxonomy_id: '101')
end
after(:all) do
Organization.find_each(&:destroy)
Category.find_each(&:destroy)
end
context 'when the passed in taxonomy_id ... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/patch_organization_spec.rb | Ruby | bsd-3-clause | 187 | master | 3,855 | require 'rails_helper'
describe 'PATCH /organizations/:id' do
before(:all) do
loc_with_org = create(:location)
@org = loc_with_org.organization
end
before do
@org.reload
end
after(:all) do
Organization.find_each(&:destroy)
end
let(:valid_attributes) do
{
accreditations: ['BBB... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_organization_locations_spec.rb | Ruby | bsd-3-clause | 187 | master | 4,773 | require 'rails_helper'
describe 'GET /organizations/:organization_id/locations' do
context 'when organization has locations' do
before :all do
@org = create(:organization)
attrs = {
accessibility: %w[restroom],
admin_emails: %w[foo@bar.com],
description: 'testing 1 2 3',
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/create_service_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,303 | require 'rails_helper'
describe 'POST /locations/:location_id/services' do
before(:all) do
@loc = create(:location)
end
before do
@service_attributes = {
name: 'test service',
description: 'test description',
status: 'active'
}
end
after(:all) do
Organization.find_each(&:d... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/create_address_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,445 | require 'rails_helper'
describe 'POST /locations/:location_id/address' do
context 'when location does not already have an address' do
before(:all) do
@loc = create(:no_address)
end
before do
@attrs = { address_1: 'foo', city: 'bar', state_province: 'CA',
postal_code: '90210'... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/create_location_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,030 | require 'rails_helper'
describe 'Create a location (POST /organizations/:organization_id/locations/)' do
before(:all) do
@org = create(:organization)
end
before do
@location_attributes = {
name: 'new location',
description: 'description',
address_attributes: {
address_1: 'main'... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/patch_address_spec.rb | Ruby | bsd-3-clause | 187 | master | 3,173 | require 'rails_helper'
describe 'PATCH address' do
before do
@loc = create(:location)
@address = @loc.address
@attrs = { address_1: '1236 Broadway', address_2: 'Apt 101',
city: 'Burlingame', state_province: 'CA', postal_code: '94010',
country: 'US' }
end
describe 'PATCH... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/root_endpoint_spec.rb | Ruby | bsd-3-clause | 187 | master | 871 | require 'rails_helper'
describe 'API Root Endpoint' do
it 'displays links to all top-level endpoints' do
get api_url(subdomain: ENV.fetch('API_SUBDOMAIN', nil))
hash = {
'organizations_url' => "#{api_organizations_url}{?page,per_page}",
'organization_url' => "#{api_organizations_url}/{organizatio... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/patch_service_spec.rb | Ruby | bsd-3-clause | 187 | master | 4,006 | require 'rails_helper'
describe 'PATCH /locations/:location_id/services/:id' do
before(:all) do
create_service
end
before do
@attrs = attributes_for(:service_with_extra_whitespace)
end
after(:all) do
Organization.find_each(&:destroy)
end
let(:expected_attributes) do
{
accepted_pa... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/cors_spec.rb | Ruby | bsd-3-clause | 187 | master | 7,132 | require 'rails_helper'
describe 'CORS Preflight Request via OPTIONS HTTP method' do
context 'when ORIGIN is specified and resource is allowed' do
before do
process(
:options,
api_organizations_url(subdomain: ENV.fetch('API_SUBDOMAIN', nil)),
params: {},
headers: {
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_category_children_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,774 | require 'rails_helper'
describe 'GET /categories/:category_id/children' do
context 'when category has children' do
before :all do
@food = Category.create!(name: 'Food', taxonomy_id: '101')
@food_child = @food.children.
create!(name: 'Emergency Food', taxonomy_id: '101-01')
end... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_locations_spec.rb | Ruby | bsd-3-clause | 187 | master | 7,746 | require 'rails_helper'
describe 'GET /locations' do
it 'returns an empty array when no locations exist' do
get api_locations_url(subdomain: ENV.fetch('API_SUBDOMAIN', nil))
expect(response).to have_http_status(:ok)
expect(response.content_type).to eq('application/json')
expect(json).to eq([])
end
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_organizations_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,483 | require 'rails_helper'
describe 'GET /organizations' do
it 'returns an empty array when no organizations exist' do
get api_organizations_url(subdomain: ENV.fetch('API_SUBDOMAIN', nil))
expect(response).to have_http_status(:ok)
expect(response.content_type).to eq('application/json')
expect(json).to eq... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/patch_location_spec.rb | Ruby | bsd-3-clause | 187 | master | 4,933 | require 'rails_helper'
describe 'PATCH /locations/:id)' do
let(:attributes) do
{
accessibility: %w[disabled_parking ramp],
active: true,
admin_emails: [' foo@test.com ', 'bar@test.com'],
alternate_name: 'Different Name',
description: 'test location',
email: 'test@test.com',
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/create_organization_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,552 | require 'rails_helper'
describe 'Create an organization (POST /organizations/)' do
before(:all) do
create(:organization)
end
before do
@org_attributes = {
accreditations: ['BBB', 'State Board of Education'],
alternate_name: 'Alternate Name',
date_incorporated: 'January 01, 1970',
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/delete_address_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,887 | require 'rails_helper'
describe 'DELETE /locations/:location/address/:id' do
before(:all) do
@loc = create(:location)
end
before do
@loc.reload
@address = @loc.address
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'deletes the address when the location is virtual' do
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/delete_organization_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,222 | require 'rails_helper'
describe 'DELETE /organizations/:id' do
before :all do
create_service
end
before do
@org = @location.organization
delete api_organization_url(@org, subdomain: ENV.fetch('API_SUBDOMAIN', nil)), {}
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'delete... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/delete_service_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,155 | require 'rails_helper'
describe 'DELETE /locations/:location_id/services/:id' do
before :all do
create_service
end
before do
delete(
api_location_service_url(@location, @service, subdomain: ENV.fetch('API_SUBDOMAIN', nil)),
{}
)
end
after(:all) do
Organization.find_each(&:destro... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/get_categories_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,129 | require 'rails_helper'
describe 'GET /categories' do
before :all do
@food = Category.create!(name: 'Food', taxonomy_id: '101')
@emergency = Category.create!(name: 'Emergency', taxonomy_id: '103')
end
before do
get api_categories_url(subdomain: ENV.fetch('API_SUBDOMAIN', nil))
end
after(:all) do... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/search_spec.rb | Ruby | bsd-3-clause | 187 | master | 17,579 | require 'rails_helper'
describe "GET 'search'" do
context 'with valid keyword only' do
before :all do
@loc = create(:location)
@nearby = create(:nearby_loc)
@loc.update(updated_at: 1.day.ago)
@nearby.update(updated_at: 1.hour.ago)
end
before do
get api_search_index_url(keyw... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/search/category_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,778 | require 'rails_helper'
describe "GET 'search'" do
context 'with category parameter' do
before do
nearby = create(:nearby_loc)
create(:farmers_market_loc)
jobs = create(:jobs)
health = create(:health)
create_service
@service.category_ids = [jobs.id]
@service.save
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/search/service_area_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,668 | require 'rails_helper'
describe "GET 'search'" do
context 'with service_area parameter' do
before do
create(:nearby_loc)
create(:farmers_market_loc)
create_service
@service.service_areas = ['Atherton']
@service.save
end
it 'only returns locations with matching service areas... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/search/language_spec.rb | Ruby | bsd-3-clause | 187 | master | 797 | require 'rails_helper'
describe "GET 'search'" do
context 'with language parameter' do
before do
create(:nearby_loc)
create(:farmers_market_loc)
end
it 'finds matching locations when language is a String' do
get api_search_index_url(
language: 'Arabic',
subdomain: ENV.f... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/search/location_status_spec.rb | Ruby | bsd-3-clause | 187 | master | 753 | require 'rails_helper'
describe "GET 'search'" do
context 'with status parameter' do
before do
create(:nearby_loc)
@location = create(:location)
@attrs = attributes_for(:service)
end
it 'only returns active locations when status=active' do
@location.services.create!(@attrs.merge... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/locations/get_location_phones_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,812 | require 'rails_helper'
describe 'GET /locations/:location_id/phones' do
context 'when location has phones' do
before :all do
@loc = create(:location)
@first_phone = @loc.phones.create!(attributes_for(:phone))
end
before do
get api_location_phones_url(@loc, subdomain: ENV.fetch('API_SUB... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/locations/patch_phone_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,398 | require 'rails_helper'
describe 'PATCH phone' do
before(:all) do
@loc = create(:location)
@phone = @loc.phones.create!(attributes_for(:phone))
end
before do
@attrs = { number: '123-456-7890', number_type: 'fax' }
end
after(:all) do
Organization.find_each(&:destroy)
end
describe 'PATCH ... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/locations/create_phone_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,722 | require 'rails_helper'
describe 'POST /locations/:location_id/phones' do
before(:all) do
@loc = create(:location)
end
before do
@phone_attributes = { number: '123-456-7890', number_type: 'voice' }
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'creates a phone with valid attri... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/locations/delete_phone_spec.rb | Ruby | bsd-3-clause | 187 | master | 925 | require 'rails_helper'
describe 'DELETE /locations/:location_id/phones/:id' do
before(:all) do
@loc = create(:location)
@phone = @loc.phones.create!(attributes_for(:phone))
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'deletes the phone' do
delete(
api_location_phone_ur... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/contacts/patch_phone_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,850 | require 'rails_helper'
describe 'PATCH Contact phone' do
before(:all) do
@location = create(:location)
@contact = @location.contacts.create!(attributes_for(:contact))
@phone = @contact.phones.create!(attributes_for(:phone))
end
before do
@attrs = { number: '123-456-7890', number_type: 'fax' }
... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/contacts/delete_phone_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,202 | require 'rails_helper'
describe 'DELETE /locations/:location_id/contacts/:contact_id/phones/:id' do
before(:all) do
@loc = create(:location)
@contact = @loc.contacts.create!(attributes_for(:contact))
@phone = @contact.phones.create!(attributes_for(:phone))
end
after(:all) do
Organization.find_ea... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/contacts/create_phone_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,167 | require 'rails_helper'
describe 'POST /locations/:location_id/contacts/:contact_id/phones' do
before(:all) do
@loc = create(:location)
@contact = @loc.contacts.create!(attributes_for(:contact))
end
before do
@phone_attributes = { number: '123-456-7890', number_type: 'voice' }
end
after(:all) do... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/api/services/update_service_categories_spec.rb | Ruby | bsd-3-clause | 187 | master | 571 | require 'rails_helper'
describe 'PUT /services/:service_id/categories' do
before(:all) do
create_service
end
after(:all) do
Organization.find_each(&:destroy)
end
it 'returns 200 when validations pass' do
create(:category)
create(:health)
put(
api_service_categories_url(@service, s... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/location_spec.rb | Ruby | bsd-3-clause | 187 | master | 8,755 | require 'rails_helper'
describe Location do
subject { build(:location) }
it { is_expected.to be_valid }
# Associations
it { is_expected.to belong_to(:organization).required }
it { is_expected.to have_one(:address).dependent(:destroy) }
it { is_expected.to have_many(:contacts).dependent(:destroy) }
it {... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/user_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,536 | require 'rails_helper'
# Uses the nifty shoulda-matchers
# https://github.com/thoughtbot/shoulda-matchers
describe User do
subject(:user) { build_stubbed(:user) }
it { is_expected.to be_valid }
it { is_expected.to have_many :api_applications }
it do
expect(subject).to have_db_column(:name).of_type(:strin... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/mail_address_spec.rb | Ruby | bsd-3-clause | 187 | master | 3,413 | require 'rails_helper'
describe MailAddress do
subject { build(:mail_address) }
it { is_expected.to be_valid }
it { is_expected.to belong_to(:location).touch(true).inverse_of(:mail_address).required }
it do
expect(subject).to validate_presence_of(:address_1).
with_message("can't be blank for Mail ... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/admin_spec.rb | Ruby | bsd-3-clause | 187 | master | 1,760 | require 'rails_helper'
describe Admin do
def admin_attrs
{
name: 'Example User',
email: 'user@example.com',
password: 'changeme',
password_confirmation: 'changeme'
}
end
subject { build(:admin, admin_attrs) }
it do
expect(subject).to have_db_column(:name).of_type(:string).... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/service_spec.rb | Ruby | bsd-3-clause | 187 | master | 5,053 | require 'rails_helper'
describe Service do
subject { build(:service) }
it { is_expected.to be_valid }
it { is_expected.to belong_to(:location).touch(true).required }
it { is_expected.to belong_to(:program).optional }
it { is_expected.to have_many(:regular_schedules).dependent(:destroy).inverse_of(:service... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/address_spec.rb | Ruby | bsd-3-clause | 187 | master | 3,392 | require 'rails_helper'
describe Address do
subject { build(:address) }
it { is_expected.to be_valid }
it { is_expected.to belong_to(:location).optional.touch(true) }
it { is_expected.to validate_presence_of(:address_1).with_message("can't be blank for Address") }
it { is_expected.to validate_presence_of(:... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/regular_schedule_spec.rb | Ruby | bsd-3-clause | 187 | master | 2,655 | require 'rails_helper'
describe RegularSchedule do
subject { build(:regular_schedule) }
it { is_expected.not_to be_valid }
it { is_expected.to belong_to(:location).optional.touch(true).inverse_of(:regular_schedules) }
it { is_expected.to belong_to(:service).optional.touch(true).inverse_of(:regular_schedules)... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/program_spec.rb | Ruby | bsd-3-clause | 187 | master | 611 | require 'rails_helper'
describe Program do
subject { build(:program) }
it { is_expected.to be_valid }
it { is_expected.to validate_presence_of(:name).with_message("can't be blank for Program") }
it { is_expected.to belong_to(:organization).required }
it { is_expected.to have_many(:services).dependent(:des... |
github | codeforamerica/ohana-api | https://github.com/codeforamerica/ohana-api | spec/models/category_spec.rb | Ruby | bsd-3-clause | 187 | master | 556 | require 'rails_helper'
describe Category do
subject { build(:category) }
it { is_expected.to be_valid }
it { is_expected.to have_and_belong_to_many(:services) }
it do
expect(subject).to validate_presence_of(:name).
with_message("can't be blank for Category")
end
it do
expect(subject).to v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.