<commit_before>RSpec.describe "expect { ... }.to raise_error" do
  it_behaves_like("an RSpec matcher", :valid_value => lambda { raise "boom" },
                                      :invalid_value => lambda { }) do
    let(:matcher) { raise_error Exception }
  end

  it "passes if anything is raised" do
    expect { raise "error" }.to raise_error "error"
  end

  it "issues a warning when used without an error class or message" do
    expect_warning_with_call_site __FILE__, __LINE__+1, /without providing a specific error/
    expect { raise }.to raise_error
  end

  it "can supresses the warning when configured to do so" do
    original_value = RSpec::Expectations.configuration.warn_about_false_positives?
    begin
      RSpec::Expectations.configuration.warn_about_false_positives = false
      expect { raise }.to raise_error
    ensure
      RSpec::Expectations.configuration.warn_about_false_positives = original_value
    end
  end

  it 'does not issue a warning when an exception class is specified (even if it is just `Exception`)' do
    expect { raise "error" }.to raise_error Exception
  end

  it 'does not issue a warning when a message is specified' do
    expect { raise "error" }.to raise_error "error"
  end

  it 'does not issue a warning when a block is passed' do
    expect { raise "error" }.to raise_error { |_| }
  end

  it "passes if an error instance is expected" do
    s = StandardError.new
    expect {raise s}.to raise_error(s)
  end

  it 'passes if an error instance with a non string message is raised' do
    special_error =
      Class.new(StandardError) do
        def initialize(message)
          @message = message
        end

        def message
          self
        end

        def to_s
          @message
        end
      end
    s = special_error.new 'Stringlike'
    expect { raise s }.to raise_error('Stringlike')
  end
<commit_msg>add expectation for no warnings<commit_after>RSpec.describe "expect { ... }.to raise_error" do
  it_behaves_like("an RSpec matcher", :valid_value => lambda { raise "boom" },
                                      :invalid_value => lambda { }) do
    let(:matcher) { raise_error Exception }
  end

  it "passes if anything is raised" do
    expect { raise "error" }.to raise_error "error"
  end

  it "issues a warning when used without an error class or message" do
    expect_warning_with_call_site __FILE__, __LINE__+1, /without providing a specific error/
    expect { raise }.to raise_error
  end

  it "can supresses the warning when configured to do so" do
    original_value = RSpec::Expectations.configuration.warn_about_false_positives?
    begin
      RSpec::Expectations.configuration.warn_about_false_positives = false
      expect_no_warnings
      expect { raise }.to raise_error
    ensure
      RSpec::Expectations.configuration.warn_about_false_positives = original_value
    end
  end

  it 'does not issue a warning when an exception class is specified (even if it is just `Exception`)' do
    expect_no_warnings
    expect { raise "error" }.to raise_error Exception
  end

  it 'does not issue a warning when a message is specified' do
    expect_no_warnings
    expect { raise "error" }.to raise_error "error"
  end

  it 'does not issue a warning when a block is passed' do
    expect_no_warnings
    expect { raise "error" }.to raise_error { |_| }
  end

  it "passes if an error instance is expected" do
    s = StandardError.new
    expect {raise s}.to raise_error(s)
  end

  it 'passes if an error instance with a non string message is raised' do
    special_error =
      Class.new(StandardError) do
        def initialize(message)
          @message = message
        end

        def message
          self
        end

        def to_s
          @message
        end
      end
    s = special_error.new 'Stringlike'
    expect { raise s }.to raise_error('Stringlike')
  end

{'fraction_non_alphanumeric': 0.07032854209445585, 'fraction_numerical': 0.000513347022587269, 'mean_word_length': 2.7220630372492836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3219109', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1118, 'n_words': 414}