Sha256: b2b2047447b03f3930f0b9927ef9495b75b943813e4f1c9f8a478e5383a74fd8

Contents?: true

Size: 553 Bytes

Versions: 7

Compression:

Stored size: 553 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Macros::Model::Copy do
  let(:user) { mock_model('User') }

  let(:ctx) { { current_user: user } }
  let(:ctx_key) { :current_user }

  subject(:copy_step) { described_class.new(ctx_key) }

  it 'expects to copy current user to ctx model' do
    copy_step.call(ctx)

    expect(ctx[:model]).to eq user
  end

  context 'source does not exist' do
    let(:ctx_key) { :administrator }

    it 'expects ctx model to keep nil' do
      copy_step.call(ctx)

      expect(ctx[:model]).to be nil
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ff-tbl-macros-2.0.2 spec/lib/model/copy_spec.rb
ff-tbl-macros-2.0.1 spec/lib/model/copy_spec.rb
ff-tbl-macros-2.0.0 spec/lib/model/copy_spec.rb
ff-tbl-macros-1.0.2 spec/lib/model/copy_spec.rb
ff-tbl-macros-1.0.1 spec/lib/model/copy_spec.rb
ff-tbl-macros-1.0.0 spec/lib/model/copy_spec.rb
ff-tbl-macros-0.1.8 spec/lib/model/copy_spec.rb