Sha256: 8625dbc9d52d8332f8303c07dee190a84d94e2e85c21ff61ab7b5e58f4f51fa3

Contents?: true

Size: 622 Bytes

Versions: 5

Compression:

Stored size: 622 Bytes

Contents

require 'test_helper'

class BareObjectContext
  extend Surrounded::Context

  def initialize(number, string, user)
    map_roles(:number => number, :string => string, :user => user)
  end
  private_attr_reader :number, :string, :user

  role :user do
    def output
      [number.to_s, string, name].join(' - ')
    end
  end

  trigger :output do
    user.output
  end
end

describe Surrounded::Context, 'skips affecting non-surrounded objects' do
  it 'works with non-surrounded objects' do
    context = BareObjectContext.new(123,'hello', User.new('Jim'))
    assert_equal '123 - hello - Jim', context.output
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
surrounded-1.1.0 test/non_surrounded_role_player_test.rb
surrounded-1.0.0 test/non_surrounded_role_player_test.rb
surrounded-0.9.11 test/non_surrounded_role_player_test.rb
surrounded-0.9.10 test/non_surrounded_role_player_test.rb
surrounded-0.9.9 test/non_surrounded_role_player_test.rb