Sha256: 5d86fba9f395f0802f1e3876b78d175d483855bcd6e06e303be55b3a48f68a40

Contents?: true

Size: 891 Bytes

Versions: 6

Compression:

Stored size: 891 Bytes

Contents

module Chop
  module DSL
    def create! klass, table, &block
      Create.create! klass, table, &block
    end

    def diff! selector, table, session: Capybara.current_session, &block
      class_name = session.find(selector).tag_name.capitalize
      klass = const_get("Chop::#{class_name}")
      klass.diff! selector, table, session: session, &block
    end

    def fill_in! table
      Form.fill_in! table
    end
  end
end

if defined?(Cucumber::MultilineArgument::DataTable)
  Cucumber::MultilineArgument::DataTable.prepend Module.new {
    def create! klass, &block
      Chop.create! klass, self, &block
    end

    def diff! other_table="table", options={}, &block
      if other_table.is_a?(String) && !other_table.include?("|")
        Chop.diff! other_table, self, &block
      else
        super
      end
    end

    def fill_in!
      Chop.fill_in! self
    end
  }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chop-0.20.1 lib/chop/dsl.rb
chop-0.20.0 lib/chop/dsl.rb
chop-0.19.0 lib/chop/dsl.rb
chop-0.18.0 lib/chop/dsl.rb
chop-0.17.0 lib/chop/dsl.rb
chop-0.16.0 lib/chop/dsl.rb