<commit_before>Feature: configure expectation framework

  By default, RSpec is configured to include rspec-expectations for expressing
  desired outcomes. You can also configure RSpec to use:

  * rspec/expectations (explicitly)
  * test/unit assertions
  * minitest assertions
  * any combination of the above libraries

  Note that when you do not use rspec-expectations, you must explicitly provide
  a description to every example. You cannot rely on the generated descriptions
  provided by rspec-expectations.

  Scenario: Default configuration uses rspec-expectations
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec::Matchers.define :be_a_multiple_of do |factor|
        match do |actual|
          actual % factor == 0
        end
      end

      RSpec.describe 6 do
        it { is_expected.to be_a_multiple_of 3 }
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

  Scenario: Configure rspec-expectations (explicitly)
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :rspec
      end

      RSpec.describe 5 do
        it "is greater than 4" do
          expect(5).to be > 4
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

  Scenario: Configure test/unit assertions
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :test_unit
      end

      RSpec.describe [1] do
        it "is equal to [1]" do
          assert_equal [1], [1], "expected [1] to equal [1]"
        end

        specify { assert_not_equal [1], [] }

        it "is equal to [2] (intentional failure)" do
          assert [1] == [2], "errantly expected [2] to equal [1]"
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the output should match:
      """
           (Test::Unit::AssertionFailedError|Mini(T|t)est::Assertion):
             errantly expected \[2\] to equal \[1\]
      """
    And  the output should contain "3 examples, 1 failure"

  Scenario: Configure minitest assertions
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :minitest
      end

      RSpec.describe "Object identity" do
        it "the an object is the same as itself" do
          x = [1]
          assert_same x, x, "expected x to be the same x"
        end

        specify { refute_same [1], [1] }

        it "is empty (intentional failure)" do
          assert_empty [1], "errantly expected [1] to be empty"
        end
      end
      """
    When I run `rspec -b example_spec.rb`
    Then the output should match:
      """
           MiniT|test::Assertion:
             errantly expected \[1\] to be empty
      """
    And  the output should contain "3 examples, 1 failure"
    And  the output should not contain "Warning: you should require 'minitest/autorun' instead."

  Scenario: Configure rspec/expectations AND test/unit assertions
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :rspec, :test_unit
      end

      RSpec.describe [1] do
        it "is equal to [1]" do
          assert_equal [1], [1], "expected [1] to equal [1]"
        end

        it "matches array [1]" do
          is_expected.to match_array([1])
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

  Scenario: Configure rspec/expecations AND minitest assertions<commit_msg>Fix typo: expecations -> expectations<commit_after>Feature: configure expectation framework

  By default, RSpec is configured to include rspec-expectations for expressing
  desired outcomes. You can also configure RSpec to use:

  * rspec/expectations (explicitly)
  * test/unit assertions
  * minitest assertions
  * any combination of the above libraries

  Note that when you do not use rspec-expectations, you must explicitly provide
  a description to every example. You cannot rely on the generated descriptions
  provided by rspec-expectations.

  Scenario: Default configuration uses rspec-expectations
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec::Matchers.define :be_a_multiple_of do |factor|
        match do |actual|
          actual % factor == 0
        end
      end

      RSpec.describe 6 do
        it { is_expected.to be_a_multiple_of 3 }
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

  Scenario: Configure rspec-expectations (explicitly)
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :rspec
      end

      RSpec.describe 5 do
        it "is greater than 4" do
          expect(5).to be > 4
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

  Scenario: Configure test/unit assertions
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :test_unit
      end

      RSpec.describe [1] do
        it "is equal to [1]" do
          assert_equal [1], [1], "expected [1] to equal [1]"
        end

        specify { assert_not_equal [1], [] }

        it "is equal to [2] (intentional failure)" do
          assert [1] == [2], "errantly expected [2] to equal [1]"
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the output should match:
      """
           (Test::Unit::AssertionFailedError|Mini(T|t)est::Assertion):
             errantly expected \[2\] to equal \[1\]
      """
    And  the output should contain "3 examples, 1 failure"

  Scenario: Configure minitest assertions
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :minitest
      end

      RSpec.describe "Object identity" do
        it "the an object is the same as itself" do
          x = [1]
          assert_same x, x, "expected x to be the same x"
        end

        specify { refute_same [1], [1] }

        it "is empty (intentional failure)" do
          assert_empty [1], "errantly expected [1] to be empty"
        end
      end
      """
    When I run `rspec -b example_spec.rb`
    Then the output should match:
      """
           MiniT|test::Assertion:
             errantly expected \[1\] to be empty
      """
    And  the output should contain "3 examples, 1 failure"
    And  the output should not contain "Warning: you should require 'minitest/autorun' instead."

  Scenario: Configure rspec/expectations AND test/unit assertions
    Given a file named "example_spec.rb" with:
      """ruby
      RSpec.configure do |config|
        config.expect_with :rspec, :test_unit
      end

      RSpec.describe [1] do
        it "is equal to [1]" do
          assert_equal [1], [1], "expected [1] to equal [1]"
        end

        it "matches array [1]" do
          is_expected.to match_array([1])
        end
      end
      """
    When I run `rspec example_spec.rb`
    Then the examples should all pass

  Scenario: Configure rspec/expectations AND minitest assertions
{'fraction_non_alphanumeric': 0.0836413415468857, 'fraction_numerical': 0.010677618069815195, 'mean_word_length': 2.25, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5147668', 'n_tokens_mistral': 2196, 'n_tokens_neox': 2105, 'n_words': 798}