mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
36 lines
996 B
Ruby
36 lines
996 B
Ruby
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',
|
|
problem: Problem.first
|
|
)
|
|
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
|