From 4e83013c7dc5024b947f67d89ade61c2e2caff3a Mon Sep 17 00:00:00 2001 From: Kieran Trezona-le Comte <trezona-lecomte@gmail.com> Date: Fri, 17 Jul 2015 11:35:22 +1200 Subject: [PATCH] Extra test case, and make existing tests more concise --- spec/sqlint_spec.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/spec/sqlint_spec.rb b/spec/sqlint_spec.rb index 3ffe696..dfb2f49 100644 --- a/spec/sqlint_spec.rb +++ b/spec/sqlint_spec.rb @@ -35,24 +35,28 @@ RSpec.describe SQLint do context "with a single invalid keyword" do let(:input) { "WIBBLE" } it "reports one error" do - expect(results.size).to eq(1) - expect(results.first).to eq(error(1, 1, WIBBLE_ERROR)) + expect(results).to eq([error(1, 1, WIBBLE_ERROR)]) + end + end + + context "with two successive invalid keywords" do + let(:input) { "WIBBLE WIBBLE" } + it "report 2 errors" do + expect(results).to eq([error(1, 1, WIBBLE_ERROR)]) end end context "with a single invalid keyword on a later line" do let(:input) { "SELECT 1;\nWIBBLE" } it "reports one error" do - expect(results.size).to eq(1) - expect(results.first).to eq(error(2, 1, WIBBLE_ERROR)) + expect(results).to eq([error(2, 1, WIBBLE_ERROR)]) end end context "with a single error part-way through a line" do let(:input) { "SELECT '" } it "reports one error" do - expect(results.size).to eq(1) - expect(results.first).to eq(error(1, 8, 'unterminated quoted string at or near "\'"')) + expect(results).to eq([error(1, 8, 'unterminated quoted string at or near "\'"')]) end end -- GitLab