Sha256: 2ee9e8a44540b8e3ab47451c6b2f209c72e5e510479e56368df6df810f4c91a2
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
require File.expand_path('../../spec_helper', __FILE__) describe Genability::Client do Genability::Configuration::VALID_FORMATS.each do |format| context ".new(:format => '#{format}')" do before(:all) do @options = {:format => format}.merge(configuration_defaults) @client = Genability::Client.new(@options) end context ".tariffs" do use_vcr_cassette "tariffs" it "should return an array of tariffs" do tariffs = @client.tariffs tariffs.should be_an Array tariffs.first.tariff_id.should == 447 end # this example also demonstrates searching within results it "should allow searches by lse_id" do tariffs = @client.tariffs(:lse_id => 734) tariffs.select{|x| x['tariffCode'] == "E-7"}.first.tariff_code.should == "E-7" end it "should accept a string for customerClasses and tariffTypes parameters" do @client.tariffs(:customer_classes => 'residential').each do |tariff| tariff.customer_class.should =~ /RESIDENTIAL/ end end it "should accept an array for customerClasses and tariffTypes parameters" do @client.tariffs(:tariff_types => ['default', 'alternative']).each do |tariff| tariff.tariff_type.should =~ /(DEFAULT)|(ALTERNATIVE)/ end end end context ".tariff" do use_vcr_cassette "tariff" it "should return a tariff" do tariff = @client.tariff(512) tariff.should be_a Hashie::Mash tariff.master_tariff_id.should == 512 end it "should return a tariff with rates and properties" do tariff = @client.tariff(512, { :populate_rates => 'ture', :populate_properties => 'true' }) tariff.should be_a Hashie::Mash tariff.properties.count.should > 0 tariff.rates.count.should > 0 tariff.master_tariff_id.should == 512 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
genability-0.3.0 | spec/client/tariff_spec.rb |