Sha256: 6d788bf4269d65ae3f9b862fd4ca562f296ecf7badeb80d5873b395451d047a7

Contents?: true

Size: 1.43 KB

Versions: 23

Compression:

Stored size: 1.43 KB

Contents

describe Devtools::Project::Initializer::Rspec do
  let(:spec_root)         { Devtools.root.join('spec') }
  let(:unit_test_timeout) { instance_double(Float)     }

  let(:project) do
    instance_double(
      Devtools::Project,
      spec_root: spec_root,
      devtools:  instance_double(
        Devtools::Config::Devtools,
        unit_test_timeout: unit_test_timeout
      )
    )
  end

  describe '.call' do
    subject do
      described_class.call(project)
    end

    it 'performs expected rspec initialization' do
      called = false
      example = -> { called = true }

      expect(Dir).to receive(:glob)
        .with(Devtools.root.join('shared/spec/{shared,support}/**/*.rb'))
        .and_return(%w[shared-a shared-b])

      expect(Kernel).to receive(:require).with('shared-a')
      expect(Kernel).to receive(:require).with('shared-b')

      expect(Dir).to receive(:glob)
        .with(Devtools.root.join('spec/{shared,support}/**/*.rb'))
        .and_return(%w[support-a support-b])

      expect(Kernel).to receive(:require).with('support-a')
      expect(Kernel).to receive(:require).with('support-b')

      expect(Timeout).to receive(:timeout).with(unit_test_timeout) do |&block|
        block.call
      end

      expect(RSpec.configuration).to receive(:around)
        .with(file_path: %r{\bspec/unit/})
        .and_yield(example)

      expect(subject).to be(described_class)

      expect(called).to be(true)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
devtools-0.1.26 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.25 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.24 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.23 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.22 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.21 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.20 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.19 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.18 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.16 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.15 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.14 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.13 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.12 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.11 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.10 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.9 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.8 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.7 spec/unit/devtools/project/initializer/rspec_spec.rb
devtools-0.1.6 spec/unit/devtools/project/initializer/rspec_spec.rb