docbrown/spec/services/twitter_client/client_spec.rb
Michael Kohl 6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* Rename SiteConfig

* More renaming

* Update spec

* Update mandatory settings mapping

* More renaming

* e2e test fixes

* You have a rename, and you have a rename

* Spec fix

* More changes

* Temporarily disable specs

* After-merge update

* Undo rename for migration

* undo rename of DUS

* Fix DUS

* Fix merge problem

* Remove redundant DUS

* Fix specs

* Remove unused code

* Change wrong class name

* More cleanup

* Re-add missing values to constant

* Fix constant

* Fix spec

* Remove obsolete fields

* Add accidentally removed field

* Update spec

* Move methods from Settings::General to ForemInstance

* Remove unneeded model

* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00

30 lines
909 B
Ruby

require "rails_helper"
RSpec.describe TwitterClient::Client, type: :service, vcr: true do
let(:tweet_id) { "1018911886862057472" }
describe ".status" do
it "returns a status" do
VCR.use_cassette("twitter_client_status") do
tweet = described_class.status(tweet_id)
expect(tweet.text).to be_present
end
end
it "works properly when Settings::General is set" do
VCR.use_cassette("twitter_client_status") do
allow(Settings::Authentication).to receive(:twitter_key).and_return("test")
tweet = described_class.status(tweet_id)
expect(tweet.text).to be_present
end
end
it "raises NotFound if the status does not exist" do
VCR.use_cassette("twitter_client_status_not_found") do
expect do
described_class.status(0)
end.to raise_error(TwitterClient::Errors::NotFound)
end
end
end
end