Sha256: c98460ea26a5d6ea721752904e34ea15fc4584145d9696631f08e0738a24a721

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'
load "ro_commands/post_handler.rb"

describe "PostHandler" do
  let(:o) do
    ::RoCommands::PostCell.new
  end

  before do
    cdfix "post_handler"

    ENV["RAILS_ENV"] ||= 'development'

    RoFaker.flow do |f|
      f.f 'posts/error/test.md', <<-CONTENT
      	# a test markdown file
      CONTENT

      f.f 'posts/rails/test.html', <<-CONTENT
<html>
<head>
  <title>cannot determine build data storage root for project</title>
  <basefont face="Tahoma" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="Evernote Windows/269614 (zh-CN); Windows/5.1.2600 Service Pack 3;"/>
  <style>
    body, td {
      font-family: Tahoma;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="15775"/>
<h1>cannot determine build data storage root for project</h1>

<div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>reason: i use bash &quot;idea .&quot;<br>solution: <br>1. use idea (grace accent pwd grace accent)<br>2. use bash &quot;idea&quot; and open project with idea ui<br> </div></div>
</div></body></html>
      CONTENT
      allow(::Rails).to receive(:root).with(any_args).and_return(Dir.pwd)
      allow(o).to receive(:post_create).with(any_args).and_return(true)
    end
  end

  after do
    ENV['RAILS_ENV'] = "test"
  end

  %w(posts/error/test.md posts/rails/test.html).each do |path|
    it "#handle_single #{path}" do
      result = o.send(:"handle_single", path)
    end
  end

  it "#handle_html" do
    result = o.send(:"handle_html", File.join(Dir.pwd, 'posts/error/test.md'))
  end

  it "#handle" do
    result = ::RoCommands::PostHandler.new.send(:"handle" )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rrjj-0.0.1 spec/lib/ro_commands/post_handler_spec.rb