summaryrefslogtreecommitdiff
path: root/spec/lib/bulk_imports/pipeline/context_spec.rb
blob: e9af6313ca499c2fb0f5d34569d019cb78ddca06 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BulkImports::Pipeline::Context do
  describe '#initialize' do
    it 'initializes with permitted attributes' do
      args = {
        current_user: create(:user),
        entity: create(:bulk_import_entity),
        configuration: create(:bulk_import_configuration)
      }

      context = described_class.new(args)

      args.each do |k, v|
        expect(context.public_send(k)).to eq(v)
      end
    end

    context 'when invalid argument is passed' do
      it 'raises NoMethodError' do
        expect { described_class.new(test: 'test').test }.to raise_exception(NoMethodError)
      end
    end
  end
end