From dd9f81ec82e9a34877ecb1e8722aae9fbb0acea4 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Wed, 18 Jun 2014 19:14:14 +0200 Subject: [PATCH] fixed version check --- .../HttpInterface/api-compatibility-spec.rb | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/UnitTests/HttpInterface/api-compatibility-spec.rb b/UnitTests/HttpInterface/api-compatibility-spec.rb index 80b7dfa9de..a49a8465b8 100644 --- a/UnitTests/HttpInterface/api-compatibility-spec.rb +++ b/UnitTests/HttpInterface/api-compatibility-spec.rb @@ -16,7 +16,7 @@ describe ArangoDB do doc.code.should eq(200) compatibility = doc.parsed_response['compatibility'] compatibility.should be_kind_of(Integer) - compatibility.should eq(20100) + compatibility.should eq(20200) end it "tests the compatibility value when a broken header is set" do @@ -28,7 +28,7 @@ describe ArangoDB do doc.code.should eq(200) compatibility = doc.parsed_response['compatibility'] compatibility.should be_kind_of(Integer) - compatibility.should eq(20100) + compatibility.should eq(20200) end end @@ -97,6 +97,19 @@ describe ArangoDB do end end + it "tests the compatibility value when a valid header is set" do + versions = [ "2.2.0", "2.2.0-devel", "2.2.0-alpha", "2.2", " 2.2", "2.2 ", " 2.2.0", " 2.2.0 ", "20200", "20200 ", "20299" ] + + versions.each do|value| + doc = ArangoDB.get("/_admin/echo", :headers => { "x-arango-version" => value }) + + doc.code.should eq(200) + compatibility = doc.parsed_response['compatibility'] + compatibility.should be_kind_of(Integer) + compatibility.should eq(20200) + end + end + it "tests the compatibility value when a too low version is set" do versions = [ "0.0", "0.1", "0.2", "0.9", "1.0", "1.1", "1.2" ] @@ -111,12 +124,12 @@ describe ArangoDB do end it "tests the compatibility value when a too high version is set" do - doc = ArangoDB.get("/_admin/echo", :headers => { "x-arango-version" => "2.1" }) + doc = ArangoDB.get("/_admin/echo", :headers => { "x-arango-version" => "2.3" }) doc.code.should eq(200) compatibility = doc.parsed_response['compatibility'] compatibility.should be_kind_of(Integer) - compatibility.should eq(20100) + compatibility.should eq(20200) end end