Sha256: 118998e2bd753a149810a7b691e76b9ff50e4b7a9785fd582aaff84cf83dbe8f

Contents?: true

Size: 967 Bytes

Versions: 12

Compression:

Stored size: 967 Bytes

Contents

require "active_support/inflector"

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

    def diff! selector, table, session: Capybara.current_session, as: nil, &block
      class_name = as ? as.to_s.camelize : session.find(selector).tag_name.camelize
      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, options, &block
      else
        super
      end
    end

    def fill_in!
      Chop.fill_in! self
    end
  }
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
chop-0.24.0 lib/chop/dsl.rb
chop-0.23.8 lib/chop/dsl.rb
chop-0.23.7 lib/chop/dsl.rb
chop-0.23.6 lib/chop/dsl.rb
chop-0.23.5 lib/chop/dsl.rb
chop-0.23.4 lib/chop/dsl.rb
chop-0.23.3 lib/chop/dsl.rb
chop-0.23.2 lib/chop/dsl.rb
chop-0.23.1 lib/chop/dsl.rb
chop-0.23.0 lib/chop/dsl.rb
chop-0.22.1 lib/chop/dsl.rb
chop-0.22.0 lib/chop/dsl.rb