Sha256: 60b1bb92d2eb3ce5bcc93d523ea379ab226738f295ba9538b8baa793b0aecb16

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'
require 'kintone/command/space'
require 'kintone/api'

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

  describe '#get' do
    subject { target.get(id) }

    context '' do
      before(:each) do
        stub_request(
          :get,
          'https://example.cybozu.com/k/v1/space.json'
        )
          .with(query: { id: 1 })
          .to_return(body: result.to_json, status: 200)
      end

      let(:id) { 1 }

      def result
        {
          'id' => '1',
          'name' => 'sample space'
        }
      end

      it { expect(subject).to eq(result) }
    end
  end

  describe '#delete' do
    subject { target.delete(id) }

    context '' do
      before(:each) do
        stub_request(
          :delete,
          'https://example.cybozu.com/k/v1/space.json'
        )
          .with(body: { id: 1 }.to_json)
          .to_return(body: '{}', status: 200)
      end

      let(:id) { 1 }

      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_spec.rb
kintone-0.1.1 spec/kintone/command/space_spec.rb
kintone-0.1.0 spec/kintone/command/space_spec.rb