Sha256: 6257b592d2dfd14aeba93e43b7dface0a581340868c2558f66667ebd8e0690be

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe 'help_center/categories' do
  let(:client) { create_client }

  include_examples 'zendesk#resource',
                   collection: -> { client.help_center_categories(locale: 'en-us') },
                   create_params: -> { { name: mock_uuid, locale: 'en-us' } },
                   update_params: -> { { name: mock_uuid } },
                   search: false

  context 'with a category, sections, and articles' do
    let!(:category) { client.help_center_categories.create!(name: mock_uuid, locale: 'en-us') }
    let!(:section)  { category.sections.create!(name: mock_uuid, locale: 'en-us') }
    let!(:articles) do
      Array.new(2) { section.articles.create(title: mock_uuid, locale: 'en-us', permission_group_id: 0) }
    end

    before do
      client.help_center_categories.create!(name: mock_uuid, locale: 'en-us')
            .sections.create!(name: mock_uuid, locale: 'en-us')
            .articles.create!(title: mock_uuid, locale: 'en-us', permission_group_id: 0)
    end

    it 'lists sections within a category' do
      expect(category.sections.all).to contain_exactly(section)
    end

    it 'lists articles within a category' do
      expect(category.articles.all).to match_array(articles)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zendesk2-1.15.0 spec/help_center/categories_spec.rb
zendesk2-1.13.1 spec/help_center/categories_spec.rb
zendesk2-1.13.0 spec/help_center/categories_spec.rb