Sha256: f1f8c1c5094e09bc5b042f76e105b75b02c78cdba6cb2fd3d7875578dccb1ee8

Contents?: true

Size: 760 Bytes

Versions: 13

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

13 entries across 13 versions & 1 rubygems

Version Path
camping-3.2.6 test/app_file.rb
camping-3.2.5 test/app_file.rb
camping-3.2.4 test/app_file.rb
camping-3.2.3 test/app_file.rb
camping-3.2.2 test/app_file.rb
camping-3.2.1 test/app_file.rb
camping-3.2.0 test/app_file.rb
camping-3.1.3 test/app_file.rb
camping-3.1.2 test/app_file.rb
camping-3.1.0 test/app_file.rb
camping-3.0.2 test/app_file.rb
camping-3.0.1 test/app_file.rb
camping-3.0.0 test/app_file.rb