Sha256: 222bc1939f12466c4ae3693a15fc3420dada6490ceb0a1ba3b583ddf0745e070

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'
require 'kintone/command/space_thread'
require 'kintone/api'

describe Kintone::Command::SpaceThread do
  let(:target) { Kintone::Command::SpaceThread.new(api) }
  let(:api) { Kintone::Api.new('example.cybozu.com', 'Administrator', 'cybozu') }

  describe '#update' do
    before(:each) do
      stub_request(
        :put,
        'https://example.cybozu.com/k/v1/space/thread.json'
      )
        .with(body: request_body)
        .to_return(body: '{}', status: 200)
    end

    subject { target.update(id, name: name, body: body) }

    let(:id) { 1 }

    where(:name, :body, :request_body) do
      [
        [
          'example thread',
          '<b>awesome thread!</b>',
          '{"id":1,"name":"example thread","body":"<b>awesome thread!</b>"}'
        ],
        [
          nil,
          '<b>awesome thread!</b>',
          '{"id":1,"body":"<b>awesome thread!</b>"}'
        ],
        [
          'example thread',
          nil,
          '{"id":1,"name":"example thread"}'
        ],
        [
          nil,
          nil,
          '{"id":1}'
        ]
      ]
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kintone-0.1.2 spec/kintone/command/space_thread_spec.rb
kintone-0.1.1 spec/kintone/command/space_thread_spec.rb
kintone-0.1.0 spec/kintone/command/space_thread_spec.rb