Sha256: 20974e6563e4496138aeedb546f5d9efaf406f454cbac1e6e6c48cdde79974a7

Contents?: true

Size: 740 Bytes

Versions: 5

Compression:

Stored size: 740 Bytes

Contents

require 'pr'

module DSL

  def run_test code
    world.run code
  end

  def setup_test code
    world.load code
  end

  alias define_field setup_test
  alias define_form  setup_test
  alias define_model run_test

  def define_hash code
    world.instance_variable_set '@hash', world.run(code)
  end

  def fetch klass
    world.class.const_get klass
  end

  def access var
    world.instance_variable_get var
  end

  def world
    @world ||= world_klass.new
  end

  def world_klass
    Class.new do
      def load code
        self.class.class_eval code
      end

      def run code
        self.instance_eval code
      end
    end
  end

  def set thing, attribute, value
    thing.send "#{attribute}=", value
  end

end
World DSL

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pr-1.0.0 features/support/dsl.rb
pr-0.0.7 features/support/dsl.rb
pr-0.0.6 features/support/dsl.rb
pr-0.0.5 features/support/dsl.rb
pr-0.0.4 features/support/dsl.rb