Sha256: f4b0ad32fb343446aade45ddf7e18d30059037476f9aff12b5e30beaaf4c4081

Contents?: true

Size: 1.63 KB

Versions: 46

Compression:

Stored size: 1.63 KB

Contents

Feature: treat symbols as metadata keys with true values

  Use the treat_symbols_as_metadata_keys_with_true_values option to tell RSpec that :key is shorthand for :key => true.

    RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = true }

  Background:
    Given a file named "spec/spec_helper.rb" with:
      """ruby
      RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = true }
      """

  Scenario: by default, symbols without values are ignored and the specs are filtered out
    Given a file named "spec/example_spec.rb" with:
      """ruby
      describe "failed filtering" do
        it "this will be filted out", :some_tag do
          true
        end

        it "so will this" do
          false
        end
      end
      """
      When I run `rspec spec/example_spec.rb --tag some_tag`
      Then the output should contain "0 examples, 0 failures"
      And the output should contain "All examples were filtered out"

  Scenario: when treat_symbols_as_metadata_keys_with_true_values is true, specs can be tagged with only a symbol
    Given a file named "spec/example_spec.rb" with:
      """ruby
      require "spec_helper"
      describe "run me", :some_tag do
        it "runs" do
          true
        end
      end

      describe "run one of these" do
        it "run this one", :some_tag do
          true
        end

        it "but not me" do
          false
        end
      end
      """
      When I run `rspec spec/example_spec.rb --tag some_tag`
      Then the output should contain "2 examples, 0 failures"
      And the output should contain "Run options: include {:some_tag=>true}"

Version data entries

46 entries across 46 versions & 12 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-core-2.14.8/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rspec-core-2.13.0/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.99.2 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.99.1 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.99.0 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.99.0.rc1 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.8 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.99.0.beta2 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature