anthonator/ar-book-finder

View on GitHub
lib/ar_book_finder/user_type_processor.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ARBookFinder
  class UserTypeProcessor
    include Capybara::DSL
    
    USER_TYPE_URL = "#{ARBookFinder::BASE_URL}/usertype.aspx"

    USER_TYPES = {
      student: 'Student',
      parent: 'Parent',
      teacher: 'Teacher',
      librarian: 'Librarian'
    }

    def initialize(user_type)
      @user_type = USER_TYPES[user_type]
    end

    def process
      visit(USER_TYPE_URL)
      choose(@user_type)
      click_button('Submit')
    end
  end
end