Create a redactions factory and use for model tests.
This commit is contained in:
parent
8ccd7364cd
commit
006627789f
2 changed files with 11 additions and 4 deletions
8
test/factories/redaction.rb
Normal file
8
test/factories/redaction.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
FactoryGirl.define do
|
||||
factory :redaction do
|
||||
sequence(:title) { |n| "Redaction #{n}" }
|
||||
sequence(:description) { |n| "Description of redaction #{n}" }
|
||||
|
||||
user
|
||||
end
|
||||
end
|
|
@ -3,11 +3,10 @@ require "osm"
|
|||
|
||||
class RedactionTest < ActiveSupport::TestCase
|
||||
api_fixtures
|
||||
fixtures :redactions
|
||||
|
||||
def test_cannot_redact_current
|
||||
n = current_nodes(:node_with_versions)
|
||||
r = redactions(:example)
|
||||
r = create(:redaction)
|
||||
assert_equal(false, n.redacted?, "Expected node to not be redacted already.")
|
||||
assert_raise(OSM::APICannotRedactError) do
|
||||
n.redact!(r)
|
||||
|
@ -16,7 +15,7 @@ class RedactionTest < ActiveSupport::TestCase
|
|||
|
||||
def test_cannot_redact_current_via_old
|
||||
n = nodes(:node_with_versions_v4)
|
||||
r = redactions(:example)
|
||||
r = create(:redaction)
|
||||
assert_equal(false, n.redacted?, "Expected node to not be redacted already.")
|
||||
assert_raise(OSM::APICannotRedactError) do
|
||||
n.redact!(r)
|
||||
|
@ -25,7 +24,7 @@ class RedactionTest < ActiveSupport::TestCase
|
|||
|
||||
def test_can_redact_old
|
||||
n = nodes(:node_with_versions_v3)
|
||||
r = redactions(:example)
|
||||
r = create(:redaction)
|
||||
assert_equal(false, n.redacted?, "Expected node to not be redacted already.")
|
||||
assert_nothing_raised(OSM::APICannotRedactError) do
|
||||
n.redact!(r)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue