Sha256: b2328c4af4e3dee266978d236b63f9410057cd10584449e91cad57677320b780

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

require "nwiki"
require "test/unit"
require "rack/test"

class RequestTest < Test::Unit::TestCase
  include ::Rack::Test::Methods

  def app
    Nwiki::Frontend::App.new "spec/examples/sample.git"
  end

  sub_test_case %Q(Get "/") do
    setup do
      get "/"
    end

    test "response is ok" do
      assert last_response.ok?
    end

    test "includes title" do
      title = "ヽ(´・肉・`)ノログ"
      assert do
        last_response.body.include? title
      end
    end

    test "includes subtitle" do
      subtitle = "How do we fighting without fighting?"
      assert do
        last_response.body.include? subtitle
      end
    end
  end

  sub_test_case %Q(Get "/articles/") do
    setup do
      get "/articles/"
    end

    test "response is ok" do
      assert do
        last_response.ok?
      end
    end

    test "charset is UTF-8" do
      assert do
        last_response["Content-Type"].include? "charset=UTF-8"
      end
    end

    data("contains foo" => "foo",
         "contains 1" => "1",
         "contains 日本語ディレクトリ" => "日本語ディレクトリ")
    def test_body_include?(data)
      expected = data
      assert do
        last_response.body.include? expected
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nwiki-0.3.3 test/test_request.rb
nwiki-0.3.2 test/test_request.rb
nwiki-0.3.1 test/test_request.rb
nwiki-0.3.0 test/test_request.rb
nwiki-0.2.11 test/test_request.rb
nwiki-0.2.10 test/test_request.rb