Sha256: 226cf2c56bd19f3dd98219873b6628e9966a9d14fb8487bacb186c45f3d8b7eb
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'spec_helper' describe WP2Middleman::Migrator do def post(attributes = {}) defaults = {title: "mytitle", date_time_published: "mydate", tags: "mytags", published?: false} @post ||= double(defaults.merge attributes) end it "includes the title, date, and tags from the post" do frontmatter = WP2Middleman::Frontmatter.new(post).post_data expect(frontmatter["title"]).to eq("mytitle") expect(frontmatter["date"]).to eq("mydate") expect(frontmatter["tags"]).to eq("mytags") end it "sets published to false for unpublished posts" do frontmatter = WP2Middleman::Frontmatter.new(post).post_data expect(frontmatter["published"]).to be_falsey end it "sets published to nil for published posts" do frontmatter = WP2Middleman::Frontmatter.new(post published?: true).post_data expect(frontmatter["published"]).to be_nil end it "includes fields specified in include_fields" do allow(post).to receive(:field).with("field1") { "value1" } allow(post).to receive(:field).with("field2") { "value2" } frontmatter = WP2Middleman::Frontmatter.new(post, include_fields: ["field1", "field2"]).post_data expect(frontmatter["field1"]).to eq("value1") expect(frontmatter["field2"]).to eq("value2") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wp2middleman-0.0.3 | spec/lib/wp2middleman/frontmatter_spec.rb |