Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid all Minitest deprecation warnings #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions spec/carmen/country_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

it "provides access to all countries" do
@countries.size.must_equal 3
_(@countries.size).must_equal 3
end

it "denies modification of countries" do
Expand All @@ -21,27 +21,27 @@
describe "API for finding countries by name" do
it "provides exact matching" do
eastasia = Carmen::Country.named('Eastasia')
eastasia.instance_of?(Carmen::Country).must_equal true
_(eastasia.instance_of?(Carmen::Country)).must_equal true
end

it "provides case-insensitive searches by default" do
eurasia = Carmen::Country.named('eUrAsIa')
eurasia.instance_of?(Carmen::Country).must_equal true
eurasia.name.must_equal 'Eurasia'
_(eurasia.instance_of?(Carmen::Country)).must_equal true
_(eurasia.name).must_equal 'Eurasia'
end

it "provides case-sensitive searches optionally" do
oceania = Carmen::Country.named('oCeAnIa', :case => true)
assert_nil(oceania)
oceania = Carmen::Country.named('Oceania', :case => true)
oceania.instance_of?(Carmen::Country).must_equal true
oceania.name.must_equal 'Oceania'
_(oceania.instance_of?(Carmen::Country)).must_equal true
_(oceania.name).must_equal 'Oceania'
end

it "provides fuzzy (substring) matching optionally" do
eastasia = Carmen::Country.named('East', :fuzzy => true)
eastasia.instance_of?(Carmen::Country).must_equal true
eastasia.name.must_equal 'Eastasia'
_(eastasia.instance_of?(Carmen::Country)).must_equal true
_(eastasia.name).must_equal 'Eastasia'
end

end
Expand All @@ -50,40 +50,40 @@
describe 'Universal finder method' do
it 'provides an API for finding countries by 2-symbol code' do
eurasia = Carmen::Country.coded('EU')
eurasia.instance_of?(Carmen::Country).must_equal true
eurasia.name.must_equal 'Eurasia'
_(eurasia.instance_of?(Carmen::Country)).must_equal true
_(eurasia.name).must_equal 'Eurasia'
end

it 'provides an API for finding countries by 3-symbol code' do
eastasia = Carmen::Country.coded('EST')
eastasia.instance_of?(Carmen::Country).must_equal true
eastasia.name.must_equal 'Eastasia'
_(eastasia.instance_of?(Carmen::Country)).must_equal true
_(eastasia.name).must_equal 'Eastasia'
end

it 'provides an API for finding countries by numeric code' do
oceania = Carmen::Country.coded('001')
oceania.instance_of?(Carmen::Country).must_equal true
oceania.name.must_equal 'Oceania'
_(oceania.instance_of?(Carmen::Country)).must_equal true
_(oceania.name).must_equal 'Oceania'
end
end

describe 'Finder methods for searching by each attribute' do
it 'provides an API for finding countries by 2-symbol code' do
eurasia = Carmen::Country.alpha_2_coded('EU')
eurasia.instance_of?(Carmen::Country).must_equal true
eurasia.name.must_equal 'Eurasia'
_(eurasia.instance_of?(Carmen::Country)).must_equal true
_(eurasia.name).must_equal 'Eurasia'
end

it 'provides an API for finding countries by 3-symbol code' do
eastasia = Carmen::Country.alpha_3_coded('EST')
eastasia.instance_of?(Carmen::Country).must_equal true
eastasia.name.must_equal 'Eastasia'
_(eastasia.instance_of?(Carmen::Country)).must_equal true
_(eastasia.name).must_equal 'Eastasia'
end

it 'provides an API for finding countries by numeric code' do
oceania = Carmen::Country.numeric_coded('001')
oceania.instance_of?(Carmen::Country).must_equal true
oceania.name.must_equal 'Oceania'
_(oceania.instance_of?(Carmen::Country)).must_equal true
_(oceania.name).must_equal 'Oceania'
end
end
end
Expand All @@ -94,44 +94,44 @@
end

it "is of type :country" do
@oceania.type.must_equal 'country'
_(@oceania.type).must_equal 'country'
end

it "has a name" do
@oceania.name.must_equal 'Oceania'
_(@oceania.name).must_equal 'Oceania'
end

it "has an official name" do
@oceania.official_name.must_equal 'The Superstate of Oceania'
_(@oceania.official_name).must_equal 'The Superstate of Oceania'
end

it "has a common name" do
@oceania.common_name.must_equal 'Oceania'
_(@oceania.common_name).must_equal 'Oceania'
end

it "has a 2 character code" do
@oceania.alpha_2_code.must_equal 'OC'
_(@oceania.alpha_2_code).must_equal 'OC'
end

it "has a 3 character code" do
@oceania.alpha_3_code.must_equal 'OCE'
_(@oceania.alpha_3_code).must_equal 'OCE'
end

it "has code as an alias to alpha_2_code" do
@oceania.code.must_equal 'OC'
_(@oceania.code).must_equal 'OC'
end

