require 'test_helper'

class TestSave < Mechanize::TestCase
  attr_accessor :hsh

  context 'Gimme when on contact page with info' do
    setup do
      Gimme.get('http://localhost/contact_page_with_info.html')
      @hsh = Gimme.scan_for_contacts
    end

    should 'properly initialize empty contact links hash' do
      assert_equal Hash, Gimme.start_contact_links.class
      assert_equal true, Gimme.start_contact_links.empty?
    end

    should 'recognize if there is something to save or not' do
      assert_equal true, Gimme.something_to_save?(@hsh)
      assert_equal true, Gimme.something_to_save?(Gimme.scan_for_contacts)
    end
  end

  context 'Gimme when on contact page without info' do
    setup do
      Gimme.get('http://localhost/contact_page_without_info.html')
      @hsh = Gimme.scan_for_contacts
    end

    should 'properly initialize empty contact info hash' do
      assert_equal Hash, Gimme.start_contact_links.class
      assert_equal true, Gimme.start_contact_links.empty?
    end

    should 'recognize if there is something to save or not' do
      assert_equal false, Gimme.something_to_save?(@hsh)
      assert_equal false, Gimme.something_to_save?(Gimme.scan_for_contacts)
    end
  end

  # should 'scan for contact links and save results to temporary hash' do
  #   assert_equal Hash, Gimme.scan_for_contacts
  # end

  # should 'raise err if anything but hash is given to save_available_contacts' do
  # end

  # should 'properly save link by adding it to contact links hash' do
  # end

  # should 'return nil and not err out if there is nothing to save' do
  # end

  # should 'properly delete items in hash that are nil or false' do
  # end
end
