require "test_helper"

class EntryVersionTest < ActiveSupport::TestCase
  test "should be valid with all attributes" do
    version = EntryVersion.new(
      entry: entries(:one),
      user: users(:one),
      changes_made: { "fi" => "uusi sana" }
    )
    assert version.valid?
  end

  test "should be invalid without changes_made" do
    version = EntryVersion.new(
      entry: entries(:one),
      user: users(:one)
    )
    assert_not version.valid?
  end

  test "should be invalid without an entry" do
    version = EntryVersion.new(
      user: users(:one),
      changes_made: { "fi" => "uusi sana" }
    )
    assert_not version.valid?
  end

  test "should be invalid without a user" do
    version = EntryVersion.new(
      entry: entries(:one),
      changes_made: { "fi" => "uusi sana" }
    )
    assert_not version.valid?
  end
end
