Sha256: dc80e6a80b31abce5df32306e70dacd7efe9d982d32bfed4a93e791c217aebae
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require 'spec_helper' module Torasup describe Operator do include PstnHelpers describe ".registered_prefixes" do context "given no operators have been registered" do before do clear_registered_operators end it "should return an empty array" do Operator.registered_prefixes.should == [] end end context "given one operator has been registered" do let(:operator) { sample_operator } before do configure_registered_operators(operator[0], operator[1]) configure_with_custom_data(false) end it "should the prefixes for that operator" do Operator.registered_prefixes.should =~ prefixes(operator[0], operator[1]) end end end shared_examples_for "an operator" do it "should return all the operator metadata" do with_operators(options) do |number_parts, assertions| subject = Operator.new(*number_parts) assertions.each do |method, assertion| args = [] args << {:interpolation => "interpolation"} unless subject.respond_to?(method) result = subject.send(method, *args) result_error = result.nil? ? "nil" : "'#{result}'" result.should(eq(interpolated_assertion(assertion, :interpolation => "interpolation")), "expected Operator.new('#{number_parts}').#{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 "an operator" do let(:options) { {} } end end context "using overridden data" do before do configure_with_custom_data end it_should_behave_like "an operator" do let(:options) { { :with_custom_pstn_data => true } } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
torasup-0.0.3 | spec/torasup/operator_spec.rb |