Sha256: eaceead2b0f24abba7737683fa8ed094a1b7974fc196911d265150e033614084
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' require 'haravan_theme' require 'haravan_theme/api_checker' module HaravanTheme describe "APIChecker" do attr_reader :checker before do config = { api_key: 'abracadabra', password: 'alakazam', store: 'something.myharavan.com' } HaravanTheme.config = config @checker = APIChecker.new(HaravanTheme) end after do HaravanTheme.config = nil end it "should return an APIResponse that says if the API is accessible when it gets a 200 response" do VCR.use_cassette("api_check_success") do response = checker.test_connectivity assert response.accessed_api? end end it "should return an APIResponse that says the API is down if it gets a 500-series response" do VCR.use_cassette("api_check_api_down") do response = checker.test_connectivity assert response.api_down? end end it "should return an APIResponse that says the client is misconfigured if it gets a 401 response" do VCR.use_cassette("api_check_unauthorized") do response = checker.test_connectivity assert response.invalid_config? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
haravan_theme-0.0.26 | spec/unit/api_checker_spec.rb |
haravan_theme-0.0.25 | spec/unit/api_checker_spec.rb |