Sha256: e004a8e98376370f731f8e8b94f555dd19858500eaf0678259b8eb2ab4c77acb

Contents?: true

Size: 736 Bytes

Versions: 7

Compression:

Stored size: 736 Bytes

Contents

require "spec_helper"

describe Stairs::Script do
  let(:filename) { "setup.rb" }
  subject { described_class.new(filename) }

  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 "#run!" do
      it "outputs running message" do
        output = capture_stdout { subject.run! }
        expect(output).to include "= Running script setup.rb"
      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

7 entries across 7 versions & 1 rubygems

Version Path
stairs-0.6.1 spec/lib/stairs/script_spec.rb
stairs-0.6.0 spec/lib/stairs/script_spec.rb
stairs-0.5.1 spec/lib/stairs/script_spec.rb
stairs-0.5.0 spec/lib/stairs/script_spec.rb
stairs-0.4.2 spec/lib/stairs/script_spec.rb
stairs-0.4.1 spec/lib/stairs/script_spec.rb
stairs-0.4.0 spec/lib/stairs/script_spec.rb