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

describe "Backdat::Link" do
  before(:each) do
    @link = Backdat::Link.new
  end

  after(:each) do
    @link = nil
  end

  it "should have a default name of `Link`" do
    @link.name.should eql("Link")
  end

  it "should support fall-thru parameter checking at initialization" do
    @link = Backdat::Link.new(:bleh => "awesome")
    @link.link_config(:bleh).should eql("awesome")
  end

  it "should support fall-thru parameter checking" do
    @link.link_config(:blehk).should eql(nil)
    Backdat::Config[:link_blehk] = "cool"
    @link.link_config(:blehk).should eql("cool")
    Backdat::Config.configuration.delete(:link_blehk)
  end

  it "should default to the `:files` format" do
    @link.format.should eql(:files)
  end

  it "should have nil as a default next" do
    @link.next.should eql(nil)
  end

  it "should have nil as a default before" do
    @link.before.should eql(nil)
  end
end
<commit_msg>Define interface for all links<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Backdat::Link" do
  before(:each) do
    @link = Backdat::Link.new
  end

  after(:each) do
    @link = nil
  end

  it "should have a default name of `Link`" do
    @link.name.should eql("Link")
  end

  it "should be able to check whether it is a source" do
    @link.is_source?.should eql(true)
    @link.is_target?.should eql(false)
  end

  it "should be able to check whether it is a target" do
    source = Backdat::Link.new
    source.next = @link
    @link.before = source
    source.is_source?.should eql(true)
    @link.is_target?.should eql(true)
  end

  it "should support fall-thru parameter checking at initialization" do
    @link = Backdat::Link.new(:bleh => "awesome")
    @link.link_config(:bleh).should eql("awesome")
  end

  it "should support fall-thru parameter checking" do
    @link.link_config(:blehk).should eql(nil)
    Backdat::Config[:link_blehk] = "cool"
    @link.link_config(:blehk).should eql("cool")
    Backdat::Config.configuration.delete(:link_blehk)
  end

  it "should default to the `:file` format" do
    @link.format.should eql(:file)
  end

  it "should have nil as a default next" do
    @link.next.should eql(nil)
  end

  it "should have nil as a default before" do
    @link.before.should eql(nil)
  end
end

{'fraction_non_alphanumeric': 0.1222689075630252, 'fraction_numerical': 0.0, 'mean_word_length': 3.58766859344894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6465499', 'n_tokens_mistral': 837, 'n_tokens_neox': 805, 'n_words': 232}