Sha256: 6115b84d613ab1902bd3073506b9c7bca04e640e123350e53859765cfad778df

Contents?: true

Size: 1013 Bytes

Versions: 2

Compression:

Stored size: 1013 Bytes

Contents

require 'spec_helper'

describe Voog::API::Forms do

  let(:client) { voog_client }

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

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

  describe '#form' do
    before do
      request_fixture(:get, 'forms/2', fixture: 'forms/form')
    end

    it 'returns a single form' do
      expect(client.form(2).title).to eq('Contact')
    end

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

  describe '#update_form' do

    before do
      request_fixture(:put, 'forms/2', request: {body: {title: 'Updated title', submit_label: 'Send!'}}, response: {body: '{"id": 2, "title": "Updated title", "submit_label": "Send!"}'})
    end

    it 'responds with new title' do
      expect(client.update_form(2, title: 'Updated title', submit_label: 'Send!').title).to eq('Updated title')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
voog_api-0.0.10 spec/voog_api/api/forms_spec.rb
voog_api-0.0.7 spec/voog_api/api/forms_spec.rb