def test_uniqueness
existing = create(:changeset_tag)
- tag = ChangesetTag.new
- tag.changeset_id = existing.changeset_id
- tag.k = existing.k
- tag.v = existing.v
+ tag = build(:changeset_tag, :changeset => existing.changeset, :k => existing.k, :v => existing.v)
assert_predicate tag, :new_record?
assert_not tag.valid?
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
def test_uniqueness
existing = create(:node_tag)
- tag = NodeTag.new
- tag.node_id = existing.node_id
- tag.k = existing.k
- tag.v = existing.v
+ tag = build(:node_tag, :node => existing.node, :k => existing.k, :v => existing.v)
assert_predicate tag, :new_record?
assert_not tag.valid?
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
def test_uniqueness
existing = create(:old_node_tag)
- tag = OldNodeTag.new
- tag.node_id = existing.node_id
- tag.version = existing.version
- tag.k = existing.k
- tag.v = existing.v
+ tag = build(:old_node_tag, :old_node => existing.old_node, :version => existing.version, :k => existing.k, :v => existing.v)
assert_predicate tag, :new_record?
assert_not tag.valid?
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
def test_uniqueness
existing = create(:old_relation_tag)
- tag = OldRelationTag.new
- tag.relation_id = existing.relation_id
- tag.version = existing.version
- tag.k = existing.k
- tag.v = existing.v
+ tag = build(:old_relation_tag, :old_relation => existing.old_relation, :version => existing.version, :k => existing.k, :v => existing.v)
assert_predicate tag, :new_record?
assert_not tag.valid?
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
def test_uniqueness
existing = create(:old_way_tag)
- tag = OldWayTag.new
+ tag = build(:old_way_tag, :old_way => existing.old_way, :version => existing.version, :k => existing.k, :v => existing.v)
tag.way_id = existing.way_id
tag.version = existing.version
tag.k = existing.k
def test_uniqueness
existing = create(:relation_tag)
- tag = RelationTag.new
- tag.relation_id = existing.relation_id
- tag.k = existing.k
- tag.v = existing.v
+ tag = build(:relation_tag, :relation => existing.relation, :k => existing.k, :v => existing.v)
assert_predicate tag, :new_record?
assert_not tag.valid?
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
def test_uniqueness
existing = create(:way_tag)
- tag = WayTag.new
+ tag = build(:way_tag, :way => existing.way, :k => existing.k, :v => existing.v)
tag.way_id = existing.way_id
tag.k = existing.k
tag.v = existing.v