Updated test dump and adapted specs
* We now have a second attachment, a simple text file
This commit is contained in:
		
							parent
							
								
									7550dfa164
								
							
						
					
					
						commit
						2581895c7c
					
				
							
								
								
									
										57
									
								
								spec/fixtures/wordpress_dump.xml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										57
									
								
								spec/fixtures/wordpress_dump.xml
									
									
									
									
										vendored
									
									
								
							@ -16,7 +16,7 @@
 | 
			
		||||
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
 | 
			
		||||
<!--    contained in this file into your site. -->
 | 
			
		||||
 | 
			
		||||
<!-- generator="WordPress/3.1.2" created="2011-06-05 15:27" -->
 | 
			
		||||
<!-- generator="WordPress/3.1.2" created="2011-06-06 17:36" -->
 | 
			
		||||
<rss version="2.0"
 | 
			
		||||
	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
 | 
			
		||||
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
 | 
			
		||||
@ -29,7 +29,7 @@
 | 
			
		||||
	<title>My test blog</title>
 | 
			
		||||
	<link>http://localhost/wordpress</link>
 | 
			
		||||
	<description>Just another WordPress site</description>
 | 
			
		||||
	<pubDate>Sun, 05 Jun 2011 15:27:27 +0000</pubDate>
 | 
			
		||||
	<pubDate>Mon, 06 Jun 2011 17:36:50 +0000</pubDate>
 | 
			
		||||
	<language>en</language>
 | 
			
		||||
	<wp:wxr_version>1.1</wp:wxr_version>
 | 
			
		||||
	<wp:base_site_url>http://localhost/wordpress</wp:base_site_url>
 | 
			
		||||
@ -69,6 +69,10 @@
 | 
			
		||||
		<wp:post_password></wp:post_password>
 | 
			
		||||
		<wp:is_sticky>0</wp:is_sticky>
 | 
			
		||||
		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
 | 
			
		||||
		<wp:postmeta>
 | 
			
		||||
			<wp:meta_key>_edit_last</wp:meta_key>
 | 
			
		||||
			<wp:meta_value><![CDATA[1]]></wp:meta_value>
 | 
			
		||||
		</wp:postmeta>
 | 
			
		||||
		<wp:comment>
 | 
			
		||||
			<wp:comment_id>1</wp:comment_id>
 | 
			
		||||
			<wp:comment_author><![CDATA[Mr WordPress]]></wp:comment_author>
 | 
			
		||||
@ -92,13 +96,9 @@
 | 
			
		||||
		<guid isPermaLink="false">http://localhost/wordpress/?page_id=2</guid>
 | 
			
		||||
		<description></description>
 | 
			
		||||
		<content:encoded><![CDATA[This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
 | 
			
		||||
 | 
			
		||||
<blockquote>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)</blockquote>
 | 
			
		||||
 | 
			
		||||
<blockquote>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)</blockquote>
 | 
			
		||||
...or something like this:
 | 
			
		||||
 | 
			
		||||
<blockquote>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickies to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.</blockquote>
 | 
			
		||||
 | 
			
		||||
As a new WordPress user, you should go to <a href="http://localhost/wordpress/wp-admin/">your dashboard</a> to delete this page and create new pages for your content. Have fun!]]></content:encoded>
 | 
			
		||||
		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
 | 
			
		||||
		<wp:post_id>2</wp:post_id>
 | 
			
		||||
@ -117,6 +117,10 @@ As a new WordPress user, you should go to <a href="http://localhost/wordpress/wp
 | 
			
		||||
			<wp:meta_key>_wp_page_template</wp:meta_key>
 | 
			
		||||
			<wp:meta_value><![CDATA[default]]></wp:meta_value>
 | 
			
		||||
		</wp:postmeta>
 | 
			
		||||
		<wp:postmeta>
 | 
			
		||||
			<wp:meta_key>_edit_last</wp:meta_key>
 | 
			
		||||
			<wp:meta_value><![CDATA[1]]></wp:meta_value>
 | 
			
		||||
		</wp:postmeta>
 | 
			
		||||
	</item>
 | 
			
		||||
	<item>
 | 
			
		||||
		<title>Second blog post </title>
 | 
			
		||||
