Class: GraphicalTestsForRails::UserIntention::Applier

Inherits:
Object
  • Object
show all
Defined in:
lib/graphical_tests_for_rails/user-intention.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, log) ⇒ Applier

Returns a new instance of Applier.



182
183
184
185
# File 'lib/graphical_tests_for_rails/user-intention.rb', line 182

def initialize(target, log)
  @target = target
  @log = log
end

Instance Method Details

#apply_claim_quote_args(string) ⇒ Object



204
205
206
# File 'lib/graphical_tests_for_rails/user-intention.rb', line 204

def apply_claim_quote_args(string)
  do_it(*message_and_quote_args(string))
end

#apply_do_nothing(string) ⇒ Object



212
213
214
# File 'lib/graphical_tests_for_rails/user-intention.rb', line 212

def apply_do_nothing(string)
  @log << "# '#{string}' ignored."
end

#apply_page_name(string) ⇒ Object



208
209
210
# File 'lib/graphical_tests_for_rails/user-intention.rb', line 208

def apply_page_name(string)
  do_it('assert_on_page', string.downcase.strip)
end

#apply_user_action_quote_args(string) ⇒ Object



193
194
195
196
197
198
199
200
201
# File 'lib/graphical_tests_for_rails/user-intention.rb', line 193

def apply_user_action_quote_args(string)
  user_claims(string =~ /^\s*(\w+)\s+(.*)$/) {
    "'#{string}' cannot be split into a name and an action."
  }
  name = $1.downcase
  rest = message_and_quote_args($2)
  message = rest.shift
  do_it(message, name, *rest)
end

#do_it(*message_send) ⇒ Object



187
188
189
190
# File 'lib/graphical_tests_for_rails/user-intention.rb', line 187

def do_it(*message_send)
  @log << readable(*message_send)
  @target.send(*message_send)
end