Sha256: f0e7f14d433f14dbdcde3027c76f29fd48e71540de26088c80ab66f9b4a99217

Contents?: true

Size: 938 Bytes

Versions: 7

Compression:

Stored size: 938 Bytes

Contents

require 'spec_helper'

describe Effective::AddressesController do
  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 422 # Unprocessable Entity
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_addresses-1.0.6 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.0.5 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.0.4 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.0.3 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.0.2 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.0.1 spec/controllers/addresses_controller_spec.rb
effective_addresses-1.0.0 spec/controllers/addresses_controller_spec.rb