require_relative "spec_helper.rb" include GivenFilesystemSpecHelpers describe YSI::Engine do use_given_filesystem describe "#read_config" do it "reads valid configuration" do config = <= 6 ysi_standard.assertions.each_with_index do |assertion, i| expect(assertion.class).to eq(ysi.assertions[i].class) end end describe "#dependency_errored?" do it "returns true, if no dependency errored" do engine = YSI::Engine.new errored_assertions = [] assertion = YSI::ChangeLog.new(engine) expect(engine.dependency_errored?(assertion, errored_assertions)).to be(false) end it "returns false, if a dependency errored" do engine = YSI::Engine.new errored_assertions = [YSI::Version.new(engine)] assertion = YSI::ChangeLog.new(engine) expect(engine.dependency_errored?(assertion, errored_assertions)).to be(true) end end describe "release attributes" do before(:each) do @checkout_dir = given_directory setup_test_git_repo("005", @checkout_dir) @pwd = Dir.pwd Dir.chdir(File.join(@checkout_dir, "red_herring")) @engine = YSI::Engine.new @engine.version = "1.0.0" end after(:each) do Dir.chdir(@pwd) end it "#project_name" do expect(@engine.project_name).to eq("red_herring") end it "#project_url" do expect(@engine.project_url).to eq("https://github.com/cornelius/red_herring") end it "#release_url" do expect(@engine.release_url).to eq("https://github.com/cornelius/red_herring/releases/tag/v1.0.0") end it "#config_url" do expect(@engine.config_url).to eq("https://raw.githubusercontent.com/cornelius/red_herring/master/yes_ship_it.conf") end end describe "dry run" do it "creates real executor by default" do expect(subject.executor.class).to be(YSI::Executor) end it "sets dry run" do subject.dry_run = true expect(subject.executor.class).to be(YSI::DryExecutor) end it "unsets dry run" do subject.dry_run = false expect(subject.executor.class).to be(YSI::Executor) end end end