Sha256: 632bda0ef0da1da658760b6c780b3b893824d8995ddf1c4aea9e67aa0cfe5322

Contents?: true

Size: 1014 Bytes

Versions: 8

Compression:

Stored size: 1014 Bytes

Contents

require 'rails_helper'

module JpAddress
  RSpec.describe Zipcode, type: :model do

    describe ".download_master_file_from_japanpost" do
      it "download zipcode file from japan-postal-site" do
        VCR.use_cassette 'download_master_file_from_japanpost' do
          expect(JpAddress::Zipcode.download_master_file_from_japanpost).to eq :success
        end
      end
    end

    describe ".load_master_data" do
      it "load master data csv to table" do
        JpAddress::Zipcode.load_master_data 'spec/support/files/sample_ken.csv'
        expect(JpAddress::Zipcode.count).to eq 5
        expect(JpAddress::Zipcode.last.prefecture).to eq '北海道'
      end
    end

    describe "._remove_needless_words" do
      it "remove needless words" do
        expect(JpAddress::Zipcode.send(:_remove_needless_words, '以下に掲載がない場合')).to eq ''
        expect(JpAddress::Zipcode.send(:_remove_needless_words, '大通西(1~19丁目)')).to eq '大通西'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jp_address-1.0.1 spec/models/jp_address/zipcode_spec.rb
jp_address-1.0.0 spec/models/jp_address/zipcode_spec.rb
jp_address-0.0.6 spec/models/jp_address/zipcode_spec.rb
jp_address-0.0.5 spec/models/jp_address/zipcode_spec.rb
jp_address-0.0.4 spec/models/jp_address/zipcode_spec.rb
jp_address-0.0.3 spec/models/jp_address/zipcode_spec.rb
jp_address-0.0.2 spec/models/jp_address/zipcode_spec.rb
jp_address-0.0.1 spec/models/jp_address/zipcode_spec.rb