@ -68,6 +68,19 @@ RSpec.describe SchemesController, type: :request do
end
end
end
end
it " shows incomplete tag if the scheme is not confirmed " do
schemes [ 0 ] . update! ( confirmed : nil )
get " /schemes "
assert_select " .govuk-tag " , text : / Incomplete / , count : 1
end
it " displays a link to check answers page if the scheme is incomplete " do
scheme = schemes [ 0 ]
scheme . update! ( confirmed : nil )
get " /schemes "
expect ( page ) . to have_link ( nil , href : / schemes \/ #{ scheme . id } \/ check-answers / )
end
it " shows a search bar " do
it " shows a search bar " do
expect ( page ) . to have_field ( " search " , type : " search " )
expect ( page ) . to have_field ( " search " , type : " search " )
end
end
@ -166,6 +179,15 @@ RSpec.describe SchemesController, type: :request do
end
end
end
end
it " returns results with no location " do
scheme_without_location = FactoryBot . create ( :scheme )
get " /schemes?search= #{ scheme_without_location . id } "
expect ( page ) . to have_content ( scheme_without_location . id_to_display )
schemes . each do | scheme |
expect ( page ) . not_to have_content ( scheme . id_to_display )
end
end
it " updates the table caption " do
it " updates the table caption " do
expect ( page ) . to have_content ( " 1 scheme found matching ‘ #{ search_param } ’ " )
expect ( page ) . to have_content ( " 1 scheme found matching ‘ #{ search_param } ’ " )
end
end