@ -255,6 +259,8 @@ In hac  habitasse platea dictumst. Nunc quis tortor sed libero hendrerit  dapibu
 | 
			
		||||
		<description></description>
 | 
			
		||||
		<content:encoded><![CDATA[This is just a standard text page example. Lorem ipsum dolor sit amet,  consectetur adipiscing elit. Proin metus dolor, hendrerit sit amet,  aliquet nec, posuere sed, purus. Nullam et velit iaculis odio sagittis  placerat.
 | 
			
		||||
 | 
			
		||||
<a href="http://localhost/wordpress/wp-content/uploads/2011/05/cv.txt">This is my CV</a>, please download!
 | 
			
		||||
 | 
			
		||||
Duis metus tellus, pellentesque ut, luctus id, egestas a,  lorem. Praesent vitae mauris. Aliquam sed nulla. Sed id nunc vitae leo  suscipit <strong>viverra</strong>. Proin at leo ut lacus consequat rhoncus. In hac  habitasse platea dictumst. Nunc quis tortor sed libero hendrerit  dapibus.  Integer interdum purus id erat. Duis nec velit vitae dolor mattis  euismod.
 | 
			
		||||
 | 
			
		||||
Class aptent taciti sociosqu ad litora torquent per conubia  nostra, per inceptos himenaeos. Suspendisse pellentesque dignissim  lacus. Nulla semper euismod arcu. Suspendisse egestas, erat a  consectetur dapibus, felis orci cursus eros, et sollicitudin purus urna  et metus. Integer eget est sed nunc euismod vestibulum. Integer nulla  dui, tristique in, euismod et, interdum imperdiet, enim. Mauris at  lectus. Sed egestas tortor nec mi.]]></content:encoded>
 | 
			
		||||
@ -286,7 +292,7 @@ Class aptent taciti sociosqu ad litora torquent per conubia  nostra, per incepto
 | 
			
		||||
		<pubDate>Sun, 05 Jun 2011 15:26:51 +0000</pubDate>
 | 
			
		||||
		<dc:creator>admin</dc:creator>
 | 
			
		||||
		<guid isPermaLink="false">http://localhost/wordpress/wp-content/uploads/2011/05/200px-Tux.svg_.png</guid>
 | 
			
		||||
		<description>Tux, the Linux mascot</description>
 | 
			
		||||
		<description></description>
 | 
			
		||||
		<content:encoded><![CDATA[]]></content:encoded>
 | 
			
		||||
		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
 | 
			
		||||
		<wp:post_id>13</wp:post_id>
 | 
			
		||||
