Sha256: fac0f2f99c4f2e61122e40116181abbfb895d6266831080d4274b52835fa8b6e

Contents?: true

Size: 1.63 KB

Versions: 2

Compression:

Stored size: 1.63 KB

Contents

RSpec.describe Bluekai::Category, :vcr do
  include_context 'signature_mock'

  it 'reads a category and its reach' do
    read_response = subject.category_read(category_id: 421262, stats: 'True')
    expect(read_response).to include(
      name: 'Action',
      id: 421262,
      description: 'People who converted for Action games',
      leaf: true,
      parent_id: 421229
    )
    expect(read_response[:rules].size).to be > 0
  end

  it 'lists 4 categories' do
    list_response = subject.category_list(offset: 0, size: 4)
    expect(list_response.count).to eq(4)
    expect(list_response).to all(have_key(:name))
    expect(list_response).to all(have_key(:rules))
  end

  it 'creates a category' do
    category_body = {
      name: 'Test Category 123',
      parent_id: '424547',
      description: 'an example category',
      analytics_excluded: 'false',
      navigation_only: 'false',
      mutex_children: 'false',
      notes: 'Just an API test'
    }
    create_response = subject.category_create(category_body)
    expect(create_response).to include(
      name: 'Test Category 123',
      parent_id: 424547,
      description: 'an example category',
      analytics_excluded: false,
      navigation_only: false,
      mutex_children: false,
      notes: 'Just an API test'
    )
  end

  it 'updates a category' do
    category_update_body = {
      name: 'Test Category 321',
      description: 'an example category wohooo'
    }
    update_response = subject.category_update(424547, category_update_body)
    expect(update_response).to include(
      name: 'Test Category 321',
      description: 'an example category wohooo'
    )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bluekai-0.0.3 spec/lib/bluekai/category_integration_spec.rb
bluekai-0.0.2 spec/lib/bluekai/category_integration_spec.rb