spec/api/deepl_spec.rb in deepl-rb-1.0.1 vs spec/api/deepl_spec.rb in deepl-rb-2.0.0
- old
+ new
@@ -47,14 +47,32 @@
VCR.use_cassette('deepl_translate') { example.call }
end
context 'When translating a text' do
it 'should create and call a request object' do
- expect(DeepL::Requests::TranslateText).to receive(:new)
+ expect(DeepL::Requests::Translate).to receive(:new)
.with(subject.api, input, source_lang, target_lang, options).and_call_original
text = subject.translate(input, source_lang, target_lang, options)
expect(text).to be_a(DeepL::Resources::Text)
+ end
+ end
+ end
+
+ describe '#usage' do
+ let(:options) { {} }
+
+ around do |example|
+ VCR.use_cassette('deepl_usage') { example.call }
+ end
+
+ context 'When checking usage' do
+ it 'should create and call a request object' do
+ expect(DeepL::Requests::Usage).to receive(:new)
+ .with(subject.api, options).and_call_original
+
+ usage = subject.usage(options)
+ expect(usage).to be_a(DeepL::Resources::Usage)
end
end
end
end