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
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
tuktuk-rails-0.0.9 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
tuktuk-rails-0.0.8 vendor/bundle/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
tuktuk-rails-0.0.7 vendor/bundle/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.2 spec/vendor/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
dxruby_rp5-0.0.1 spec/vendor/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/rspec-core-2.14.7/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.99.0.beta1 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.7 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.6 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
clickable_link-0.0.2 vendor/bundle/ruby/1.9.1/gems/rspec-core-2.14.5/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
syllable_counter-1.0.0 vendor/bundle/gems/rspec-core-2.14.5/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.5 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.4 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.3 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.2 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.1 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
rspec-core-2.14.0 features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
sshp-0.0.2 vendor/ruby/1.9.1/gems/rspec-core-2.13.1/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
sshp-0.0.1 vendor/ruby/1.9.1/gems/rspec-core-2.13.1/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature