Sha256: e015b5981ea78ca7d5a236a62fcd4ea28b130ab6d622d9c0e58bd500c4770372

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

module PstnHelpers
  include Torasup::Test::Helpers

  private

  def yaml_file(filename)
    File.join(File.dirname(__FILE__), "../../spec/support/#{filename}")
  end

  def clear_pstn
    Torasup.configure do |config|
      config.custom_pstn_data_file = nil
    end
  end

  def clear_registered_operators
    Torasup.configure do |config|
      config.registered_operators = {}
    end
  end

  def configure_registered_operators(country_id, *operators)
    Torasup.configure do |config|
      config.register_operators(country_id, *operators)
    end
  end

  def configure_with_custom_data(options = {})
    custom_data_files = ["custom_pstn.yaml"]
    custom_data_files << "custom_pstn_2.yaml" if options[:multiple_files]

    custom_data_files.each do |custom_data_file|
      Torasup.configure do |config|
        config.custom_pstn_data_file = File.join(File.dirname(__FILE__), "../support", "/#{custom_data_file}")
      end
    end
  end
end

RSpec.configure do |config|
  config.include(PstnHelpers)

  config.before do
    clear_pstn
    clear_registered_operators
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
torasup-0.3.3 spec/support/pstn_helpers.rb
torasup-0.3.2 spec/support/pstn_helpers.rb
torasup-0.3.1 spec/support/pstn_helpers.rb
torasup-0.3.0 spec/support/pstn_helpers.rb
torasup-0.2.3 spec/support/pstn_helpers.rb
torasup-0.2.2 spec/support/pstn_helpers.rb
torasup-0.2.1 spec/support/pstn_helpers.rb
torasup-0.2.0 spec/support/pstn_helpers.rb
torasup-0.1.2 spec/support/pstn_helpers.rb
torasup-0.1.1 spec/support/pstn_helpers.rb
torasup-0.1.0 spec/support/pstn_helpers.rb