@ -310,6 +316,41 @@ Class aptent taciti sociosqu ad litora torquent per conubia  nostra, per incepto
 | 
			
		||||
			<wp:meta_key>_wp_attachment_metadata</wp:meta_key>
 | 
			
		||||
			<wp:meta_value><![CDATA[a:6:{s:5:"width";s:3:"200";s:6:"height";s:3:"235";s:14:"hwstring_small";s:22:"height='96' width='81'";s:4:"file";s:26:"2011/05/200px-Tux.svg_.png";s:5:"sizes";a:2:{s:9:"thumbnail";a:3:{s:4:"file";s:26:"200px-Tux.svg_-150x150.png";s:5:"width";s:3:"150";s:6:"height";s:3:"150";}s:14:"post-thumbnail";a:3:{s:4:"file";s:26:"200px-Tux.svg_-200x198.png";s:5:"width";s:3:"200";s:6:"height";s:3:"198";}}s:10:"image_meta";a:10:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";}}]]></wp:meta_value>
 | 
			
		||||
		</wp:postmeta>
 | 
			
		||||
		<wp:postmeta>
 | 
			
		||||
			<wp:meta_key>_wp_attachment_image_alt</wp:meta_key>
 | 
			
		||||
			<wp:meta_value><![CDATA[Tux, the Linux mascot]]></wp:meta_value>
 | 
			
		||||
		</wp:postmeta>
 | 
			
		||||
	</item>
 | 
			
		||||
	<item>
 | 
			
		||||
		<title>cv</title>
 | 
			
		||||
		<link>http://localhost/wordpress/?attachment_id=18</link>
 | 
			
		||||
		<pubDate>Mon, 06 Jun 2011 17:27:50 +0000</pubDate>
 | 
			
		||||
		<dc:creator>admin</dc:creator>
 | 
			
		||||
		<guid isPermaLink="false">http://localhost/wordpress/wp-content/uploads/2011/05/cv.txt</guid>
 | 
			
		||||
		<description></description>
 | 
			
		||||
		<content:encoded><![CDATA[]]></content:encoded>
 | 
			
		||||
		<excerpt:encoded><![CDATA[My CV]]></excerpt:encoded>
 | 
			
		||||
		<wp:post_id>18</wp:post_id>
 | 
			
		||||
		<wp:post_date>2011-06-06 17:27:50</wp:post_date>
 | 
			
		||||
		<wp:post_date_gmt>2011-06-06 17:27:50</wp:post_date_gmt>
 | 
			
		||||
		<wp:comment_status>open</wp:comment_status>
 | 
			
		||||
		<wp:ping_status>open</wp:ping_status>
 | 
			
		||||
		<wp:post_name>cv</wp:post_name>
 | 
			
		||||
		<wp:status>inherit</wp:status>
 | 
			
		||||
		<wp:post_parent>10</wp:post_parent>
 | 
			
		||||
		<wp:menu_order>0</wp:menu_order>
 | 
			
		||||
		<wp:post_type>attachment</wp:post_type>
 | 
			
		||||
		<wp:post_password></wp:post_password>
 | 
			
		||||
		<wp:is_sticky>0</wp:is_sticky>
 | 
			
		||||
		<wp:attachment_url>http://localhost/wordpress/wp-content/uploads/2011/05/cv.txt</wp:attachment_url>
 | 
			
		||||
		<wp:postmeta>
 | 
			
		||||
			<wp:meta_key>_wp_attached_file</wp:meta_key>
 | 
			
		||||
			<wp:meta_value><![CDATA[2011/05/cv.txt]]></wp:meta_value>
 | 
			
		||||
		</wp:postmeta>
 | 
			
		||||
		<wp:postmeta>
 | 
			
		||||
			<wp:meta_key>_wp_attachment_metadata</wp:meta_key>
 | 
			
		||||
			<wp:meta_value><![CDATA[a:0:{}]]></wp:meta_value>
 | 
			
		||||
		</wp:postmeta>
 | 
			
		||||
	</item>
 | 
			
		||||
</channel>
 | 
			
		||||
</rss>
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,8 @@ describe Refinery::WordPress::Attachment, :type => :model do
 | 
			
		||||
  let(:attachment) { test_dump.attachments.first }
 | 
			
		||||
 | 
			
		||||
  specify { attachment.title.should == '200px-Tux.svg' }
 | 
			
		||||
  specify { attachment.description.should == 'Tux, the Linux mascot' }
 | 
			
		||||
  # doesn't get exported atm. for some reason
 | 
			
		||||
  specify { attachment.description.should == '' }
 | 
			
		||||
  specify { attachment.url.should == 'http://localhost/wordpress/wp-content/uploads/2011/05/200px-Tux.svg_.png' }
 | 
			
		||||
  specify { attachment.file_name.should == '200px-Tux.svg_.png' }
 | 
			
		||||
  specify { attachment.post_date.should == DateTime.new(2011, 6, 5, 15, 26, 51) }
 | 
			
		||||
 | 
			
		||||
@ -77,7 +77,7 @@ describe Refinery::WordPress::Dump, :type => :model do
 | 
			
		||||
 | 
			
		||||
  describe "#attachments" do
 | 
			
		||||
    it "should return all attachments" do
 | 
			
		||||
      dump.attachments.should have(1).attachment
 | 
			
		||||
      dump.attachments.should have(2).attachments
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    specify { dump.attachments.first.should be_a(Refinery::WordPress::Attachment) }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user