Skip to content

Commit

Permalink
Update abbreviated license test
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuacoles committed Sep 23, 2024
1 parent dfd45f2 commit ed1a896
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions spec/bcf/flight_plans_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,35 @@
end
end

describe 'abbreviated style' do
describe "abbreviated style" do
let(:json) { Pathname.new(__FILE__).join("..", "..", "fixtures", "module_3.json").read }

it "renders a flight plan with abbreviated style and includes BY-SA 4.0" do
flight_plan = JSON.parse(json, { create_additions: true })
flight_plan = JSON.parse(json, {create_additions: true})
tf = Tempfile.new(["abbreviated_flightplan", ".pdf"])
expect(flight_plan).to be_a(BCF::FlightPlans::FlightPlan)

expect {
flight_plan.render_pdf(tf.path, style: 'abbreviated')
flight_plan.render_pdf(tf.path, style: "abbreviated")
}.not_to raise_error

expect(File.exist?(tf.path)).to be_truthy
expect(File.size(tf.path)).to be > 0 if File.exist?(tf.path)

# Check if the PDF contains the specific copyright text
text = PDF::Reader.new(tf.path).pages.map(&:text).join
expect(text).to include("CC BY-SA 4.0")
# Check each page contains the specific copyright text
reader = PDF::Reader.new(tf.path)

reader.pages.each do |page|
expect(page.text).to include("BY-SA 4.0")
end

# Check the first page is not the full copyright page
expect(reader.pages.first.text).not_to include("Your rights and obligations")
end
end

describe 'migrations' do
describe 'from un-versioned' do
describe "migrations" do
describe "from un-versioned" do
let(:json) { Pathname.new(__FILE__).join("..", "..", "fixtures", "module_3.json").read }

it "defaults to version 0.4.4 after migration as it has no version specified" do
Expand Down

0 comments on commit ed1a896

Please sign in to comment.