Sha256: 31a54af1b256e20c8a27dec36715fe2a4fc82b52a790c175f40d0b0cd074258f

Contents?: true

Size: 1.99 KB

Versions: 5

Compression:

Stored size: 1.99 KB

Contents

require 'spec_helper'

describe Torasup do
  describe ".configure" do
    describe "#registered_operators=" do
      before do
        Torasup.stub(:load_pstn_data!)
      end

      it "should set the registered operators and clear" do
        Torasup.configure do |config|
          Torasup.should_receive(:load_pstn_data!)
          config.registered_operators.should == {}
          config.registered_operators = {"foo" => "bar"}
          config.registered_operators.should == {"foo" => "bar"}
        end
      end
    end

    describe "#register_operators(country_id, *operators)" do
      before do
        Torasup.stub(:load_pstn_data!)
      end

      it "should set the registered operators" do
        Torasup.configure do |config|
          Torasup.should_receive(:load_pstn_data!)
          config.registered_operators = {}
          config.register_operators("kh", "smart", "beeline")
          config.registered_operators.should == {"kh" => ["smart", "beeline"]}
        end
      end
    end

    describe "#default_countries=('['US', 'AU']')" do
      before do
        Torasup.stub(:load_international_dialing_codes!)
      end

      it "should set the default countries and reload the data" do
        Torasup.configure do |config|
          Torasup.should_receive(:load_international_dialing_codes!)
          config.default_countries.should == ["US", "GB", "AU", "IT", "RU", "NO"]
          config.default_countries = ["US", "GB"]
          config.default_countries.should == ["US", "GB"]
        end
      end
    end

    describe "#custom_pstn_data_file=('path_to_yaml_file.yaml')" do
      before do
        Torasup.stub(:load_pstn_data!)
      end

      it "should set a custom pstn data file and reload the data" do
        Torasup.configure do |config|
          Torasup.should_receive(:load_pstn_data!)
          config.custom_pstn_data_file.should be_nil
          config.custom_pstn_data_file = "foo.yaml"
          config.custom_pstn_data_file.should == "foo.yaml"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
torasup-0.0.5 spec/torasup/configuration_spec.rb
torasup-0.0.4 spec/torasup/configuration_spec.rb
torasup-0.0.3 spec/torasup/configuration_spec.rb
torasup-0.0.2 spec/torasup/configuration_spec.rb
torasup-0.0.1 spec/torasup/configuration_spec.rb