1
0
Fork 0

Add more specs

This commit is contained in:
Alex Kotov 2020-01-15 15:08:44 +05:00
parent 4c691b4653
commit 25530835e2
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 24 additions and 5 deletions

View File

@ -88,6 +88,9 @@ RSpec/DescribeClass:
RSpec/ExampleLength:
Max: 8
RSpec/ExpectInHook:
Enabled: false
RSpec/ImplicitSubject:
Enabled: false

View File

@ -8,7 +8,7 @@ RSpec.describe SendTelegramMessage do
let(:chat_id) { rand 0...10_000 }
let(:text) { Faker::Lorem.paragraph }
let! :request do
let :request do
stub_request(
:post,
[
@ -25,11 +25,27 @@ RSpec.describe SendTelegramMessage do
)
end
after do
expect(request).to have_been_made.once
context 'when request succeeds' do
let!(:response) { request }
after do
expect(response).to have_been_made.once
end
specify do
expect(subject).to be_success
end
end
specify do
expect(subject).to be_success
context 'when request fails' do
let!(:response) { request.to_return status: [500, 'Internal Server Error'] }
after do
expect(response).to have_been_made.once
end
specify do
expect(subject).to be_failure
end
end
end