<commit_before>require 'rspec/given'
require 'rspec/given/natural_assertion'

describe "Natural Assertions" do
  Given(:foo) { 1 }
  Given(:expected) { 2 }
  Given(:ary) { [1] }
  Given(:empty) { [] }
  Given(:null) { nil }
  Then { foo+foo+2*foo == expected }
  Then { nil == "HI" && true && :symbol  && 1}
  Then { foo.should == 2 }
  Then { foo != 1 }
  Then { foo.should_not == 1 }
  Then { foo.should_not be_nil }
  Then { ary.empty? }
  Then { true }
  And  { !null.nil? }
  Then { fail "OUCH" }
  Then { ! empty.empty? }
  Then {
    (puts "Ha ha world", ! true)
  }

  context "Incorrect non-idempotent conditions" do
    Given(:ary) { [1, 2, 3] }
    Then { ary.delete(1) == nil }
  end

  context "Correct idempotent conditions" do
    Given(:ary) { [1, 2, 3] }
    When(:result) { ary.delete(1) }
    Then { result == nil }
  end
end<commit_msg>Improve failing spec examples.<commit_after>require 'rspec/given'
require 'rspec/given/natural_assertion'

describe "Natural Assertions" do
  use_natural_assertions

  Given(:foo) { 1 }
  Given(:expected) { 2 }
  Given(:ary) { [1] }
  Given(:empty) { [] }
  Given(:null) { nil }
  Then { foo+foo+2*foo == expected }
  Then { nil == "HI" && true && :symbol  && 1}
  Then { foo.should == 2 }
  Then { foo != 1 }
  Then { foo.should_not == 1 }
  Then { foo.should be_nil }
  Then { ary.empty? }
  Then { !null.nil? }
  Then { fail "OUCH" }
  Then { ! empty.empty? }
  Then {
    (puts "Ha ha world", ! true)
  }

  context "Incorrect non-idempotent conditions" do
    Given(:ary) { [1, 2, 3] }
    Then { ary.delete(1) == nil }
  end

  context "Correct idempotent conditions" do
    Given(:ary) { [1, 2, 3] }
    When(:result) { ary.delete(1) }
    Then { result == nil }
  end
end
{'fraction_non_alphanumeric': 0.17002881844380405, 'fraction_numerical': 0.018443804034582133, 'mean_word_length': 2.8577777777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6633218', 'n_tokens_mistral': 700, 'n_tokens_neox': 653, 'n_words': 169}