Sha256: 0185f30e32c215813f6c7066a94bacbaf00fb4911e5f5d6e84f290491eb192bb

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

module RainforestRubyRuntime
  class Test
    attr_reader :id, :title, :steps

    def initialize(id: , title: , &block)
      @id = id
      @title = title
      @steps = []
      @block = block
    end

    def step(**args, &block)
      step = Step.new(**args, &block)
      @steps << step
      step.run
      step
    end

    def run
      extend RSpec::Matchers
      extend Capybara::DSL
      instance_eval &@block
    end

    def method_missing(name, *args, &block)
      if Variables.scope_registery.has_variable?(name)
        Variables.scope_registery[name]
      else
        super
      end
    end
  end

  class Step
    attr_reader :id, :action, :response

    def initialize(id: , action: , response: , &block)
      @id = id
      @action = action
      @response = response
      @block = block
    end

    def run
      @block.call
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rainforest_ruby_runtime-0.0.1 lib/rainforest_ruby_runtime/test.rb