require_relative "spec_helper" include CliTester describe "Command line interface" do include GivenFilesystemSpecHelpers use_given_filesystem describe "view" do it "generates view" do dir = given_directory do given_directory_from_data("awesomelib", from: "manifests/awesomelib") given_directory_from_data("newlib", from: "manifests/newlib") end output_dir = given_directory result = run_command(args: ["view", "--offline", "--manifest_dir=#{dir}", "--output-dir=#{output_dir}"]) expect(result).to exit_with_success(/Creating web site/) expect(File.exist?(File.join(output_dir, "index.html"))).to be(true) expect(File.exist?(File.join(output_dir, "libraries", "awesomelib.html"))).to be(true) expect(File.exist?(File.join(output_dir, "libraries", "newlib.html"))).to be(true) end it "checks templates direstory" do dir = given_directory do given_directory_from_data("awesomelib", from: "manifests/awesomelib") given_directory_from_data("newlib", from: "manifests/newlib") end output_dir = given_directory result = run_command(args: ["view", "--offline", "--manifest_dir=#{dir}", "--output-dir=#{output_dir}", "--templates=one-column"]) expect(result).to exit_with_success(/Creating web site/) result = run_command(args: ["view", "--offline", "--manifest_dir=#{dir}", "--output-dir=#{output_dir}", "--templates=unreal-template"]) expected_output = <"] expect(manifest.maturity).to eq "stable" expect(manifest.packages.source).to eq "ftp://example.com/download/awesomelib-0.2.0.tar.gz" end end end end