Sha256: 1d86db99aaa497f98adc847b0872c3fc7e0119b7f3354335dfd9468d3036746a

Contents?: true

Size: 880 Bytes

Versions: 1

Compression:

Stored size: 880 Bytes

Contents

# coding: utf-8
require 'spec_helper'

describe JpPrefecture::Prefecture do
  describe '.build' do
    let(:pref) { JpPrefecture::Prefecture.build([1, '北海道']) }
    it { pref.code.should eq 1 }
    it { pref.name.should eq '北海道' }
  end

  describe '.find' do
    context '都道府県が見つかった場合' do
      let(:pref) { JpPrefecture::Prefecture.find(1) }
      it { pref.code.should eq 1 }
      it { pref.name.should eq '北海道' }
    end

    context '都道府県が見つからなかった場合' do
      let(:pref) { JpPrefecture::Prefecture.find(99) }
      it { pref.should be_nil }
    end
  end

  describe '.all' do
    let(:prefs) { JpPrefecture::Prefecture.all }
    it { prefs.first.should be_an_instance_of(JpPrefecture::Prefecture) }
    it '都道府県の数が 47 であること' do
      prefs.count.should eq 47
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jp_prefecture-0.1.1 spec/prefecture_spec.rb