File: app_file.rb

package info (click to toggle)
camping 3.2.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,312 kB
  • sloc: ruby: 5,032; javascript: 2,362; makefile: 29
file content (45 lines) | stat: -rw-r--r-- 760 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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