Sha256: c16bb8e6baa79f2ce630c0c77211c47ac1d7ff42e49cb2120c6502356a458822

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 Bytes

Contents

# coding: utf-8
require 'spec_helper'

describe JpPrefecture do
  describe '.included' do
    subject do
      Class.new(ActiveRecord::Base) do
        include JpPrefecture
      end
    end

    it { should respond_to(:jp_prefecture) }
  end

  describe 'include されていない' do
    subject { Class.new(ActiveRecord::Base) }
    it { should_not respond_to(:jp_prefecture) }
  end

  describe '.setup' do
    before do
      filepath = File.join(File.dirname(__FILE__), 'fixtures/prefecture.yml')
      JpPrefecture.setup do |config|
        config.mapping_data = YAML.load_file filepath
      end
    end

    after do
      JpPrefecture.setup do |config|
        config.mapping_data = nil
      end
    end

    it { JpPrefecture::Mapping.data.count.should eq 48 }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jp_prefecture-0.7.0 spec/jp_prefecture_spec.rb
jp_prefecture-0.6.0 spec/jp_prefecture_spec.rb
jp_prefecture-0.5.0 spec/jp_prefecture_spec.rb
jp_prefecture-0.4.0 spec/jp_prefecture_spec.rb