Sha256: cf1929214b6a9b860288bb0b40c5c5e8bb7d814745444ca8ea990a286b956303

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require "rubygems"
require "ruby-debug"
gem 'test-unit'
require "test/unit"
require 'active_support'
require 'active_support/test_case'
require 'active_record'
require 'active_record/fixtures'
require 'shoulda'
require 'shoulda/active_record'

this = File.expand_path(File.dirname(__FILE__))
require File.expand_path(File.join(this, '/../lib/crawlable'))

Dir["#{this}/lib/*"].each { |c| require c if File.extname(c) == ".rb" }
require File.expand_path(File.join(File.dirname(__FILE__), '/../lib/crawlable'))

ActiveRecord::Base.class_eval do
  def self.detonate
    all.map(&:destroy)
  end
end

ActiveSupport::TestCase.class_eval do
  
  def create_posts(many = 10)
    many.times do |i|
      Post.create!(:title => "title-#{i.to_s}")
    end
  end
  
  def load_sitemap
    Sitemap "http://www.example.com" do
      ping :yahoo, :google
      
      link "/posts", :priority => 0.7, :changes => 'daily' do
        3.times do |i|
          image "/images/#{i}"
        end
      end
      
      Post.all.each do |a|
        link "/posts/#{a.to_param}", :updated_at => a.updated_at
      end
    end
  end
  
  def load_feed
    Feed do
      posts do
        title "My RSS Feed"
        author "Lance Pollard"
        description "Something nice and tidy"
        
        Post.all.each do |a|
          entry "/posts/#{a.to_param}", :updated_at => a.updated_at, :title => a.title
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crawlable-0.0.1.7 test/test_helper.rb
crawlable-0.0.1.6 test/test_helper.rb