Created
July 13, 2016 22:07
-
-
Save ma11hew28/cdb76677ac4a76a4414bc566bf54d15c to your computer and use it in GitHub Desktop.
Rack::Test Issue: Body shouldn't be a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App | |
def call(env) | |
[200, {'Content-Type' => 'text/plain'}, "Hello, World!"] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './app' | |
run App.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './app' | |
require 'minitest/autorun' | |
require 'rack/test' | |
class AppTest < MiniTest::Test | |
include Rack::Test::Methods | |
def app | |
App.new | |
end | |
def test_body | |
get '/' | |
assert_equal "Hello, World!", last_response.body | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment