Merge remote-tracking branch 'openstreetmap/pull/1352'
This commit is contained in:
commit
fc0aebc1a8
6 changed files with 16 additions and 18 deletions
|
@ -64,7 +64,7 @@ Metrics/BlockNesting:
|
||||||
# Offense count: 62
|
# Offense count: 62
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments.
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Max: 1658
|
Max: 1659
|
||||||
|
|
||||||
# Offense count: 69
|
# Offense count: 69
|
||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
|
|
|
@ -1648,6 +1648,7 @@ EOF
|
||||||
|
|
||||||
## Now try with the public user
|
## Now try with the public user
|
||||||
changeset = changesets(:public_user_first_change)
|
changeset = changesets(:public_user_first_change)
|
||||||
|
create(:changeset_tag, :changeset => changeset)
|
||||||
new_changeset = changeset.to_xml
|
new_changeset = changeset.to_xml
|
||||||
new_tag = XML::Node.new "tag"
|
new_tag = XML::Node.new "tag"
|
||||||
new_tag["k"] = "tagtesting"
|
new_tag["k"] = "tagtesting"
|
||||||
|
|
9
test/factories/changeset_tags.rb
Normal file
9
test/factories/changeset_tags.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :changeset_tag do
|
||||||
|
sequence(:k) { |n| "Key #{n}" }
|
||||||
|
sequence(:v) { |n| "Value #{n}" }
|
||||||
|
|
||||||
|
# Fixme requires changeset factory
|
||||||
|
changeset_id 1
|
||||||
|
end
|
||||||
|
end
|
9
test/fixtures/changeset_tags.yml
vendored
9
test/fixtures/changeset_tags.yml
vendored
|
@ -1,9 +0,0 @@
|
||||||
changeset_1_tag_1:
|
|
||||||
changeset_id: 1
|
|
||||||
k: created_by
|
|
||||||
v: test suite yml
|
|
||||||
|
|
||||||
changeset_2_tag_1:
|
|
||||||
changeset_id: 2
|
|
||||||
k: created_by
|
|
||||||
v: test suite yml 2
|
|
|
@ -3,10 +3,6 @@ require "test_helper"
|
||||||
class ChangesetTagTest < ActiveSupport::TestCase
|
class ChangesetTagTest < ActiveSupport::TestCase
|
||||||
api_fixtures
|
api_fixtures
|
||||||
|
|
||||||
def test_changeset_tag_count
|
|
||||||
assert_equal 2, ChangesetTag.count
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_length_key_valid
|
def test_length_key_valid
|
||||||
key = "k"
|
key = "k"
|
||||||
(0..255).each do |i|
|
(0..255).each do |i|
|
||||||
|
@ -58,10 +54,11 @@ class ChangesetTagTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_uniqueness
|
def test_uniqueness
|
||||||
|
existing = create(:changeset_tag)
|
||||||
tag = ChangesetTag.new
|
tag = ChangesetTag.new
|
||||||
tag.changeset_id = changeset_tags(:changeset_1_tag_1).changeset_id
|
tag.changeset_id = existing.changeset_id
|
||||||
tag.k = changeset_tags(:changeset_1_tag_1).k
|
tag.k = existing.k
|
||||||
tag.v = changeset_tags(:changeset_1_tag_1).v
|
tag.v = existing.v
|
||||||
assert tag.new_record?
|
assert tag.new_record?
|
||||||
assert !tag.valid?
|
assert !tag.valid?
|
||||||
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
|
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
|
||||||
|
|
|
@ -14,7 +14,7 @@ module ActiveSupport
|
||||||
def self.api_fixtures
|
def self.api_fixtures
|
||||||
# print "setting up the api_fixtures"
|
# print "setting up the api_fixtures"
|
||||||
fixtures :users, :user_roles
|
fixtures :users, :user_roles
|
||||||
fixtures :changesets, :changeset_tags
|
fixtures :changesets
|
||||||
|
|
||||||
fixtures :current_nodes, :nodes
|
fixtures :current_nodes, :nodes
|
||||||
set_fixture_class :current_nodes => Node
|
set_fixture_class :current_nodes => Node
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue