Sha256: e1e01fd2caca5ee3b781e39b3ab0d112e5c71646a37ee5638eff010ea6b69bd9

Contents?: true

Size: 877 Bytes

Versions: 3

Compression:

Stored size: 877 Bytes

Contents

require "test_helper"

include Postly

class WordPressBlogImporter < Postly::BlogImporter
  
  def self.entity_map
    { :entry => "item", :body => "encoded", :title => "title" }
  end
  
  def self.process_body item
    CGI.unescapeHTML(item.css("encoded").to_s).gsub(/<encoded>|<\/encoded>|\]\]>/,"")
  end
  
  def self.handle_tags_for node
    node.css("category").css("category").collect \
    { |n| n.attributes["nicename"].text if n.attributes["nicename"].present?  }.compact!.join(",")
  end
  
end


class Postly::BlogImporterTest < Test::Unit::TestCase
  context "A Importer" do
    setup do
      @dir      = File.dirname(__FILE__) + '/fixtures'
      @wp_xml   = File.open("#{@dir}/wp.xml", 'r')
     # @imported = WordPressBlogImporter.import(@wp_xml.read, Site.last.id)
    end

    should "be an array" do
      #assert @imported.is_a? Array
    end
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
progressions-postly-0.2.2 test/test_importer.rb
postly-0.2.2 test/test_importer.rb
postly-0.2.1 test/test_importer.rb