Module: Chop::DSL

Extended by:
DSL
Included in:
Chop, DSL
Defined in:
lib/chop/dsl.rb

Instance Method Summary collapse

Instance Method Details

#create!(klass, table, &block) ⇒ Object



7
8
9
# File 'lib/chop/dsl.rb', line 7

def create! klass, table, &block
  Create.create! klass, table, &block
end

#diff!(selector, table, session: Capybara.current_session, as: nil, timeout: nil, **kwargs, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/chop/dsl.rb', line 11

def diff! selector, table, session: Capybara.current_session, as: nil, timeout: nil, **kwargs, &block
  class_name = if as
    as.to_s
  elsif selector.respond_to?(:tag_name)
    selector.tag_name
  else
    session.find(selector).tag_name
  end.camelize
  klass = const_get("Chop::#{class_name}")
  kwargs[:session] = session
  kwargs[:timeout] = timeout if timeout.present?
  klass.diff! selector, table, **kwargs, &block
end

#fill_in!(table) ⇒ Object



25
26
27
# File 'lib/chop/dsl.rb', line 25

def fill_in! table
  Form.fill_in! table
end