Sha256: edb0bd13876a4a93dbcc2827a3e19e28fa8135dec67f2f2ca2aae4c2c0b937c2

Contents?: true

Size: 1.01 KB

Versions: 31

Compression:

Stored size: 1.01 KB

Contents

require 'rails_helper'

describe Effective::AddressesController do
  routes { EffectiveAddresses::Engine.routes }

  it 'should render the subregions partial' do
    get :subregions, :country_code => 'CA'
    response.status.should be 200
    response.should render_template 'effective/addresses/_subregions'
  end

  it 'should assign appropriate Canadian subregions' do
    get :subregions, :country_code => 'CA'
    assigns(:subregions).first.name.should eq 'Alberta'
  end

  it 'should assign appropriate US subregions' do
    get :subregions, :country_code => 'US'
    assigns(:subregions).first.name.should eq 'Alaska'
  end

  it 'should assign appropriate SG subregions' do
    get :subregions, :country_code => 'SG'  # Singapore
    assigns(:subregions).first.name.should eq 'Central Singapore'
  end

  it 'Should return an error when passed bad country code' do
    get :subregions, :country_code => 'NOPE'
    response.status.should be 200
    response.body.should eq "<option value=''>None Available</option>"
  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
effective_addresses-1.8.2 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.8.1 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.8.0 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.7.4 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.7.3 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.7.2 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.7.1 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.7.0 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.6.3 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.6.2 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.6.1 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.6.0 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.5.1 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.5.0 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.4.1 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.4.0 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.3.9 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.3.8 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.3.7 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.3.6 spec/controllers/addresses_controller_spec.rb