<commit_before>require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe CallbackWrapper do

  it "should have some specs"
  
end<commit_msg>callback wrapper specced<commit_after>require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe CallbackWrapper do

  describe "matches widget?" do

    it "should return false if widget name is not contained in method name" do
      method = stub(:name => "bau!!")
      result = CallbackWrapper.new(method).matches_widget?(stub(:name => "my_name"))
      result.should == false
    end

    it "should return true if widget name is after event name" do
      method = stub(:name => "on_test_my_name")
      result = CallbackWrapper.new(method).matches_widget?(stub(:name => "my_name"))
      result.should == false
    end

    it "should return true if widget name is before on" do
      method = stub(:name => "my_name_on_test")
      result = CallbackWrapper.new(method).matches_widget?(stub(:name => "my_name"))
      result.should == true
    end

    it "should return true if widget name is after on" do
      method = stub(:name => "on_my_name_test")
      result = CallbackWrapper.new(method).matches_widget?(stub(:name => "my_name"))
      result.should == true
    end

  end

  describe "event name" do

    it "should return tokens after widget name" do
      method = stub(:name => "on_my_name_test")
      result = CallbackWrapper.new(method).event_name(stub(:name => "my_name"))
      result.should == "test"
    end

    it "should replace _ with - " do
      method = stub(:name => "on_my_name_test_event")
      result = CallbackWrapper.new(method).event_name(stub(:name => "my_name"))
      result.should == "test-event"
    end
  end

end
{'fraction_non_alphanumeric': 0.12514285714285714, 'fraction_numerical': 0.0, 'mean_word_length': 3.3775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3623865', 'n_tokens_mistral': 528, 'n_tokens_neox': 526, 'n_words': 145}