Sha256: 0e1940f86291faf4c670f93595861c38f4a04512d962ec964a8ad40d80cf2990

Contents?: true

Size: 987 Bytes

Versions: 3

Compression:

Stored size: 987 Bytes

Contents

require File.expand_path('../../../helper', __FILE__)
require 'rdiscount'

describe "Zen::Controller::Preview" do
  behaves_like :capybara

  it('Convert Markdown to HTML via a POST request') do
    markdown = 'Hello, **world**'
    response = page.driver.post(
      '/admin/preview', :engine => 'markdown', :markup => markdown
    )

    response.body.strip.should == '<p>Hello, <strong>world</strong></p>'
    response.status.should     == 200
  end

  it('Convert an non existing markup type using a POST request') do
    response = page.driver.post(
      '/admin/preview', :engine => 'foobar', :markup => 'foobar'
    )

    response.body.strip.should == lang('zen_general.errors.invalid_request')
    response.status.should     == 400
  end

  it('Fail to convert markup without any POST parameters') do
    response = page.driver.post('/admin/preview')

    response.body.strip.should == lang('zen_general.errors.invalid_request')
    response.status.should     == 400
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zen-0.3 spec/zen/controller/preview.rb
zen-0.3b1 spec/zen/controller/preview.rb
zen-0.3b spec/zen/controller/preview.rb