Skip to content

Commit

Permalink
Fix #13; move default threshold into Stoplight module
Browse files Browse the repository at this point in the history
  • Loading branch information
tfausak committed Aug 13, 2014
1 parent cc3a862 commit a5f3b60
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
5 changes: 4 additions & 1 deletion lib/stoplight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module Stoplight
# @return [Gem::Version]
VERSION = Gem::Version.new('0.1.0')

# @return [Integer]
DEFAULT_THRESHOLD = 3

class << self
extend Forwardable

Expand Down Expand Up @@ -59,7 +62,7 @@ def red?(name)
# @param name [String]
# @return [Integer]
def threshold(name)
data_store.threshold(name) || Light::DEFAULT_THRESHOLD
data_store.threshold(name) || DEFAULT_THRESHOLD
end
end
end
3 changes: 0 additions & 3 deletions lib/stoplight/light.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

module Stoplight
class Light
# @return [Integer]
DEFAULT_THRESHOLD = 3

# @return [Array<Exception>]
attr_reader :allowed_errors

Expand Down
3 changes: 1 addition & 2 deletions spec/stoplight/light_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@
subject(:result) { light.threshold }

it 'uses the default threshold' do
expect(result).to eql(
described_class.const_get(:DEFAULT_THRESHOLD))
expect(result).to eql(Stoplight::DEFAULT_THRESHOLD)
end
end
end
2 changes: 1 addition & 1 deletion spec/stoplight_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
subject(:result) { described_class.threshold(name) }

it 'uses the default threshold' do
expect(result).to eql(Stoplight::Light::DEFAULT_THRESHOLD)
expect(result).to eql(Stoplight::DEFAULT_THRESHOLD)
end

context 'with a custom threshold' do
Expand Down

0 comments on commit a5f3b60

Please sign in to comment.