Sha256: de1c4f3e2d82c53f1db4a6501a7acfc4c5deb8cc4d4a37a1d6e27c50f68e58e0

Contents?: true

Size: 894 Bytes

Versions: 3

Compression:

Stored size: 894 Bytes

Contents

RSpec.describe Yaks::Mapper::Form do
  let(:form)   { described_class.create( full_args ) }
  let(:name)      { :the_name }
  let(:full_args) { {name: name}.merge(args) }
  let(:args) {
    {
      action: '/foo',
      title: 'a title',
      method: 'PATCH',
      media_type: 'application/hal+json',
      fields: fields
    }
  }
  let(:fields) { [] }

  describe '.create' do
    it 'should have a name of nil when ommitted' do
      expect(described_class.create.name).to be_nil
    end
  end

  describe '#add_to_resource' do
    let(:resource) { form.new.add_to_resource(Yaks::Resource.new, Yaks::Mapper.new(nil), nil) }


    context 'with fields' do
      let(:fields) {
        [
          Yaks::Mapper::Form::Field.new(
            name: 'field name',
            label: 'field label',
            type: 'text',
            value: 7
          )
        ]
      }

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yaks-0.8.0.beta2 spec/unit/yaks/mapper/form_spec.rb
yaks-0.8.0.beta1 spec/unit/yaks/mapper/form_spec.rb
yaks-0.8.0.alpha spec/unit/yaks/mapper/form_spec.rb