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

Add auction statuses #182

Merged
merged 1 commit into from
Mar 25, 2019
Merged
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
5 changes: 4 additions & 1 deletion app/models/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ class Domain
STATUS_BLOCKED = 'Blocked'.freeze
STATUS_RESERVED = 'Reserved'.freeze
STATUS_DISCARDED = 'deleteCandidate'.freeze
STATUS_AT_AUCTION = 'AtAuction'.freeze
STATUS_PENDING_REGISTRATION = 'PendingRegistration'.freeze

INACTIVE_STATUSES = [STATUS_BLOCKED, STATUS_RESERVED, STATUS_DISCARDED].freeze
INACTIVE_STATUSES = [STATUS_BLOCKED, STATUS_RESERVED, STATUS_DISCARDED,
STATUS_AT_AUCTION, STATUS_PENDING_REGISTRATION].freeze
private_constant :INACTIVE_STATUSES

attr_accessor :name
Expand Down
22 changes: 13 additions & 9 deletions test/models/domain_test.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
require 'test_helper'

class DomainTest < ActiveSupport::TestCase
def test_status_blocked
def test_statuses
# Case does matter; this is how `registry` app generates it.
assert_equal 'Blocked', Domain::STATUS_BLOCKED
end

def test_status_reserved
# Case does matter; this is how `registry` app generates it.
assert_equal 'Reserved', Domain::STATUS_RESERVED
end

def test_status_discarded
# Case does matter; this is how `registry` app generates it.
assert_equal 'deleteCandidate', Domain::STATUS_DISCARDED
assert_equal 'AtAuction', Domain::STATUS_AT_AUCTION
assert_equal 'PendingRegistration', Domain::STATUS_PENDING_REGISTRATION
end

def test_active
Expand All @@ -37,4 +31,14 @@ def test_inactive_when_discarded
domain = Domain.new(statuses: [Domain::STATUS_DISCARDED])
assert_not domain.active?
end

def test_inactive_when_at_auction
domain = Domain.new(statuses: [Domain::STATUS_AT_AUCTION])
assert_not domain.active?
end

def test_inactive_when_pending_registration
domain = Domain.new(statuses: [Domain::STATUS_PENDING_REGISTRATION])
assert_not domain.active?
end
end