summaryrefslogtreecommitdiff
path: root/spec/lib/bulk_imports/groups/loaders/labels_loader_spec.rb
blob: ac2f9c8cb1dbc0ebba36512cd51fed11cec39d01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BulkImports::Groups::Loaders::LabelsLoader do
  describe '#load' do
    let(:user) { create(:user) }
    let(:group) { create(:group) }
    let(:entity) { create(:bulk_import_entity, group: group) }
    let(:context) { BulkImports::Pipeline::Context.new(entity) }

    let(:data) do
      {
        'title' => 'label',
        'description' => 'description',
        'color' => '#FFFFFF'
      }
    end

    it 'creates the label' do
      expect { subject.load(context, data) }.to change(Label, :count).by(1)

      label = group.labels.first

      expect(label.title).to eq(data['title'])
      expect(label.description).to eq(data['description'])
      expect(label.color).to eq(data['color'])
    end
  end
end