Skip to content

Commit

Permalink
test: improve update matrix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Mar 9, 2018
1 parent 6c11cbe commit 52d587e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
23 changes: 21 additions & 2 deletions spec/features/update_matrix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

before do
td.create_pact_with_hierarchy("Foo", "1", "Bar")
.create_consumer_version_tag("prod")
.create_verification(provider_version: "2")
end

Expand All @@ -38,6 +37,10 @@
it "deletes the relevant lines from the matrix" do
expect{ subject }.to change{ PactBroker::Matrix::Row.count }.by(-1)
end

it "deletes the relevant lines from the head matrix" do
expect{ subject }.to change{ PactBroker::Matrix::HeadRow.count }.by(-1)
end
end

context "deleting a pacticipant" do
Expand All @@ -46,6 +49,10 @@
it "deletes the relevant lines from the matrix" do
expect{ subject }.to change{ PactBroker::Matrix::Row.count }.by(-1)
end

it "deletes the relevant lines from the head matrix" do
expect{ subject }.to change{ PactBroker::Matrix::HeadRow.count }.by(-1)
end
end

context "deleting a version" do
Expand All @@ -54,12 +61,24 @@
it "deletes the relevant lines from the matrix" do
expect{ subject }.to change{ PactBroker::Matrix::Row.count }.by(-1)
end

it "deletes the relevant lines from the head matrix" do
expect{ subject }.to change{ PactBroker::Matrix::HeadRow.count }.by(-1)
end
end

context "deleting a tag" do
before do
td.create_consumer_version_tag("prod")
end

let(:path) { "/pacticipants/Foo/versions/1/tags/prod" }

it "deletes the relevant lines from the matrix" do
it "does not delete any lines from the matrix" do
expect{ subject }.to change{ PactBroker::Matrix::Row.count }.by(0)
end

it "deletes the relevant lines from the head matrix" do
expect{ subject }.to change{ PactBroker::Matrix::HeadRow.count }.by(-1)
end
end
Expand Down
22 changes: 22 additions & 0 deletions spec/fixtures/foo-bar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"consumer": {
"name": "Foo"
},
"provider": {
"name": "Bar"
},
"interactions": [
{
"description" : "a request for something",
"providerState": null,
"request": {
"method": "get",
"path" : "/something"
},
"response": {
"status": 200,
"body" : "something"
}
}
]
}

0 comments on commit 52d587e

Please sign in to comment.