test/structure_test.rb in structure-0.18.0 vs test/structure_test.rb in structure-0.19.0
- old
+ new
@@ -87,53 +87,5 @@
require 'structure/rails'
assert_equal true, person.as_json(:only => :name).has_key?(:name)
assert_equal false, person.as_json(:except => :name).has_key?(:name)
end
end
-
-class City < Structure
- key :name
-end
-
-class Stadt < Structure
- key :name
-end
-
-class TestStatic < Test::Unit::TestCase
- def fix(klass, path)
- klass.instance_variable_set(:@all, nil)
- klass.instance_variable_set(:@id_cnt, nil)
- fixture = File.expand_path("../fixtures/#{path}.yml", __FILE__)
- klass.set_data_file(fixture)
- end
-
- test "should enumerate at the class level" do
- fix City, 'cities'
- assert_respond_to City, :map
- end
-
- test "should return all records" do
- fix City, 'cities'
- cities = City.all
- assert_kind_of City, cities.first
- assert_equal 2, cities.size
- end
-
- test "should find a record" do
- fix City, 'cities'
- assert 'New York', City.find(1).name
- assert_nil City.find(4)
- end
-
- test "should work if records contain no id field" do
- fix City, 'cities_without_ids'
- assert_equal 'New York', City.find(1).name
- assert_equal 'Paris', City.find(3).name
- end
-
- test "should auto increment independently in each structure" do
- fix City, 'cities_without_ids'
- fix Stadt, 'cities_without_ids'
- assert_equal 'New York', City.find(1).name
- assert_equal 'New York', Stadt.find(1).name
- end
-end