Sha256: 65cea628eed00824e7d254c92c7e98114ecfaf04703ad626bc971121f1fcb8b5

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

describe Stairs::Script do
  let(:filename) { "setup.rb" }
  let(:groups) { [:reset] }
  subject { described_class.new(filename, groups) }


  context "with a script present" do
    before do
      File.open(filename, "w") do |file|
        file.write("self.class")
      end
    end

    after { File.delete(filename) }

    describe "initialize" do
      it "receives groups" do
        expect { described_class.new(filename, groups) }.not_to raise_error
      end
    end

    describe "#run!" do
      it "outputs running message" do
        output = capture_stdout { subject.run! }
        expect(output).to include "= Running script setup.rb"
      end

      it "passes groups to the new instance of Step" do
        Stairs::Step.should_receive(:new).with(groups)
        subject.run!
      end

      it "evaluates the script in the context of an instance of Step" do
        # because our test setup.rb only contains `self.class` we can check
        # this way:
        expect(subject.run!).to eq Stairs::Step
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stairs-0.9.0 spec/lib/stairs/script_spec.rb
stairs-0.8.0 spec/lib/stairs/script_spec.rb
stairs-0.7.1 spec/lib/stairs/script_spec.rb
stairs-0.7.0 spec/lib/stairs/script_spec.rb