Sha256: 125bbcafa495392e33dc681d51281219dcff19d70c73f80c7210ae69828c54a3

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module Torasup
  describe Location do
    include PstnHelpers

    shared_examples_for "a location" do
      it "should return all the location attributes" do
        with_locations(options) do |country_id, area_code, assertions|
          subject = Location.new(country_id, area_code)
          assertions.each do |method, assertion|
            result = subject.send(method)
            result_error = result.nil? ? "nil" : "'#{result}'"
            result.should(eq(assertion), "expected Location.new('#{country_id}', '#{area_code}').#{method} to return '#{assertion}' but got #{result_error}")
          end
        end
      end
    end

    context "using the standard data" do
      before do
        configure_with_custom_data(false)
      end

      it_should_behave_like "a location" do
        let(:options) { {} }
      end
    end

    context "using overridden data" do
      before do
        configure_with_custom_data
      end

      it_should_behave_like "a location" do
        let(:options) { { :with_custom_pstn_data => true } }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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