Sha256: 06231a89d9c940c6f759120752036038633b214df3672dc96d29dd457b734f80

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

RSpec.shared_examples_for "metadata hash builder" do
  let(:hash) { metadata_hash(:foo, :bar, :bazz => 23) }

  it 'treats symbols as metadata keys with a true value' do
    expect(hash[:foo]).to be(true)
    expect(hash[:bar]).to be(true)
  end

  it 'still processes hash values normally' do
    expect(hash[:bazz]).to be(23)
  end
end

RSpec.shared_examples_for "handling symlinked directories when loading spec files" do
  include_context "isolated directory"
  let(:project_dir) { Dir.getwd }

  it "finds the files" do
    foos_dir = File.join(project_dir, "spec/foos")
    FileUtils.mkdir_p foos_dir
    FileUtils.touch(File.join(foos_dir, "foo_spec.rb"))

    bars_dir = File.join(Dir.tmpdir, "shared/spec/bars")
    FileUtils.mkdir_p bars_dir
    FileUtils.touch(File.join(bars_dir, "bar_spec.rb"))

    FileUtils.ln_s bars_dir, File.join(project_dir, "spec/bars")

    expect(loaded_files).to contain_files(
      "spec/bars/bar_spec.rb",
      "spec/foos/foo_spec.rb"
    )
  end

  it "works on a more complicated example (issue 1113)" do
    FileUtils.mkdir_p("subtrees/DD/spec")
    FileUtils.mkdir_p("spec/lib")
    FileUtils.touch("subtrees/DD/spec/dd_foo_spec.rb")
    FileUtils.ln_s(File.join(project_dir, "subtrees/DD/spec"), "spec/lib/DD")

    expect(loaded_files).to contain_files("spec/lib/DD/dd_foo_spec.rb")
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
opal-rspec-0.6.2 rspec-core/spec/support/shared_example_groups.rb
opal-rspec-0.6.1 rspec-core/spec/support/shared_example_groups.rb
opal-rspec-0.6.0 rspec-core/spec/support/shared_example_groups.rb
opal-rspec-0.6.0.beta1 rspec-core/spec/support/shared_example_groups.rb
opal-connect-rspec-0.5.0 rspec-core/spec/support/shared_example_groups.rb
opal-rspec-0.5.0 rspec-core/spec/support/shared_example_groups.rb
opal-rspec-0.5.0.beta3 rspec-core/spec/support/shared_example_groups.rb
opal-rspec-0.5.0.beta2 rspec-core/spec/support/shared_example_groups.rb
opal-rspec-0.5.0.beta1 rspec-core/spec/support/shared_example_groups.rb