Sha256: aadfde32003a119830cd3dbc3800f1312b7bc64e0aa14ed41cc643309b6c562c

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'
require './lib/wordpress/tag'
require './lib/wordpress/blog'

module Contentful
  module Exporter
    module Wordpress
      describe Tag do
        include_context 'shared_configuration'

        before do
          xml_doc = Nokogiri::XML(File.open('spec/fixtures/wordpress.xml'))
          @tag = Tag.new(xml_doc, @settings)
        end

        it 'initialize' do
          expect(@tag.settings).to be_kind_of Contentful::Configuration
          expect(@tag.xml).to be_kind_of Nokogiri::XML::Document
        end

        it 'extract_tags' do
          tags = @tag.send(:extract_tags)
          expect(tags).to be_kind_of Array
          expect(tags.count).to eq 2
          expect(tags.first).to include(id: 'tag_2656354', nicename: 'testowy', name: 'testowy')
          expect(tags.last).to include(id: 'tag_306830130', nicename: 'testowy2', name: 'testowy2')
        end

        it 'extracted_data' do
          tags_xml = @tag.xml.xpath('//wp:tag').to_a
          tag = @tag.send(:extracted_data, tags_xml.first)
          expect(tag).to be_kind_of Hash
          expect(tag.count).to eq 3
          expect(tag).to include(id: 'tag_2656354', nicename: 'testowy', name: 'testowy')
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wordpress-exporter-0.2.0 spec/lib/wordpress/tag_spec.rb
wordpress-exporter-0.1.0 spec/lib/wordpress/tag_spec.rb
wordpress-exporter-0.0.2 spec/lib/wordpress/tag_spec.rb
wordpress-exporter-0.0.1 spec/lib/wordpress/tag_spec.rb