Skip to content

Instantly share code, notes, and snippets.

@costa
Created June 29, 2024 12:39
Show Gist options
  • Save costa/8b1fb6a8d2a0b4b6ee8d3e4db501c808 to your computer and use it in GitHub Desktop.
Save costa/8b1fb6a8d2a0b4b6ee8d3e4db501c808 to your computer and use it in GitHub Desktop.
icloud-vlogger's formal specification (with RSpec, excerpt)
# ...definitions...
describe "Automated vlogging" do
# ...setup...
it "should happen whenever iCloud has a new *relevant* video" do
Dir.chdir LOG_PROJ_DIR do
before_dir = Dir.children(TODAY_DATE_DIR) rescue []
expect(expected_pub_url = ask("Enter the (\"channel\") URL for publishing")).not_to be_empty
puts RQRCode::QRCode.new(expected_pub_url).as_ansi
expect(ask "Now, shoot your best (very short, please) video with your (stock) iSome device:\n" +
"at the end of the video, point and focus its camera on the QR above (publishing URL).\n" +
"After a (probably long) while, check it is uploaded to your (stock) iCloud.\n" +
"Then, give it a few reasonable minutes, and now, let's check that .pub.video log [OK]"
).to be_empty
new_files = (Dir.children(TODAY_DATE_DIR) - before_dir).sort
expect(new_files.map{ |fn| file_ext fn }).to eq %w[.pub.ffmprb .pub.video]
expected_pub_video_path = File.join(TODAY_DATE_DIR, new_files[1])
expect(File.read expected_pub_video_path).to match expected_pub_url
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment