Sha256: cf439f93c1b838f9e6d8b21657d5b842a62a94df540f95269e80ad9c4b07fed3

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'

describe RenuoCmsRails::API do
  describe '#fetch_contents' do
    it 'loads the contents' do
      RenuoCmsRails.reset
      RenuoCmsRails.config.api_host = 'example.com'
      RenuoCmsRails.config.api_key = 'apikey'
      RenuoCmsRails.config.private_api_key = 'pk'

      Timecop.freeze(Time.at(123).utc) do
        stub_request(:get, 'https://example.com/v1/apikey/content_blocks?_=120').with(
          headers: { 'Host' => 'example.com' }
        ).to_return(body: { content_blocks: [{ content: 'somecontent', content_path: 'somepath' }] }.to_json)
        contents = RenuoCmsRails::API.fetch_contents
        expect(contents['somepath']).to eq('somecontent')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
renuo-cms-rails-0.2.1 spec/renuo_cms_rails/api_spec.rb
renuo-cms-rails-0.2.0 spec/renuo_cms_rails/api_spec.rb