Sha256: f4f4f9e6a74f3e4e2e916ae7fa4507f8880324091866f04710a7ea1bdd6529ce
Contents?: true
Size: 1.67 KB
Versions: 4
Compression:
Stored size: 1.67 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe GovKit::CA::PostalCode::StrategySet do let :strategy do Class.new end describe '#strategies' do it 'should return the strategies' do GovKit::CA::PostalCode::StrategySet.strategies[0..4].should == [ GovKit::CA::PostalCode::Strategy::ElectionsCa, GovKit::CA::PostalCode::Strategy::NDPCa, # GovKit::CA::PostalCode::Strategy::LiberalCa, GovKit::CA::PostalCode::Strategy::GreenPartyCa, GovKit::CA::PostalCode::Strategy::CBCCa, GovKit::CA::PostalCode::Strategy::ConservativeCa, ] end end describe '#register' do it 'should append a strategy' do GovKit::CA::PostalCode::StrategySet.register(strategy) GovKit::CA::PostalCode::StrategySet.strategies.last.should == strategy end end describe '#run' do it 'should run the strategies' do GovKit::CA::PostalCode::StrategySet.run('A1A1A1').should == [10007] end end context 'with empty strategy set' do before :each do GovKit::CA::PostalCode::StrategySet.strategies.clear end describe '#strategies' do it 'should return the strategies' do GovKit::CA::PostalCode::StrategySet.strategies.should == [] end end describe '#register' do it 'should add a strategy' do GovKit::CA::PostalCode::StrategySet.register(strategy) GovKit::CA::PostalCode::StrategySet.strategies.should == [strategy] end end describe '#run' do it 'should raise an error' do expect{GovKit::CA::PostalCode::StrategySet.run('A1A1A1')}.to raise_error(GovKit::CA::ResourceNotFound) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
govkit-ca-0.0.10 | spec/strategy_set_spec.rb |
govkit-ca-0.0.9 | spec/strategy_set_spec.rb |
govkit-ca-0.0.8 | spec/strategy_set_spec.rb |
govkit-ca-0.0.7 | spec/strategy_set_spec.rb |