Skip to content

Commit

Permalink
adds localization for buttons in specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerj committed Aug 29, 2015
1 parent 01285f7 commit 4bc578d
Show file tree
Hide file tree
Showing 101 changed files with 366 additions and 365 deletions.
8 changes: 4 additions & 4 deletions app/views/admin/shared/_navigation_links.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
%li
= link_to t('navigation.edit_account'), edit_admin_registration_path
%li
= link_to t('admin.navigation.organizations'), admin_organizations_path
= link_to t('admin.buttons.organizations'), admin_organizations_path
%li
= link_to t('admin.navigation.locations'), admin_locations_path
= link_to t('admin.buttons.locations'), admin_locations_path
%li
= link_to t('admin.navigation.services'), admin_services_path
= link_to t('admin.buttons.services'), admin_services_path
%li
= link_to t('admin.navigation.sign_out'), destroy_admin_session_path, method: 'delete'
= link_to t('navigation.sign_out'), destroy_admin_session_path, method: 'delete'
%ul.nav.navbar-nav.navbar-right
%li
= link_to "Hi, #{current_admin.name}", '#', class: 'logged-in'
2 changes: 1 addition & 1 deletion app/views/admin/shared/forms/_holiday_hours.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
Holiday Hours of operation
= f.fields_for :holiday_schedules do |builder|
= render 'admin/locations/forms/holiday_schedule_fields', f: builder
= link_to_add_fields 'Add holiday schedule', f, :holiday_schedules
= link_to_add_fields I18n.t('admin.buttons.add_holiday_schedule'), f, :holiday_schedules
2 changes: 1 addition & 1 deletion app/views/admin/shared/forms/_hours.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
Hours of operation
= f.fields_for :regular_schedules do |builder|
= render 'admin/locations/forms/regular_schedule_fields', f: builder
= link_to_add_fields 'Add hours of operation', f, :regular_schedules
= link_to_add_fields I18n.t('admin.buttons.add_hours_of_operation'), f, :regular_schedules
2 changes: 1 addition & 1 deletion app/views/home/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- if user_signed_in?
%p
Welcome back, #{@user.name}! #{link_to 'Register a new application', new_api_application_path} or #{link_to 'view', api_applications_path} your existing ones.
Welcome back, #{@user.name}! #{link_to t('links.register_a_new_application'), new_api_application_path} or #{link_to t('links.view'), api_applications_path} your existing ones.
- else
%p
Welcome to the #{t('titles.brand')} developer portal!
Expand Down
13 changes: 7 additions & 6 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ en:
state_province: 'State'
admin:
api_location: 'San Mateo County'
navigation:
organizations: 'Organizations'
locations: 'Locations'
services: 'Services'
sign_out: 'Sign out'
buttons:
organizations: 'Organizations'
locations: 'Locations'
Expand Down Expand Up @@ -68,10 +63,12 @@ en:
remove_holiday_schedule: 'Remove this holiday schedule'
add_admin: 'Add a new admin email'
delete_admin: 'Delete this admin permanently'
add_keyword: 'Add a new keyword'
delete_keyword: 'Delete this keyword permanently'
save_changes: 'Save changes & apply edits to database'
delete_symbol: 'x'
download_zip_file: 'Download zip file'
generate_zip_file: 'Generate zip file'
generate_zip_file: 'Generate zip file'
not_authorized: 'You are not authorized to perform this action.'
notices:
zip_file_generation: >
Expand Down Expand Up @@ -151,5 +148,9 @@ en:
change_my_password: 'Change my password'
register_application: 'Register application'
register_new_application: 'Register new application'
register_a_new_applicaiton: 'Register a new application'
update_application: 'Update application'
delete_application: 'Delete application'
links:
register_a_new_application: 'Register a new application'
view: 'view'
12 changes: 6 additions & 6 deletions spec/features/admin/contacts/create_contact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
create(:location)
login_super_admin
visit('/admin/locations/vrs-services')
click_link 'Add a new contact'
click_link I18n.t('admin.buttons.add_contact')
end

scenario 'with all required fields' do
fill_in 'contact_name', with: 'New VRS Services contact'
click_button 'Create contact'
click_button I18n.t('admin.buttons.create_contact')
click_link 'New VRS Services contact'

expect(find_field('contact_name').value).to eq 'New VRS Services contact'
end

scenario 'without any required fields' do
click_button 'Create contact'
click_button I18n.t('admin.buttons.create_contact')
expect(page).to have_content "Name can't be blank for Contact"
end

scenario 'with email' do
fill_in 'contact_name', with: 'New VRS Services contact'
fill_in 'contact_email', with: 'foo@bar.com'
click_button 'Create contact'
click_button I18n.t('admin.buttons.create_contact')
click_link 'New VRS Services contact'

