Skip to content

Commit

Permalink
古い hash シンタックスを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
chocoby committed Jun 19, 2014
1 parent 9187b42 commit 3fc348d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -2,7 +2,7 @@
# coding: utf-8
require "bundler/gem_tasks"

task :default => [:spec]
task default: [:spec]
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
Expand Down Expand Up @@ -65,7 +65,7 @@ task :create_zips do

# save result
File.open('data/zip.yml', 'w') do |file|
file.write "# {:prefecture_code => [[from_zip_1, to_zip_1], [from_zip_2, to_zip_2], ...], ... }\n"
file.write "# { prefecture_code: [[from_zip_1, to_zip_1], [from_zip_2, to_zip_2], ...], ... }\n"
file.write prefectures_to_zip.to_yaml
end

Expand Down
2 changes: 1 addition & 1 deletion data/zip.yml
@@ -1,4 +1,4 @@
# {:prefecture_code => [[from_zip_1, to_zip_1], [from_zip_2, to_zip_2], ...], ... }
# { prefecture_code: [[from_zip_1, to_zip_1], [from_zip_2, to_zip_2], ...], ... }
---
1:
- - 10000
Expand Down
12 changes: 6 additions & 6 deletions spec/base_spec.rb
Expand Up @@ -12,7 +12,7 @@
jp_prefecture :prefecture_code
end

klass.new(:prefecture_code => 1)
klass.new(prefecture_code: 1)
end

it 'prefecture_code のコードが変換できること' do
Expand All @@ -28,7 +28,7 @@
jp_prefecture :prefecture_id
end

klass.new(:prefecture_id => 1)
klass.new(prefecture_id: 1)
end

it 'prefecture_id のコードが変換できること' do
Expand All @@ -43,10 +43,10 @@
klass = Class.new(ActiveRecord::Base) do
self.table_name = :places
include JpPrefecture
jp_prefecture :prefecture_code, :method_name => :prefecture_method
jp_prefecture :prefecture_code, method_name: :prefecture_method
end

klass.new(:prefecture_code => 1)
klass.new(prefecture_code: 1)
end

it 'prefecture_method で結果が参照できること' do
Expand All @@ -65,14 +65,14 @@
end

context '都道府県が見つかった場合' do
let(:model_class) { klass.new(:prefecture_code => 1) }
let(:model_class) { klass.new(prefecture_code: 1) }
it { expect(model_class).to respond_to(:prefecture) }
it { expect(model_class.prefecture).to be_an_instance_of(JpPrefecture::Prefecture) }
it { expect(model_class.prefecture.name).to eq '北海道' }
end

context '都道府県が見つからなかった場合' do
let(:model_class) { klass.new(:prefecture_code => 99) }
let(:model_class) { klass.new(prefecture_code: 99) }
it { expect(model_class).to respond_to(:prefecture) }
it { expect(model_class.prefecture).to be_nil }
end
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Expand Up @@ -13,9 +13,9 @@
end

def setup_db
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ":memory:"
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"

ActiveRecord::Schema.define(:version => 1) do
ActiveRecord::Schema.define(version: 1) do
create_table :places do |t|
t.integer :prefecture_code
t.integer :prefecture_id
Expand Down

0 comments on commit 3fc348d

Please sign in to comment.