docbrown/spec/services/twitter_client/client_spec.rb
Michael Kohl 5406b0576e
Split Settings::Authentication from SiteConfig (#13095)
* Split Settings::Authentication from SiteConfig

* Move specs

* Sort fields

* Update settings usages

* Update recaptcha usages

* Add data update script

* Update spec

* Rename SiteConfigParams concern

* Fixes, new route, new controller

* Controller and service refactoring

* More controller and service updates

* Spec updates

* More spec fixes

* Move file

* Fix FeedbackMessagesController

* Update admin/configs_spec

* Fix remaining specs in admin/configs_spec

* Fix configs API

* Formatting

* Clean up old service object

* Various fixes

* Update DUS

* Add model argument to admin_config_label

* Fix key name

* Fix specs

* Add distinct request caches for settings classes

* Fix e2e tests

* Fix remaining system spec

* Make DUS idempotent

* Move routes block

* Cleanup

* Switch to ActiveSupport::CurrentAttributes

* Pinned rails-settings-cached

* Update e2e test

* Update lib/data_update_scripts/20210316091354_move_authentication_settings.rb

Co-authored-by: rhymes <rhymes@hey.com>

* Add guard to DUS

* Temporarily re-add two SiteConfig fields

* Fix config show view

Co-authored-by: rhymes <rhymes@hey.com>
2021-04-12 09:41:09 +02:00

30 lines
902 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 SiteConfig 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