require_relative '../integration_test_helper'

class AnswerRenderingTest < ActionDispatch::IntegrationTest

  should "rendering a quick answer correctly" do
    setup_api_responses('vat-rates')
    visit "/vat-rates"

    assert_equal 200, page.status_code

    within 'head' do
      assert page.has_selector?("title", :text => "VAT rates - GOV.UK")
      assert page.has_selector?("link[rel=alternate][type='application/json'][href='/api/vat-rates.json']")
    end

    within '#content' do
      within 'header' do
        assert page.has_content?("VAT rates")
        assert page.has_content?("Quick answer")
      end

      within '.article-container' do
        within 'article' do
          assert page.has_selector?(".highlight-answer p em", :text => "20%")
        end

        assert page.has_selector?(".modified-date", :text => "Last updated: 22 October 2012")

        assert page.has_selector?("#test-report_a_problem")
      end
    end # within #content

    assert page.has_selector?("#test-related")
  end
end

require_relative '../integration_test_helper'

class AnswerRenderingTest < ActionDispatch::IntegrationTest

  context "rendering a quick answer" do
    should "quick_answer request" do
      setup_api_responses('vat-rates')
      visit "/vat-rates"

      assert_equal 200, page.status_code

      within 'head' do
        assert page.has_selector?("title", :text => "VAT rates - GOV.UK")
        assert page.has_selector?("link[rel=alternate][type='application/json'][href='/api/vat-rates.json']")
      end

      within '#content' do
        within 'header' do
          assert page.has_content?("VAT rates")
          assert page.has_content?("Quick answer")
        end

        within '.article-container' do
          within 'article' do
            assert page.has_selector?(".highlight-answer p em", :text => "20%")
          end

          assert page.has_selector?(".modified-date", :text => "Last updated: 22 October 2012")

          assert page.has_selector?("#test-report_a_problem")
        end
      end # within #content

      assert page.has_selector?("#test-related")
    end
  end
end

--- 
+++ 
@@ -2,36 +2,34 @@
 
 class AnswerRenderingTest < ActionDispatch::IntegrationTest
 
-  context "rendering a quick answer" do
-    should "quick_answer request" do
-      setup_api_responses('vat-rates')
-      visit "/vat-rates"
+  should "rendering a quick answer correctly" do
+    setup_api_responses('vat-rates')
+    visit "/vat-rates"
 
-      assert_equal 200, page.status_code
+    assert_equal 200, page.status_code
 
-      within 'head' do
-        assert page.has_selector?("title", :text => "VAT rates - GOV.UK")
-        assert page.has_selector?("link[rel=alternate][type='application/json'][href='/api/vat-rates.json']")
+    within 'head' do
+      assert page.has_selector?("title", :text => "VAT rates - GOV.UK")
+      assert page.has_selector?("link[rel=alternate][type='application/json'][href='/api/vat-rates.json']")
+    end
+
+    within '#content' do
+      within 'header' do
+        assert page.has_content?("VAT rates")
+        assert page.has_content?("Quick answer")
       end
 
-      within '#content' do
-        within 'header' do
-          assert page.has_content?("VAT rates")
-          assert page.has_content?("Quick answer")
+      within '.article-container' do
+        within 'article' do
+          assert page.has_selector?(".highlight-answer p em", :text => "20%")
         end
 
-        within '.article-container' do
-          within 'article' do
-            assert page.has_selector?(".highlight-answer p em", :text => "20%")
-          end
+        assert page.has_selector?(".modified-date", :text => "Last updated: 22 October 2012")
 
-          assert page.has_selector?(".modified-date", :text => "Last updated: 22 October 2012")
+        assert page.has_selector?("#test-report_a_problem")
+      end
+    end # within #content
 
-          assert page.has_selector?("#test-report_a_problem")
-        end
-      end # within #content
-
-      assert page.has_selector?("#test-related")
-    end
+    assert page.has_selector?("#test-related")
   end
 end
Tidy up quick-answer integration test.