Skip to content

Commit

Permalink
Fix: replace a few lost assertions with equivalent expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
ysbaddaden committed Nov 7, 2023
1 parent 87c92f5 commit b8d6e6b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
16 changes: 5 additions & 11 deletions plugins/csd_api/spec/controllers/csd_api_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def generate_request(message_id = "urn:uuid:26c27ce7-4470-4f59-bc22-3ede0bd084a0
request.env["RAW_POST_DATA"] = generate_request(request_id)

post :get_directory_modifications, collection_id: collection.id
assert_equal 200, response.status
expect(response.status).to eq(200)

response_hash = Hash.from_xml(response.body)

Expand Down Expand Up @@ -102,11 +102,8 @@ def generate_request(message_id = "urn:uuid:26c27ce7-4470-4f59-bc22-3ede0bd084a0
</soap:Envelope>
}

expected = Hash.from_xml(expected_xml)
response_hash = Hash.from_xml(response.body)

assert_equal expected, response_hash
assert_equal 500, @response.status
expect(Hash.from_xml(response.body)).to eq(Hash.from_xml(expected_xml))
expect(@response.status).to eq(500)
end

# Request Validation is currenty commented in the code because it takes too long
Expand All @@ -126,11 +123,8 @@ def generate_request(message_id = "urn:uuid:26c27ce7-4470-4f59-bc22-3ede0bd084a0
</soap:Envelope>
}

expected = Hash.from_xml(expected_xml)
response_hash = Hash.from_xml(response.body)

assert_equal expected, response_hash
assert_equal 500, @response.status
expect(Hash.from_xml(response.body)).to eq(Hash.from_xml(expected_xml))
expect(@response.status).to eq(500)
end

it "should return facilities modified after a particular date" do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/search_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe SearchParser, :type => :model do
it "nil" do
s = SearchParser.new(nil)
assert_equal nil, s.search
expect(s.search).to be_nil
end

it "simple 1" do
Expand Down
12 changes: 6 additions & 6 deletions spec/models/telemetry/accounts_collector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

stats = Telemetry::AccountsCollector.collect_stats(period)

assert_equal stats, {
expect(stats).to eq({
"counters" => [
{
"metric" => "accounts",
"key" => {},
"value" => 3
}
]
}
})
end

it "takes into account period date" do
Expand All @@ -28,21 +28,21 @@
2.times { User.make }
p1 = InsteddTelemetry::Period.current

assert_equal Telemetry::AccountsCollector.collect_stats(p0), {
expect(Telemetry::AccountsCollector.collect_stats(p0)).to eq({
"counters" => [{
"metric" => "accounts",
"key" => {},
"value" => 3
}]
}
})

assert_equal Telemetry::AccountsCollector.collect_stats(p1), {
expect(Telemetry::AccountsCollector.collect_stats(p1)).to eq({
"counters" => [{
"metric" => "accounts",
"key" => {},
"value" => 5
}]
}
})
end

end

0 comments on commit b8d6e6b

Please sign in to comment.