Sha256: e74337c4dc704c1d5de3b6a209495d07f5114983a77aed4a42ac2d40f76b2e9a

Contents?: true

Size: 1016 Bytes

Versions: 8

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

describe Voog::API::Texts do

  let(:client) { voog_client }

  describe '#texts' do
    before do
      request_fixture(:get, 'texts', fixture: 'texts/texts')
    end

    it 'returns a list of texts' do
      expect(client.texts.length).to eql(2)
    end
  end

  describe '#text' do
    before do
      request_fixture(:get, 'texts/2', fixture: 'texts/text')
    end

    it 'returns a single text' do
      expect(client.text(2).body).to eq('<h3>A better way to create a website</h3>')
    end

    it 'returns a text with the same id as in the request' do
      expect(client.text(2).id).to eq(2)
    end
  end

  describe '#update_text' do

    before do
      request_fixture(:put, 'texts/2', request: {body: {autosaved_body: 'Updated body'}}, response: {body: '{"id": 2, "autosaved_body": "Updated body"}'})
    end

    it 'responds with new autosaved_body' do
      expect(client.update_text(2, autosaved_body: 'Updated body').autosaved_body).to eq('Updated body')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
voog_api-0.0.16 spec/voog_api/api/texts_spec.rb
voog_api-0.0.15 spec/voog_api/api/texts_spec.rb
voog_api-0.0.14 spec/voog_api/api/texts_spec.rb
voog_api-0.0.13 spec/voog_api/api/texts_spec.rb
voog_api-0.0.12 spec/voog_api/api/texts_spec.rb
voog_api-0.0.11 spec/voog_api/api/texts_spec.rb
voog_api-0.0.10 spec/voog_api/api/texts_spec.rb
voog_api-0.0.7 spec/voog_api/api/texts_spec.rb