Skip to content

Commit

Permalink
Clean up some cruft I accidentally left in threshold spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviershay committed Jan 14, 2013
1 parent 40f5083 commit 38cb79b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions spec/threshold_check_spec.rb
Expand Up @@ -6,20 +6,20 @@


context "checking violations" do context "checking violations" do


def check(opts = {}) def run(threshold, value)
Cane::ThresholdCheck.new(opts) described_class.new(threshold => [['x', value]])
end end


context "when the current coverage cannot be read" do context "when the current coverage cannot be read" do
it do it do
check(gte: [['bogus_file', '20']]).should \ run(:gte, 20).should \
have_violation('bogus_file is unavailable, should be >= 20.0') have_violation('x is unavailable, should be >= 20.0')
end end
end end


context "when the coverage threshold is incorrectly specified" do context "when the coverage threshold is incorrectly specified" do
it do it do
check(gte: [['20', 'bogus_file']]).should \ described_class.new(gte: [['20', 'bogus_file']]).should \
have_violation('bogus_file is not a number or a file') have_violation('bogus_file is not a number or a file')
end end
end end
Expand All @@ -31,10 +31,6 @@ def check(opts = {})
file.should_receive(:contents).with('x').and_return("8\n") file.should_receive(:contents).with('x').and_return("8\n")
end end


def run(threshold, value)
check(threshold => [['x', value]])
end

context '>' do context '>' do
it { run(:gt, 7).should have_no_violations } it { run(:gt, 7).should have_no_violations }
it { run(:gt, 8).should have_violation('x is 8.0, should be > 8.0') } it { run(:gt, 8).should have_violation('x is 8.0, should be > 8.0') }
Expand Down

0 comments on commit 38cb79b

Please sign in to comment.