diff options
Diffstat (limited to 'code/spyglass/test/sinatra_test.rb')
| -rw-r--r-- | code/spyglass/test/sinatra_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/code/spyglass/test/sinatra_test.rb b/code/spyglass/test/sinatra_test.rb new file mode 100644 index 0000000..0179413 --- /dev/null +++ b/code/spyglass/test/sinatra_test.rb @@ -0,0 +1,25 @@ +require 'helper' +require 'excon' + +class SinatraTest < MiniTest::Unit::TestCase + def setup + config_ru <<-RU + require 'sinatra' + + get '/zing' do + redirect 'http://example.com' + end + + run Sinatra::Application + RU + + spyglass + end + + def test_it_responds + response = Excon.get("http://0.0.0.0:#{PORT}/zing") + + assert_equal 302, response.status, "Didn't get the right response code" + assert_match /example/, response.headers['Location'], "Didn't get the right location header" + end +end |
