Sha256: 9051acb0c4d60083b285140a48771f2bfc0f9ec0331cbfd4ae21543224b169a2

Contents?: true

Size: 900 Bytes

Versions: 10

Compression:

Stored size: 900 Bytes

Contents

require 'spec_helper'
require 'kintone/type/record'

describe Kintone::Type::Record do
  let(:target) { Kintone::Type::Record.new }

  describe '#to_kitnone' do
    subject { target.to_kintone }

    context 'データが登録されているとき' do
      before(:each) do
        target[:a] = 1
        target[:b] = 2
      end

      it { expect(subject).to match a: { value: 1 }, b: { value: 2 } }
    end

    context 'データが登録されてないとき' do
      it { expect(subject).to be_empty }
    end

    context 'initializeで初期値を指定したとき' do
      let(:target) { Kintone::Type::Record.new(default) }

      where(:default, :result) do
        [
          [{ a: 1, b: 2 }, { a: { value: 1 }, b: { value: 2 } }],
          [[[:a, 1], [:b, 2]], {}]
        ]
      end

      with_them do
        it { expect(subject).to match result }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
kintone_rb-1.0.1 spec/kintone/type/record_spec.rb
kintone_rb-1.0.0 spec/kintone/type/record_spec.rb
kintone-oauth-extension-0.2.2 spec/kintone/type/record_spec.rb
kintone-oauth-extension-0.2.1 spec/kintone/type/record_spec.rb
kintone-0.1.5 spec/kintone/type/record_spec.rb
kintone-0.1.4 spec/kintone/type/record_spec.rb
kintone-0.1.3 spec/kintone/type/record_spec.rb
kintone-0.1.2 spec/kintone/type/record_spec.rb
kintone-0.1.1 spec/kintone/type/record_spec.rb
kintone-0.1.0 spec/kintone/type/record_spec.rb