docbrown/spec/tasks/fastly_spec.rb
Alex 7149070bca
[deploy] Create FastlyConfig & refactor params safe list (#7630)
* Fastly refactor

- Create FastlyConfig
- Create FastlyConfig::Base
- Create FastlyConfig::Snippets
- Move safe_params to its own VCL file
- Rescue unauthorized errors in development
- Add FastlyConfig errors

* Move active version to method

* Update naming option --> config

* Refactor InvalidConfigsFormat msg to Error class

* Refactor active version logic

* Fix log_to_datadog call

* Move get_active_version logic back into method

* Add some specs ¯\_(ツ)_/¯

* Update Fastly rake task

* Remove old Fastly way

* Update docs for Fastly

* Move snippets to config/ & remove old config

* Change update_config to upsert_config

* Change error type to SubclassResponsibility

* Refactor get_updated_files with filter_map

* Refactor update

* Cleanup update_config --> upsert_config

* Fix updater specs
2020-05-01 11:23:48 -04:00

21 lines
566 B
Ruby

require "rails_helper"
RSpec.describe "Fastly tasks", type: :task do
before do
Rake::Task.clear
PracticalDeveloper::Application.load_tasks
end
describe "#update_configs" do
it "doesn't run if Fastly isn't configured" do
%w[FASTLY_API_KEY FASTLY_SERVICE_ID].each do |var|
allow(ApplicationConfig).to receive(:[]).with(var).and_return(nil)
end
allow(FastlyConfig::Update).to receive(:call)
Rake::Task["fastly:update_configs"].invoke
expect(FastlyConfig::Update).not_to have_received(:call)
end
end
end