Module: Chop::DSL

Included in:
Chop
Defined in:
lib/chop/dsl.rb

Instance Method Summary collapse

Instance Method Details

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



5
6
7
# File 'lib/chop/dsl.rb', line 5

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

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



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/chop/dsl.rb', line 9

def diff! selector, table, session: Capybara.current_session, as: nil, &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}")
  klass.diff! selector, table, session: session, &block
end

#fill_in!(table) ⇒ Object



21
22
23
# File 'lib/chop/dsl.rb', line 21

def fill_in! table
  Form.fill_in! table
end