require "rails_helper"

RSpec.describe GraphicsElement do
  describe "associations" do
    it { is_expected.to belong_to(:video) }
  end

  describe "validations" do
    it { is_expected.to validate_presence_of(:graphic_type) }
    it { is_expected.to validate_presence_of(:text) }
    it { is_expected.to validate_presence_of(:time_elapsed) }
  end

  describe "#appears_at" do
    it "returns formatted timecode" do
      graphics_element = build(:graphics_element, time_elapsed: "1.039")

      expect(graphics_element.appears_at).to eq "00:00:01:01"
    end
  end
end
