require "rails_helper"

module ExcelReports
  module VideoReports
    module NatGeoLegalBinderLogs
      RSpec.describe ProductionPersonnelLogSheet, type: :model do
        let(:workbook) { instance_double(Axlsx::Workbook, :workbook) }

        subject { described_class.new(workbook, []) }

        it_behaves_like "a worksheet"

        describe "#title" do
          it "returns the title of the sheet" do
            expect(subject.title).to eq "Production Personnel Log"
          end
        end

        describe "#fill_content" do
          it "adds content for the table" do
            sheet = instance_double(Axlsx::Worksheet, :sheet) 
            allow(sheet).to receive(:add_row)

            subject.fill_content(sheet)

            expect(sheet).to have_received(:add_row).exactly(12).times
          end
        end

        describe "#format" do
          it "sets column widths and merges cells" do
            sheet = instance_double(Axlsx::Worksheet, :sheet)
            allow(sheet).to receive(:column_widths)

            subject.format(sheet)

            expect(sheet).to have_received(:column_widths)
          end
        end

        describe "#style" do
          it "sets sheet style" do
            sheet = instance_double(Axlsx::Worksheet, :sheet)
            allow(sheet).to receive(:add_style)

            subject.style(sheet)

            expect(sheet).to have_received(:add_style).at_least(1).times
          end
        end
      end
    end
  end
end