expect(find_field('contact_email').value).to eq 'foo@bar.com'
Expand All @@ -33,7 +33,7 @@
scenario 'with department' do
fill_in 'contact_name', with: 'New VRS Services contact'
fill_in 'contact_department', with: 'new department'
click_button 'Create contact'
click_button I18n.t('admin.buttons.create_contact')
click_link 'New VRS Services contact'

expect(find_field('contact_department').value).to eq 'new department'
Expand All @@ -42,7 +42,7 @@
scenario 'with title' do
fill_in 'contact_name', with: 'New VRS Services contact'
fill_in 'contact_title', with: 'CTO'
click_button 'Create contact'
click_button I18n.t('admin.buttons.create_contact')
click_link 'New VRS Services contact'

expect(find_field('contact_title').value).to eq 'CTO'
Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin/contacts/delete_contact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

scenario 'when deleting contact' do
find_link('Permanently delete this contact').click
find_link(I18n.t('admin.buttons.delete_contact')).click
using_wait_time 1 do
expect(current_path).to eq admin_location_path(@location)
expect(page).not_to have_link 'Moncef Belyamani'
Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin/contacts/update_department_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

scenario 'with valid department' do
fill_in 'contact_department', with: 'CFO'
click_button 'Save changes'
click_button I18n.t('admin.buttons.save_changes')
expect(page).to have_content 'Contact was successfully updated.'
expect(find_field('contact_department').value).to eq 'CFO'
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/contacts/update_email_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

scenario 'with invalid email' do
fill_in 'contact_email', with: 'foobar'
click_button 'Save changes'
click_button I18n.t('admin.buttons.save_changes')
expect(page).to have_content 'is not a valid email'
end

scenario 'with valid email' do
fill_in 'contact_email', with: 'foo@bar.com'
click_button 'Save changes'
click_button I18n.t('admin.buttons.save_changes')
expect(page).to have_content 'Contact was successfully updated.'
expect(find_field('contact_email').value).to eq 'foo@bar.com'
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/contacts/update_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

scenario 'with empty name' do
fill_in 'contact_name', with: ''
click_button 'Save changes'
click_button I18n.t('admin.buttons.save_changes')
expect(page).to have_content "Name can't be blank for Contact"
end

scenario 'with valid name' do
fill_in 'contact_name', with: 'Monfresh'
click_button 'Save changes'
click_button I18n.t('admin.buttons.save_changes')
expect(page).to have_content 'Contact was successfully updated.'
expect(find_field('contact_name').value).to eq 'Monfresh'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin/contacts/update_title_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

scenario 'with valid title' do
fill_in 'contact_title', with: 'CFO'
click_button 'Save changes'
click_button I18n.t('admin.buttons.save_changes')
expect(page).to have_content 'Contact was successfully updated.'
expect(find_field('contact_title').value).to eq 'CFO'
end
Expand Down
42 changes: 21 additions & 21 deletions spec/features/admin/dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

it 'includes a link to the sign up page' do
within '#main' do
expect(page).to have_link 'Sign up', href: new_admin_registration_path
expect(page).to have_link I18n.t('navigation.sign_up'), href: new_admin_registration_path
end
end

Expand All @@ -24,7 +24,7 @@

it 'does not include a link to Your locations in the navigation' do
within '.navbar' do
expect(page).not_to have_link 'Locations', href: admin_locations_path
expect(page).not_to have_link I18n.t('admin.navigation.locations'), href: admin_locations_path
end
end

Expand All @@ -49,54 +49,54 @@
it 'includes a link to organizations in the body' do
within '.content' do
expect(page).
to have_link 'Organizations', href: admin_organizations_path
to have_link I18n.t('admin.buttons.organizations'), href: admin_organizations_path
end
end

it 'includes a link to locations in the body' do
within '.content' do
expect(page).
to have_link 'Locations', href: admin_locations_path
to have_link I18n.t('admin.buttons.locations'), href: admin_locations_path
end
end

it 'includes a link to services in the body' do
within '.content' do
expect(page).
to have_link 'Services', href: admin_services_path
to have_link I18n.t('admin.buttons.services'), href: admin_services_path
end
end

it 'includes a link to programs in the body' do
within '.content' do
expect(page).
to have_link 'Programs', href: admin_programs_path
to have_link I18n.t('admin.buttons.programs'), href: admin_programs_path
end
end

it 'does not include a link to the sign up page in the navigation' do
within '.navbar' do
expect(page).not_to have_link 'Sign up'
expect(page).not_to have_link I18n.t('navigation.sign_up')
end
end

it 'does not include a link to the sign in page in the navigation' do
within '.navbar' do
expect(page).not_to have_link 'Sign in'
expect(page).not_to have_link I18n.t('navigation.sign_in')
end
end

