Skip to content

Commit

Permalink
chore: specs wording
Browse files Browse the repository at this point in the history
  • Loading branch information
ksol committed Dec 28, 2023
1 parent d9afca1 commit cd97ef2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions spec/scalingo/auth/tokens_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
19 changes: 8 additions & 11 deletions spec/support/shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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?)
Expand All @@ -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
Expand All @@ -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)

Expand All @@ -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

0 comments on commit cd97ef2

Please sign in to comment.