Sha256: 3c0fb03cddc538e5046e128ffd58f2a6a88c6796caf6efcdfc5fe255d226b7ec

Contents?: true

Size: 1.58 KB

Versions: 3

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'

module Cucumber
  describe Runtime do
    subject { Runtime.new(options) }
    let(:options) { {} }

    describe "#features_paths" do
      let(:options) { {:paths => ['foo/bar/baz.feature', 'foo/bar/features/baz.feature', 'other_features'] } }

      it "returns the value from configuration.paths" do
        expect(subject.features_paths).to eq options[:paths]
      end
    end

    describe "#configure" do
      let(:support_code)      { double(Runtime::SupportCode).as_null_object }
      let(:results)           { double(Runtime::Results).as_null_object     }
      let(:new_configuration) { double('New configuration')}

      before(:each) do
        allow(Runtime::SupportCode).to receive(:new) { support_code }
        allow(Runtime::Results).to receive(:new) { results }
      end

      it "tells the support_code and results about the new configuration" do
        expect(support_code).to receive(:configure).with(new_configuration)
        expect(results).to receive(:configure).with(new_configuration)

        subject.configure(new_configuration)
      end

      it "replaces the existing configuration" do
        # not really sure how to test this. Maybe we should just expose
        # Runtime#configuration with an attr_reader?
        some_new_paths = ['foo/bar', 'baz']

        allow(new_configuration).to receive(:paths) { some_new_paths }

        subject.configure(new_configuration)

        expect(subject.features_paths).to eq some_new_paths
      end

      it '#doc_string' do
        expect(subject.doc_string('Text')).to eq 'Text'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber-2.0.0.beta.3 spec/cucumber/runtime_spec.rb
cucumber-2.0.0.beta.2 spec/cucumber/runtime_spec.rb
cucumber-2.0.0.beta.1 spec/cucumber/runtime_spec.rb