it 'includes a link to sign out in the navigation' do
within '.navbar' do
expect(page).
to have_link 'Sign out', href: destroy_admin_session_path
to have_link I18n.t('navigation.sign_out'), href: destroy_admin_session_path
end
end

it 'includes a link to the Edit Account page in the navigation' do
within '.navbar' do
expect(page).
to have_link 'Edit account', href: edit_admin_registration_path
to have_link I18n.t('navigation.edit_account'), href: edit_admin_registration_path
end
end

Expand All @@ -108,32 +108,32 @@

it 'includes a link to locations in the navigation' do
within '.navbar' do
expect(page).to have_link 'Locations', href: admin_locations_path
expect(page).to have_link I18n.t('admin.buttons.locations'), href: admin_locations_path
end
end

it 'includes a link to organizations in the navigation' do
within '.navbar' do
expect(page).to have_link 'Organizations', href: admin_organizations_path
expect(page).to have_link I18n.t('admin.buttons.organizations'), href: admin_organizations_path
end
end

it 'includes a link to services in the navigation' do
within '.navbar' do
expect(page).to have_link 'Services', href: admin_services_path
expect(page).to have_link I18n.t('admin.buttons.services'), href: admin_services_path
end
end

it 'does not display a link to add a new organization' do
expect(page).not_to have_link 'Add a new organization', new_admin_organization_path
expect(page).not_to have_link I18n.t('admin.buttons.add_organization'), new_admin_organization_path
end

it 'does not display a link to add a new location' do
expect(page).to_not have_link 'Add a new location', new_admin_location_path
expect(page).to_not have_link I18n.t('admin.buttons.add_location'), new_admin_location_path
end

it 'does not display a link to add a new program' do
expect(page).to_not have_link 'Add a new program', new_admin_program_path
expect(page).to_not have_link I18n.t('admin.buttons.add_program'), new_admin_program_path
end

it 'does not display a link to download CSV' do
Expand All @@ -152,15 +152,15 @@
end

it 'displays a link to add a new organization' do
expect(page).to have_link 'Add a new organization', new_admin_organization_path
expect(page).to have_link I18n.t('admin.buttons.add_organization'), new_admin_organization_path
end

it 'does not display a link to add a new location' do
expect(page).to_not have_link 'Add a new location', new_admin_location_path
expect(page).to_not have_link I18n.t('admin.buttons.add_location'), new_admin_location_path
end

it 'does not display a link to add a new program' do
expect(page).to_not have_link 'Add a new program', new_admin_program_path
expect(page).to_not have_link I18n.t('admin.buttons.add_program'), new_admin_program_path
end
end

Expand All @@ -172,11 +172,11 @@
end

it 'displays a link to add a new location' do
expect(page).to have_link 'Add a new location', new_admin_location_path
expect(page).to have_link I18n.t('admin.buttons.add_location'), new_admin_location_path
end

it 'displays a link to add a new program' do
expect(page).to have_link 'Add a new program', new_admin_program_path
expect(page).to have_link I18n.t('admin.buttons.add_program'), new_admin_program_path
end

it 'displays link to generate zip file' do
Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin/edit_account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
it 'allows the name to be changed' do
fill_in 'admin_name', with: 'New Admin name'
fill_in 'admin_current_password', with: @admin.password
click_button 'Update'
click_button I18n.t('buttons.update')
visit '/admin/edit'
expect(find_field('admin_name').value).to eq 'New Admin name'
end

it 'redirects to the admin edit page after update' do
fill_in 'admin_name', with: 'New Admin name'
fill_in 'admin_current_password', with: @admin.password
click_button 'Update'
click_button I18n.t('buttons.update')
expect(current_path).to eq edit_admin_registration_path
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
it "doesn't allow adding an admin" do
login_admin
visit '/admin/locations/vrs-services'
expect(page).to_not have_content 'Add a new admin email'
expect(page).to_not have_content I18n.t('admin.buttons.add_admin')
end
end

context 'when super admin' do
it 'allows adding an admin' do
login_super_admin
visit '/admin/locations/vrs-services'
expect(page).to have_content 'Add a new admin email'
expect(page).to have_content I18n.t('admin.buttons.add_admin')
end
end

Expand All @@ -26,7 +26,7 @@
create(:location_for_org_admin)
login_admin
visit '/admin/locations/samaritan-house'
expect(page).to have_content 'Add a new admin email'
expect(page).to have_content I18n.t('admin.buttons.add_admin')
end
end

Expand All @@ -36,7 +36,7 @@
@location.update!(admin_emails: ['moncef@gmail.com'])
login_as_admin(new_admin)
visit '/admin/locations/vrs-services'
expect(page).to have_content 'Add a new admin email'
expect(page).to have_content I18n.t('admin.buttons.add_admin')
end
end
end
Loading

0 comments on commit 4bc578d

Please sign in to comment.