Sha256: 20a8ecfa6151a76cf1be2fda6aa1b01dd9d98887a5168130f67024b5ec11b658

Contents?: true

Size: 804 Bytes

Versions: 5

Compression:

Stored size: 804 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 { is_expected.to respond_to(:jp_prefecture) }
  end

  describe 'include されていない' do
    subject { Class.new(ActiveRecord::Base) }
    it { is_expected.not_to 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 { expect(JpPrefecture::Mapping.data.count).to eq 48 }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jp_prefecture-0.11.0 spec/jp_prefecture_spec.rb
jp_prefecture-0.10.0 spec/jp_prefecture_spec.rb
jp_prefecture-0.9.0 spec/jp_prefecture_spec.rb
jp_prefecture-0.8.1 spec/jp_prefecture_spec.rb
jp_prefecture-0.8.0 spec/jp_prefecture_spec.rb