require 'spec_helper' require 'magic_reveal/index_libber' describe MagicReveal::IndexLibber do subject { described_class.new html_text } let(:html_text) { nil } describe ".set_meta" do shared_examples "it is passed a name and content" do let(:name) { "name#{rand 99}" } let(:content) { "any old content ###{rand 99}" } it "creates the node" do subject.set_meta name, content node = subject.html.at_css("meta[@name=#{name}]") expect(node).to_not be_nil content_attr = node[:content] expect(content_attr).to eq(content) end end context "with a html > meta node" do let(:html_text) { "
text" } it_behaves_like "it is passed a name and content" end context "with a html > head > meta node" do let(:html_text) { "
text" } it_behaves_like "it is passed a name and content" end context "without a meta node" do let(:html_text) { '
text' }
it_behaves_like "it is passed a name and content"
end
end
describe ".author=" do
it "calls set_meta" do
author = Faker::Name.name
subject.should_receive(:set_meta).with('author', author)
subject.author = author
end
end
describe ".description=" do
it "calls set_meta" do
description = Faker::Lorem.paragraph
subject.should_receive(:set_meta).with('description', description)
subject.description = description
end
end
describe ".slides=" do
let(:title) { Faker::Lorem.sentence }
let(:paragraph) { Faker::Lorem.paragraph }
let(:slides) { " #{paragraph}#{title}