Sha256: 5c03bca949d3d010e39ae07de8ce661f75fcde056cd4e3532b5376b25138d16b

Contents?: true

Size: 529 Bytes

Versions: 7

Compression:

Stored size: 529 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Macros::CurrentUser::Set do
  subject(:set_step) { described_class.new }

  let(:user) { mock_model('User') }
  let(:ctx) { { model: user } }

  it 'should set current user in ctx' do
    set_step.call(ctx)

    expect(ctx[:current_user]).to eql user
  end

  context 'model key does not exists in the context' do
    let(:ctx) { { admin: user } }

    it 'should not set current user in ctx' do
      set_step.call(ctx)

      expect(ctx[:current_user]).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/current_user/set_spec.rb
ff-tbl-macros-2.0.1 spec/lib/current_user/set_spec.rb
ff-tbl-macros-2.0.0 spec/lib/current_user/set_spec.rb
ff-tbl-macros-1.0.2 spec/lib/current_user/set_spec.rb
ff-tbl-macros-1.0.1 spec/lib/current_user/set_spec.rb
ff-tbl-macros-1.0.0 spec/lib/current_user/set_spec.rb
ff-tbl-macros-0.1.8 spec/lib/current_user/set_spec.rb