mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-27 02:28:50 +01:00
Prefill original title and content from projecteuler.net
This commit is contained in:
15
test/jobs/pull_problem_content_job_test.rb
Normal file
15
test/jobs/pull_problem_content_job_test.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PullProblemContentJobTest < ActiveJob::TestCase
|
||||
test "should update problem count and titles" do
|
||||
|
||||
stub = WebMock.stub_request(:get, "https://projecteuler.net/minimal=3").
|
||||
to_return(body: "\n<p><a href=\"problem=5\">test</a></p>")
|
||||
|
||||
PullProblemContentJob.perform_now problems(:three)
|
||||
|
||||
assert_requested stub
|
||||
assert_equal '<p><a href="/problem=5">test</a></p>', Problem.find(3).original_content
|
||||
assert_in_delta Time.current, Problem.find(3).pulled_at, 5
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user