From 39cc997ef4fbf212c3420683e9e3f5e4a6d80a5e Mon Sep 17 00:00:00 2001 From: Anna Anks Nowak Date: Tue, 1 Jan 2019 19:53:56 +0100 Subject: [PATCH] Add check for arrow icons --- .../features/admin/budget_investments_spec.rb | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index fb3b2e5c9..76a63e350 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -619,6 +619,9 @@ feature 'Admin budget investments' do expect('B First Investment').to appear_before('A Second Investment') expect('A Second Investment').to appear_before('C Third Investment') + within('th', text: 'ID') do + expect(page).to have_css(".icon-arrow-top") + end end scenario 'Sort by title' do @@ -626,6 +629,9 @@ feature 'Admin budget investments' do expect('A Second Investment').to appear_before('B First Investment') expect('B First Investment').to appear_before('C Third Investment') + within('th', text: 'Title') do + expect(page).to have_css(".icon-arrow-top") + end end scenario 'Sort by supports' do @@ -633,6 +639,9 @@ feature 'Admin budget investments' do expect('C Third Investment').to appear_before('A Second Investment') expect('A Second Investment').to appear_before('B First Investment') + within('th', text: 'Supports') do + expect(page).to have_css(".icon-arrow-top") + end end end @@ -642,6 +651,9 @@ feature 'Admin budget investments' do expect('C Third Investment').to appear_before('A Second Investment') expect('A Second Investment').to appear_before('B First Investment') + within('th', text: 'ID') do + expect(page).to have_css(".icon-arrow-down") + end end scenario 'Sort by title' do @@ -649,6 +661,9 @@ feature 'Admin budget investments' do expect('C Third Investment').to appear_before('B First Investment') expect('B First Investment').to appear_before('A Second Investment') + within('th', text: 'Title') do + expect(page).to have_css(".icon-arrow-down") + end end scenario 'Sort by supports' do @@ -656,6 +671,9 @@ feature 'Admin budget investments' do expect('B First Investment').to appear_before('A Second Investment') expect('A Second Investment').to appear_before('C Third Investment') + within('th', text: 'Supports') do + expect(page).to have_css(".icon-arrow-down") + end end end @@ -665,6 +683,9 @@ feature 'Admin budget investments' do expect('B First Investment').to appear_before('A Second Investment') expect('A Second Investment').to appear_before('C Third Investment') + within('th', text: 'ID') do + expect(page).to have_css(".icon-arrow-top") + end end scenario 'Sort by title' do @@ -672,6 +693,9 @@ feature 'Admin budget investments' do expect('A Second Investment').to appear_before('B First Investment') expect('B First Investment').to appear_before('C Third Investment') + within('th', text: 'Title') do + expect(page).to have_css(".icon-arrow-top") + end end scenario 'Sort by supports' do @@ -679,10 +703,23 @@ feature 'Admin budget investments' do expect('C Third Investment').to appear_before('A Second Investment') expect('A Second Investment').to appear_before('B First Investment') + within('th', text: 'Supports') do + expect(page).to have_css(".icon-arrow-top") + end end end + context 'With incorrect direction provided sorts ascending' do + scenario 'Sort by ID' do + visit admin_budget_budget_investments_path(budget, sort_by: 'id', direction: 'incorrect') + expect('B First Investment').to appear_before('A Second Investment') + expect('A Second Investment').to appear_before('C Third Investment') + within('th', text: 'ID') do + expect(page).to have_css(".icon-arrow-top") + end + end + end end context 'Show' do