diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index a1920646e..8adc9ce27 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -4,7 +4,7 @@
  - <%= link_to t("debates.show.back_link"), debates_path, class: 'left back' %> + <%= link_to t("debates.show.back_link"), :back, class: 'left back' %> <% if current_user && @debate.editable_by?(current_user) %> <%= link_to edit_debate_path(@debate), class: 'edit-debate button success tiny radius right' do %> diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 32260992b..d6239fc1e 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -51,6 +51,15 @@ feature 'Debates' do end end + scenario 'Show: "Back" link directs to previous page', :js do + debate = create(:debate, title: 'Test Debate 1') + + visit debates_path(order: :hot_score, page: 1) + find(:xpath, "//a[@href='/debates/#{debate.id}']", match: :first).click + + expect(find_link('Back')[:href]).to include(debates_path order: :hot_score, page: 1) + end + scenario 'Create' do author = create(:user) login_as(author)