<commit_before>class Shoulda::Context
  def execute(&execute_block)
    setup do
      @execute_block = execute_block
    end
  end

  alias :should_without_execute :should

  def should(name = nil, options = {}, &block)
    if block.nil?
      should_without_execute(name, options)
    else
      should_without_execute(name, options) do
        if @execute_block
          puts self
          self.instance_variable_set('@execute_result', Shoulda::Context.shoulda_execute_call_block(self, @execute_block))
        end
        Shoulda::Context.shoulda_execute_call_block(self, block)
      end
    end
  end
  
  def self.shoulda_execute_call_block(test, block)
    if should_execute_shared_should_available?
      test.call_block_with_shared_value(block)
    else
      block.bind(test).call
    end
  end
  
  def self.should_execute_shared_should_available?
    Test::Unit::TestCase.respond_to? :share_context
    true
  end
end
<commit_msg>Fixed detection of shared_should<commit_after>class Shoulda::Context
  def execute(&execute_block)
    setup do
      @execute_block = execute_block
    end
  end

  alias :should_without_execute :should

  def should(name = nil, options = {}, &block)
    if block.nil?
      should_without_execute(name, options)
    else
      should_without_execute(name, options) do
        if @execute_block
          puts self
          self.instance_variable_set('@execute_result', Shoulda::Context.shoulda_execute_call_block(self, @execute_block))
        end
        Shoulda::Context.shoulda_execute_call_block(self, block)
      end
    end
  end
  
  def self.shoulda_execute_call_block(test, block)
    if should_execute_shared_should_available?
      test.call_block_with_shared_value(block)
    else
      block.bind(test).call
    end
  end
  
  def self.should_execute_shared_should_available?
    Test::Unit::TestCase.respond_to? :share_context
  end
end

{'fraction_non_alphanumeric': 0.07473684210526316, 'fraction_numerical': 0.0, 'mean_word_length': 3.410672853828306, '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': '7520427', 'n_tokens_mistral': 589, 'n_tokens_neox': 586, 'n_words': 114}