Sha256: a201b57bbf765b6fbf09b4b1b37c98753990cb466c443f3099a9846fa13f789f

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

Given(/I have an (\w+) actor defined as/) do |model_name, author_definition|
  @actor_model = find_model(model_name)

  eval_dsl author_definition, @actor_model
end

Given(/I have an actor named (\w+)/) do |actor_name|
  actor = @actor_model.new
  actor.name = actor_name

  @actors ||= {}
  @actors[actor_name] = actor
end

When(/I grant (\w+) access as a (\w+) in quality of (\w+)/) do |actor_name, role_name, designator|
  actor = @actors.fetch(actor_name)
  @resource.grant role_name, designator, actor
  @resource.save!
end

Then(/(\w+) should be able to (\w+) it/) do |actor_name, permission_name|
  actor = @actors.fetch(actor_name)
  actor.can? permission_name, @resource
end

Then(/(\w+) should not be able to (\w+) it/) do |actor_name, permission_name|
  actor = @actors.fetch(actor_name)
  actor.cannot? permission_name, @resource
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eaco-0.6.0 features/step_definitions/actor_definition.rb