diff --git a/spec/features/locales_spec.rb b/spec/features/locales_spec.rb index 0153fc8a2d..4ad032abaf 100644 --- a/spec/features/locales_spec.rb +++ b/spec/features/locales_spec.rb @@ -16,12 +16,6 @@ abbreviation: 'en-CA' ).first_or_create, - Language.where( - default_language: false, - name: 'English (GB)', - abbreviation: 'en-GB' - ).first_or_create, - Language.where( default_language: false, name: 'Français (CA)', @@ -34,7 +28,7 @@ let!(:user) { create(:user, language: languages.first) } before do - locales = %w[en-GB en-CA fr-CA] + locales = %w[en-CA fr-CA] I18n.available_locales = locales I18n.locale = locales.first sign_in(user) @@ -49,13 +43,15 @@ context 'when new locale has no region' do scenario 'user changes their locale' do - skip 'We are now expecting locales to have region' - create_plan_text = 'Créer des plans' + create_plan_text = I18n.with_locale(:'fr-CA') do + _('Create plan') + end + click_link 'Language' expect(current_path).to eql(plans_path) expect(page).not_to have_text(create_plan_text) - click_link 'German' + click_link 'Français (CA)' expect(current_path).to eql(plans_path) expect(page).to have_text(create_plan_text) end @@ -63,7 +59,9 @@ context 'when new locale has region' do scenario 'user changes their locale' do - create_plan_text = 'Créer des plans' + create_plan_text = I18n.with_locale('fr-CA') do + _('Create plan') + end click_link 'Language' expect(current_path).to eql(plans_path) expect(page).not_to have_text(create_plan_text) diff --git a/spec/features/plans_spec.rb b/spec/features/plans_spec.rb index ab19e371e3..ccae427cb5 100644 --- a/spec/features/plans_spec.rb +++ b/spec/features/plans_spec.rb @@ -10,7 +10,8 @@ @org = create(:org) @research_org = create(:org, :organisation, :research_institute, name: 'Test Research Org', templates: 1) - @funding_org = create(:org, :funder, name: 'Test Funder Org', templates: 1) + @funding_org = create(:org, :funder, templates: 1) + Rails.application.config.default_funder_id = @funding_org.id @template = create(:template, org: @org) @user = create(:user, org: @org) sign_in(@user) @@ -32,16 +33,14 @@ # ) end - xit 'User creates a new Plan', :js do - # TODO: Revisit this after we start refactoring/building out or tests for - # the new create plan workflow. For some reason the plans/new.js isn't - # firing here but works fine in the UI with manual testing - # Action + it 'User creates a new Plan', :js do click_link 'Create plan' fill_in :plan_title, with: 'My test plan' choose_suggestion('plan_org_org_name', @research_org) - choose_suggestion('plan_funder_org_name', @funding_org) + within('#plan_template_id') do + select @default_template.title + end click_button 'Create plan' # Expectations @@ -51,6 +50,6 @@ expect(page).to have_css("input[type=text][value='#{@plan.title}']") expect(@plan.title).to eql('My test plan') expect(@plan.org_id).to eql(@research_org.id) - expect(@plan.funder_id).to eql(@funding_org.id) + expect(@plan.template_id).to eql(@default_template.id) end end