it "has a numeric code" do
@oceania.numeric_code.must_equal '001'
_(@oceania.numeric_code).must_equal '001'
end

it "has the world as a parent" do
@oceania.parent.must_equal Carmen::World.instance
_(@oceania.parent).must_equal Carmen::World.instance
end

it 'has a reasonable inspect value' do
@oceania.inspect.must_equal '<#Carmen::Country name="Oceania">'
_(@oceania.inspect).must_equal '<#Carmen::Country name="Oceania">'
end
end


end
27 changes: 13 additions & 14 deletions spec/carmen/i18n_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it "sets an instance of I18n::Simple as the default backend" do
backend = Carmen.i18n_backend

backend.instance_of?(Carmen::I18n::Simple).must_equal true
_(backend.instance_of?(Carmen::I18n::Simple)).must_equal true
end

end
Expand All @@ -20,13 +20,13 @@
end

it 'knows which locales are available' do
@i18n.available_locales.must_equal ['de', 'en']
_(@i18n.available_locales).must_equal ['de', 'en']
end

it "loads and merges yaml files" do
@i18n.t('world.oc.name').must_equal 'Oceania'
@i18n.t('world.oc.ao.name').must_equal 'Airstrip One'
@i18n.t('world.oc.ao.lo.name').must_equal 'London'
_(@i18n.t('world.oc.name')).must_equal 'Oceania'
_(@i18n.t('world.oc.ao.name')).must_equal 'Airstrip One'
_(@i18n.t('world.oc.ao.lo.name')).must_equal 'London'
end

describe "overlaying additional locale paths" do
Expand All @@ -41,11 +41,11 @@
end

it 'can override the names of countries' do
@i18n.t('world.es.official_name').must_equal('The Wonderous Country of Eastasia')
_(@i18n.t('world.es.official_name')).must_equal('The Wonderous Country of Eastasia')
end

it 'can override the names of subregions' do
@i18n.t('world.oc.ao.name').must_equal('Airstrip Uno')
_(@i18n.t('world.oc.ao.name')).must_equal('Airstrip Uno')
end
end

Expand All @@ -61,23 +61,23 @@
end

it 'retains existing locales' do
@i18n.available_locales.must_equal ['de', 'en', 'zz']
_(@i18n.available_locales).must_equal ['de', 'en', 'zz']
end

it 'stores the current locale' do
@i18n.locale.must_equal 'zz'
_(@i18n.locale).must_equal 'zz'
end

it 'can override the names of countries' do
@i18n.t('world.es.official_name').must_equal('The Zonderous Zountry of Zeastasia')
_(@i18n.t('world.es.official_name')).must_equal('The Zonderous Zountry of Zeastasia')
end

it 'can override the names of subregions' do
@i18n.t('world.oc.ao.name').must_equal('Zairstrip Zuno')
_(@i18n.t('world.oc.ao.name')).must_equal('Zairstrip Zuno')
end

it 'falls back when a a locale is missing a value' do
@i18n.t('world.eu.official_name').must_equal('The Superstate of Eurasia')
_(@i18n.t('world.eu.official_name')).must_equal('The Superstate of Eurasia')
end
end

Expand All @@ -93,9 +93,8 @@
end

it 'still has access to the base locale data' do
@i18n.t('world.eu.official_name').must_equal('Das großartige Staat von Eurasia')
_(@i18n.t('world.eu.official_name')).must_equal('Das großartige Staat von Eurasia')
end

end

end
14 changes: 7 additions & 7 deletions spec/carmen/overlay_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@

it 'finds elements that exist only in overlay files' do
sealand = Carmen::Country.coded('SE')
sealand.instance_of?(Carmen::Country).must_equal true
sealand.type.must_equal('fort')
_(sealand.instance_of?(Carmen::Country)).must_equal true
_(sealand.type).must_equal('fort')
end

it 'still finds elements that exist only in gem files' do
oceania = Carmen::Country.coded('OC')
oceania.instance_of?(Carmen::Country).must_equal true
oceania.type.must_equal('country')
_(oceania.instance_of?(Carmen::Country)).must_equal true
_(oceania.type).must_equal('country')
end

it 'still finds subregions that exist only in gem files' do
oceania = Carmen::Country.coded('OC')
oceania.subregions?.must_equal true
oceania.subregions.named("Airstrip One").type.must_equal("province")
_(oceania.subregions?).must_equal true
_(oceania.subregions.named("Airstrip One").type).must_equal("province")
end

it 'removes elements that have _enabled set to false' do
Carmen::World.instance.subregions.size.must_equal(3)
_(Carmen::World.instance.subregions.size).must_equal(3)
assert_nil(Carmen::Country.named('Eurasia'))
end

Expand Down
2 changes: 1 addition & 1 deletion spec/carmen/region_collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
end

it 'provides an API for filtering regions by type' do
@collection.typed('custom_type1').map(&:code).must_equal ['AA']
_(@collection.typed('custom_type1').map(&:code)).must_equal ['AA']
end

end
Loading