From cd97ef2750c92ce7e770e50fb7044eef5cf45c89 Mon Sep 17 00:00:00 2001 From: Kevin Soltysiak Date: Thu, 28 Dec 2023 08:54:01 +0100 Subject: [PATCH] chore: specs wording --- spec/scalingo/auth/tokens_spec.rb | 4 ++-- spec/support/shared.rb | 19 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/spec/scalingo/auth/tokens_spec.rb b/spec/scalingo/auth/tokens_spec.rb index 4341323..fa64a88 100644 --- a/spec/scalingo/auth/tokens_spec.rb +++ b/spec/scalingo/auth/tokens_spec.rb @@ -8,7 +8,7 @@ let(:arguments) { meta[:exchange][:valid] } let(:stub_pattern) { "exchange-200" } - it "should be successful" do + it "is successful" do expect(response).to be_successful expect(response.data[:token]).to be_present end @@ -18,7 +18,7 @@ let(:arguments) { meta[:exchange][:invalid] } let(:stub_pattern) { "exchange-401" } - it "should be rejected with an valid token" do + it "is rejected with an valid token" do expect(response.status).to eq 401 end end diff --git a/spec/support/shared.rb b/spec/support/shared.rb index 394a5fc..1c4428a 100644 --- a/spec/support/shared.rb +++ b/spec/support/shared.rb @@ -2,7 +2,7 @@ let(:expected_code) { code } let(:custom_headers) { {"X-Custom-Header" => "custom"} } - it "should be successful" do + it "is successful" do expect(response).to be_successful expect(response.status).to eq code end @@ -66,7 +66,7 @@ let(:expected_type) { Object } unless method_defined?(:expected_type) let(:expected_keys) { %i[id] } unless method_defined?(:expected_keys) - it "should be an object of the expected type (and if applicable, the expected keys)" do + it "is an object of the expected type (and if applicable, the expected keys)" do expect(response.data).to be_a_kind_of(expected_type) if response.data.respond_to?(:key?) @@ -80,7 +80,7 @@ RSpec.shared_examples "an empty response" do |code = 204| it_behaves_like "a successful response", code - it "should be empty" do + it "is empty" do expect(response.data).to eq("") end end @@ -92,15 +92,15 @@ let(:expected_type) { Object } unless method_defined?(:expected_type) let(:expected_keys) { %i[id] } unless method_defined?(:expected_keys) - it "should be an array" do + it "is an array" do expect(response.data).to be_a_kind_of(Array) end - it "should have the number of expected elements" do + it "contains the number of expected elements" do expect(response.data.size).to eq(expected_count) end - it "items should be of the expected type (and if applicable, the expected keys)" do + it "items are of the expected type (and if applicable, the expected keys)" do response.data.each do |item| expect(item).to be_a_kind_of(expected_type) @@ -114,16 +114,13 @@ end RSpec.shared_examples "a paginated collection" do |code = 200| - it "should be paginated" do + it "is paginated" do expect(response).to be_paginated end end RSpec.shared_examples "a non-paginated collection" do |code = 200| - it "should not be paginated" do + it "is not paginated" do expect(response).not_to be_paginated end end - -RSpec.shared_examples "a method with a configurable request" do -end