Sha256: 468115536a411eaf1e9fe4fd947ef3af1c2599546d8d8f4f3591263b530b4d74

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

Given /^the Lomic inherited class (\w*)/ do |klass|
  eval "class #{klass} < Lomic\nend"
  @class = Kernel.const_get(klass)
end

When /^I create a new (\w*) object named (\w*)/ do |klass,obj_name|
  eval "$#{obj_name} = #{klass}.new"
end

Then /^the result of (\w+)\.(\w+) should be (\w+)/ do |obj_name,var_name,result|
  result == (eval "$#{obj_name}.#{var_name}")
end

Then /^the results of each <var> should be <val>/ do |table|
  @alltrue = true
  table.hashes.each do |h|
    @alltrue = @alltrue and h[:val] == (eval "$#{h[:var]}")
  end
  @alltrue
end

### general variables

When /^I (add|subtract) (\d+) (?:to|from) (.*)/ do |type,amt,var|
  op = (type=='add') ? '+' : '-'
  eval "$#{var} #{op}= #{amt}"
end

### var declaration

Given /^the following var declarations:/ do |vars|
  vars.hashes.each { |h| @class.class_eval h[:var_decl] }
end

### resources

Given /^the resource declaration (\w+) with value (\[.*\]|\d+)/ do |name,val|
  @class.class_eval "resource :#{name} => #{val}"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lomic-0.1.0 features/step_definitions/steps.rb
lomic-0.0.2 features/step_definitions/steps.rb
lomic-0.0.1 features/step_definitions/steps.rb