Class: Balboa::Interactor::CapybaraInteractor

Inherits:
Object
  • Object
show all
Defined in:
lib/balboa/interactor/capybara_interactor.rb

Constant Summary collapse

CommandNotFound =
Class.new(RuntimeError)
LoginCommandNotFound =
Class.new(RuntimeError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CapybaraInteractor

Returns a new instance of CapybaraInteractor.



12
13
14
15
16
# File 'lib/balboa/interactor/capybara_interactor.rb', line 12

def initialize(options = {})
  @options = options
  @commands = Hash.new { raise CommandNotFound }
  @signed_in = false
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/balboa/interactor/capybara_interactor.rb', line 10

def options
  @options
end

Instance Method Details

#add_command(key, command) ⇒ Object



18
19
20
# File 'lib/balboa/interactor/capybara_interactor.rb', line 18

def add_command(key, command)
  @commands[key.to_s] = command
end

#lastObject



22
23
24
25
# File 'lib/balboa/interactor/capybara_interactor.rb', line 22

def last
   unless signed_in?
  @commands['last'].execute
end

#punch(date) ⇒ Object



27
28
29
30
# File 'lib/balboa/interactor/capybara_interactor.rb', line 27

def punch(date)
   unless signed_in?
  @commands['punch'].execute(date)
end