Sha256: bff5f2eb988a1e216eead57b6af057ac37fac9df33776ada8bbb3ac8c0bdde84

Contents?: true

Size: 760 Bytes

Versions: 4

Compression:

Stored size: 760 Bytes

Contents

require 'test_helper'
require 'camping'

Camping.goes :FileSource

module FileSource::Controllers
  class Index
    def get
      FileSource.options[:__FILE__]
    end
  end
end

class FileSource::Test < TestCase
  def test_source
    get '/'
    assert_body __FILE__
  end

  def test_file
    get '/style.css'
    assert_body "* { margin: 0; padding: 0 }"
    assert_equal "text/css", last_response.headers['Content-Type']

    get '/test.foo'
    assert_body "Hello"
    assert_equal "text/html", last_response.headers['Content-Type']

    get '/test'
    assert_body "No extension"
    assert_equal "text/html", last_response.headers['Content-Type']
  end
end

__END__

@@ /style.css
* { margin: 0; padding: 0 }

@@ /test.foo
Hello

@@ /test
No extension

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
camping-2.1.532 test/app_file.rb
camping-2.1.531 test/app_file.rb
camping-2.1.523 test/app_file.rb
camping-2.1.467 test/app_file.rb