Sha256: 7c6511811b5559d997f639dafc7d9412de4ebbc0ed976e7b51be8cc436a88c82

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

require 'test_helper'

describe Merit::SashFinder do

  it 'should return an array of sashes of the target objects' do
    sash_1 = Sash.new
    user_1 = User.new(:_sash => sash_1)
    user_1.stubs(:_sash).returns(sash_1)

    sash_2 = Sash.new
    user_2 = User.new
    user_2.stubs(:_sash).returns(sash_2)

    object_without_sash = OpenStruct.new

    # TODO: With stub we are not exercising compact
    # users = [user_1, user_2, object_without_sash]
    users = [user_1, user_2]

    rule = Merit::Rule.new
    action = Merit::Action.new

    Merit::SashFinder.stubs(:targets).returns(users)
    sashes = Merit::SashFinder.find(rule, action)
    sashes.count.must_be :==, 2
    sashes.must_include sash_1
    sashes.must_include sash_2
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
merit-1.4.0 test/sash_finder_test.rb