Sha256: 18e3c72b62dba412cf3eb01c4e6a1ba39247c6e9b78871558470b2b93ce0269a
Contents?: true
Size: 930 Bytes
Versions: 3
Compression:
Stored size: 930 Bytes
Contents
# frozen_string_literal: true module Balboa module Interactor class CapybaraInteractor CommandNotFound = Class.new(RuntimeError) LoginCommandNotFound = Class.new(RuntimeError) attr_reader :options def initialize(options = {}) @options = options @commands = Hash.new { raise CommandNotFound } @signed_in = false end def add_command(key, command) @commands[key.to_s] = command end def last login unless signed_in? @commands['last'].execute end def punch(date) login unless signed_in? @commands['punch'].execute(date) end private attr_accessor :signed_in def signed_in? signed_in end def login @commands['login'].execute @signed_in = true rescue CommandNotFound raise LoginCommandNotFound end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
balboa-0.1.7 | lib/balboa/interactor/capybara_interactor.rb |
balboa-0.1.6 | lib/balboa/interactor/capybara_interactor.rb |
balboa-0.1.5 | lib/balboa/interactor/capybara_interactor.rb |