diff --git a/app/helpers/mappings_helper.rb b/app/helpers/mappings_helper.rb index a238ac48c..083d3e13c 100644 --- a/app/helpers/mappings_helper.rb +++ b/app/helpers/mappings_helper.rb @@ -1,5 +1,3 @@ -# encoding=utf-8 - module MappingsHelper def example_url(mapping, options = {}) scheme_and_host = 'http://'+ mapping.site.default_host.hostname @@ -51,7 +49,7 @@ def mapping_edit_tabs(options = {}) # e.g. [['301 Moved Permanently', '301'], ['410 Gone', '410']] def options_for_supported_statuses Mapping::TYPES.map do |status, type| - ["#{type.titleize} — #{status}: #{Rack::Utils::HTTP_STATUS_CODES[status.to_i]}", status] + ["#{type.titleize}", status] end end end diff --git a/app/views/mappings/_form.html.erb b/app/views/mappings/_form.html.erb index a94da3cbf..2a6f3f42b 100644 --- a/app/views/mappings/_form.html.erb +++ b/app/views/mappings/_form.html.erb @@ -2,7 +2,7 @@ <%= render 'shared/error_messages', model: f.object %> <%= f.label :http_status, 'Type' %> - <%= f.select :http_status, options_for_supported_statuses, {}, { class: 'remove-bottom-margin span4 js-http-status' } %> + <%= f.select :http_status, options_for_supported_statuses, {}, { class: 'remove-bottom-margin js-http-status' } %> <% if @mapping.persisted? # we're editing, show the example URL %>
@@ -18,7 +18,7 @@ <% end %> <%= field_set_tag nil, class: 'js-for-redirect' do %> - <%= f.label :new_url, 'New URL' %> + <%= f.label :new_url, 'Redirects to' %> <%= f.text_field :new_url, class: 'span8', placeholder: 'https://www.gov.uk' %> <% end %> diff --git a/features/mapping_edit.feature b/features/mapping_edit.feature index eb7c29bd5..92f79da3c 100644 --- a/features/mapping_edit.feature +++ b/features/mapping_edit.feature @@ -14,7 +14,7 @@ Feature: Edit a site's mapping @javascript Scenario: Editing a site mapping that is a redirect - When I make the mapping a redirect with a new URL of https://gov.uk/new-url + When I make the mapping a redirect to https://gov.uk/new-url Then I should see redirect fields But I should not see archive fields When I save the mapping @@ -29,7 +29,7 @@ Feature: Edit a site's mapping But I should see archive fields Scenario: Editing a mapping with invalid values - When I make the mapping a redirect with a new URL of not-a-url + When I make the mapping a redirect to not-a-url And I save the mapping Then I should still be editing a mapping And I should see "New URL is not a URL" diff --git a/features/mapping_history.feature b/features/mapping_history.feature index ab0afa2b1..c321cfc93 100644 --- a/features/mapping_history.feature +++ b/features/mapping_history.feature @@ -10,7 +10,7 @@ Feature: History of edits to a mapping | 301 | /about/corporate | http://somewhere.good | And I visit the path /sites/directgov/mappings And I click the link "Edit" - And I change the mapping's New URL to http://somewhere.bad + And I change the mapping's redirect to http://somewhere.bad Scenario: Looking at an edited mapping When I log in as a SIRO diff --git a/features/step_definitions/mappings_interaction_steps.rb b/features/step_definitions/mappings_interaction_steps.rb index d4b16250a..8a840860a 100644 --- a/features/step_definitions/mappings_interaction_steps.rb +++ b/features/step_definitions/mappings_interaction_steps.rb @@ -2,13 +2,13 @@ click_link 'Add mapping' end -When(/^I make the mapping a redirect with a new URL of (.*)$/) do |new_url| - select '301', from: 'Type' - fill_in 'New URL', with: new_url +When(/^I make the mapping a redirect to (.*)$/) do |new_url| + select 'Redirect', from: 'Type' + fill_in 'Redirects to', with: new_url end When(/^I make the mapping an archive$/) do - select '410', from: 'Type' + select 'Archive', from: 'Type' end When(/^I (save|create) the mapping$/) do |type| @@ -24,12 +24,12 @@ click_button 'Filter' end -When(/^I change the mapping's (.*) to (.*)$/) do |field_name, value| - fill_in field_name, with: value +When(/^I change the mapping's redirect to (.*)$/) do |value| + fill_in 'Redirects to', with: value step 'I save the mapping' end When(/^I make the mapping a redirect from (.*) to (.*)$/) do |path, new_url| fill_in 'Old URL', with: path - fill_in 'New URL', with: new_url + fill_in 'Redirects to', with: new_url end diff --git a/spec/helpers/mappings_helper_spec.rb b/spec/helpers/mappings_helper_spec.rb index 839b8321c..f47308c57 100644 --- a/spec/helpers/mappings_helper_spec.rb +++ b/spec/helpers/mappings_helper_spec.rb @@ -1,5 +1,3 @@ -# encoding=utf-8 - require 'spec_helper' describe MappingsHelper do @@ -36,7 +34,7 @@ describe '#options_for_supported_statuses' do it 'provides an array of supported statuses in a form compatible with FormBuilder#select' do - helper.options_for_supported_statuses.should == [['Redirect — 301: Moved Permanently', '301'], ['Archive — 410: Gone', '410']] + helper.options_for_supported_statuses.should == [['Redirect', '301'], ['Archive', '410']] end end end