зеркало из
https://github.com/glebtv/yookassa.git
synced 2026-09-04 02:05:51 +03:00
Preparing clients for partner api (#25)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6072b2ae0f
Коммит
7f79ffa4b4
@@ -2,10 +2,9 @@
|
||||
|
||||
RSpec.describe Yookassa::Payments do
|
||||
let(:config) { { shop_id: "SHOP_ID", api_key: "API_KEY" } }
|
||||
let(:client) { Yookassa::Client.new(**config) }
|
||||
let(:payment) { described_class.new(**config) }
|
||||
let(:idempotency_key) { SecureRandom.hex(1) }
|
||||
|
||||
let(:payment) { client.payments }
|
||||
let(:body) { File.read("spec/fixtures/payment_response.json") }
|
||||
|
||||
before { stub_request(:any, //).to_return(body: body, headers: { "Content-Type" => "application/json" }) }
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
RSpec.describe Yookassa::Receipts do
|
||||
let(:config) { { shop_id: "SHOP_ID", api_key: "API_KEY" } }
|
||||
let(:client) { Yookassa::Client.new(**config) }
|
||||
let(:receipt) { described_class.new(**config) }
|
||||
let(:idempotency_key) { SecureRandom.hex(1) }
|
||||
let(:receipt) { client.receipts }
|
||||
let(:body) { File.read("spec/fixtures/receipt_response.json") }
|
||||
|
||||
before { stub_request(:any, //).to_return(body: body, headers: { "Content-Type" => "application/json" }) }
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
RSpec.describe Yookassa::Refunds do
|
||||
let(:config) { { shop_id: "SHOP_ID", api_key: "API_KEY" } }
|
||||
let(:client) { Yookassa::Client.new(**config) }
|
||||
let(:refund) { described_class.new(**config) }
|
||||
let(:idempotency_key) { SecureRandom.hex(1) }
|
||||
let(:refund) { client.refunds }
|
||||
let(:body) { File.read("spec/fixtures/refund_response.json") }
|
||||
|
||||
before { stub_request(:any, //).to_return(body: body, headers: { "Content-Type" => "application/json" }) }
|
||||
|
||||
@@ -19,23 +19,6 @@ RSpec.describe Yookassa do
|
||||
end
|
||||
end
|
||||
|
||||
describe ".client" do
|
||||
context "when no settings are provided" do
|
||||
before { Yookassa.instance_variable_set(:@config, nil) }
|
||||
|
||||
it "raises an error" do
|
||||
expect { Yookassa.client }.to raise_error(Yookassa::ConfigError)
|
||||
end
|
||||
end
|
||||
|
||||
context "when instance configured" do
|
||||
it "creates and stores client" do
|
||||
expect(Yookassa.client).to be_a(Yookassa::Client)
|
||||
expect(Yookassa.client).to eq(Yookassa.client)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ".payments" do
|
||||
it "delegates request to client and creates an instance" do
|
||||
expect(Yookassa.payments).to be_a(Yookassa::Payments)
|
||||
|
||||
Ссылка в новой задаче
Block a user