mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-11-23 19:33:46 +01:00
Rename Problem to Translation
This commit is contained in:
1 parent
94087d31d2
commit
e13b82ad1f
34 files changed
+244
-239
No files matched your search
@@ -1,34 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProblemTest < ActiveSupport::TestCase
|
||||
test "should not save problem without title" do
|
||||
problem = Problem.new(content: 'This is some content')
|
||||
assert_not problem.save
|
||||
end
|
||||
|
||||
test "should not save problem without content" do
|
||||
problem = Problem.new(title: 'Problem title')
|
||||
assert_not problem.save
|
||||
end
|
||||
|
||||
test "should not save problem with duplicate title" do
|
||||
problem = Problem.new(
|
||||
title: problems(:one).title,
|
||||
content: 'This is some content'
|
||||
)
|
||||
assert_not problem.save
|
||||
end
|
||||
|
||||
test "should save correct problem" do
|
||||
problem = Problem.new(
|
||||
title: 'A unique title',
|
||||
content: 'Some content'
|
||||
)
|
||||
assert problem.save
|
||||
end
|
||||
|
||||
test "should have correct original url" do
|
||||
first = Problem.first
|
||||
assert_equal "https://projecteuler.net/problem=#{first.id}", first.original_url
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TranslationTest < ActiveSupport::TestCase
|
||||
test "should not save translation without title" do
|
||||
translation = Translation.new(content: 'This is some content')
|
||||
assert_not translation.save
|
||||
end
|
||||
|
||||
test "should not save translation without content" do
|
||||
translation = Translation.new(title: 'Translation title')
|
||||
assert_not translation.save
|
||||
end
|
||||
|
||||
test "should not save translation with duplicate title" do
|
||||
translation = Translation.new(
|
||||
title: translations(:one).title,
|
||||
content: 'This is some content'
|
||||
)
|
||||
assert_not translation.save
|
||||
end
|
||||
|
||||
test "should save correct translation" do
|
||||
translation = Translation.new(
|
||||
title: 'A unique title',
|
||||
content: 'Some content'
|
||||
)
|
||||
assert translation.save
|
||||
end
|
||||
|
||||
test "should have correct original url" do
|
||||
first = Translation.first
|
||||
assert_equal "https://projecteuler.net/problem=#{first.id}", first.original_url
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user