mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-27 02:28:50 +01:00
Add function for updating problem count
This commit is contained in:
@@ -17,4 +17,21 @@ class ProblemTest < ActiveSupport::TestCase
|
||||
test "should have correct original url" do
|
||||
assert_equal "https://projecteuler.net/problem=1", problems(:one).original_url
|
||||
end
|
||||
|
||||
test "should allow for problem count updating" do
|
||||
Problem.update_count(10)
|
||||
assert_not Problem.where(id: 0).exists?
|
||||
(1..10).each do |i|
|
||||
assert Problem.where(id: i).exists?
|
||||
end
|
||||
assert_equal "First title", Problem.find(1).title
|
||||
end
|
||||
|
||||
test "should not allow decreasing problem count update" do
|
||||
|
||||
assert_raises ArgumentError do
|
||||
Problem.update_count(1)
|
||||
end
|
||||
assert_equal 3, Problem.count()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user