<commit_before>require 'spec_helper'

describe ElectricSheep::Resources::Resource do
  include Support::Options

  it {
    defines_options :host
    requires :host
  }
end<commit_msg>Add missing spec for timestamp creation<commit_after>require 'spec_helper'

describe ElectricSheep::Resources::Resource do
  include Support::Options

  it {
    defines_options :host
    requires :host
  }

  let(:origin){ mock }

  it 'uses original timestamp if any' do
    ts=Time.now.utc.strftime('%Y%m%d-%H%M%S')
    origin.expects(:timestamp?).returns(true)
    origin.expects(:timestamp).returns(ts)
    subject.new.tap do |resource|
      resource.timestamp!(origin)
      resource.timestamp.must_equal ts
    end
  end

  it 'creates a new timestamp' do
    Timecop.travel(Timecop.travel Time.utc(2014, 6, 5, 4, 3, 2)) do
      origin.expects(:timestamp?).returns(false)
      subject.new.tap do |resource|
        resource.timestamp!(origin)
        resource.timestamp.must_equal '20140605-040302'
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10980392156862745, 'fraction_numerical': 0.022549019607843137, 'mean_word_length': 3.599099099099099, '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': '2227297', 'n_tokens_mistral': 346, 'n_tokens_neox': 316, 'n_words': 74}