mosquito 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,55 @@
1
+ require File.dirname(__FILE__) + "/../lib/mosquito"
2
+
3
+ class TestMockUpload < Test::Unit::TestCase
4
+ include Mosquito
5
+
6
+ def setup
7
+ @mock_jpeg = MockUpload.new("stuff.JPG")
8
+ @mock_png = MockUpload.new("stuff.png")
9
+ @mock_gif = MockUpload.new("stuff.gif")
10
+ @mock_pdf = MockUpload.new("doc.pdf")
11
+ end
12
+
13
+ def test_generation
14
+ [@mock_jpeg, @mock_png, @mock_gif].each do | obj |
15
+ assert_kind_of StringIO, obj
16
+ assert obj.respond_to?(:content_type)
17
+ assert obj.respond_to?(:local_path)
18
+ assert obj.respond_to?(:original_filename)
19
+ assert File.exist?(obj.local_path)
20
+ end
21
+ end
22
+
23
+ def test_extensions_extracted_properly
24
+ assert_equal 'jpg', @mock_jpeg.extension
25
+ assert_equal 'png', @mock_png.extension
26
+ assert_equal 'gif', @mock_gif.extension
27
+ assert_equal 'pdf', @mock_pdf.extension
28
+ end
29
+
30
+ def test_content_types_detected_properly
31
+ assert_equal 'image/jpeg', @mock_jpeg.content_type
32
+ assert_equal 'image/png', @mock_png.content_type
33
+ assert_equal 'image/gif', @mock_gif.content_type
34
+ assert_equal 'application/pdf', @mock_pdf.content_type
35
+ end
36
+
37
+ def test_inspekt
38
+ desc = @mock_png.inspect
39
+ assert desc.include?("@content_type='image/png'")
40
+ end
41
+
42
+ def test_original_filenames_overridden_properly
43
+ assert_equal "stuff.JPG", @mock_jpeg.original_filename
44
+ assert_equal "stuff.png", @mock_png.original_filename
45
+ assert_equal "stuff.gif", @mock_gif.original_filename
46
+ assert_equal "doc.pdf", @mock_pdf.original_filename
47
+ end
48
+
49
+ def test_proper_garbage_put_into_files
50
+ garbage_bins = [@mock_jpeg, @mock_png, @mock_gif].map{|u| u.read }
51
+ garbage_bins.map do | chunk |
52
+ assert_equal 122, chunk.size, "Should be this amount of random data"
53
+ end
54
+ end
55
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: mosquito
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.2
7
- date: 2007-01-07 00:00:00 -08:00
6
+ version: 0.1.3
7
+ date: 2007-09-24 00:00:00 -07:00
8
8
  summary: A Camping test library.
9
9
  require_paths:
10
10
  - lib
@@ -29,34 +29,38 @@ post_install_message:
29
29
  authors:
30
30
  - Geoffrey Grosenbach
31
31
  files:
32
- - Rakefile
33
- - README.txt
34
- - MIT-LICENSE
35
32
  - CHANGELOG
33
+ - MIT-LICENSE
36
34
  - Manifest.txt
37
- - lib
35
+ - README.txt
36
+ - Rakefile
38
37
  - lib/mosquito.rb
39
- - public
40
- - public/blog
38
+ - public/bare.rb
41
39
  - public/blog.rb
42
40
  - public/blog/controllers.rb
43
41
  - public/blog/models.rb
44
42
  - public/blog/views.rb
45
- - public/homepage.rb
46
- - test
47
- - test/test_blog.rb
48
- - test/test_homepage.rb
49
- - test/fixtures
50
43
  - test/fixtures/blog_comments.yml
51
44
  - test/fixtures/blog_posts.yml
52
45
  - test/fixtures/blog_users.yml
46
+ - test/sage_advice_cases/parsing_arrays.rb
47
+ - test/test_bare.rb
48
+ - test/test_blog.rb
49
+ - test/test_helpers.rb
50
+ - test/test_mock_request.rb
51
+ - test/test_mock_upload.rb
53
52
  test_files:
53
+ - test/test_bare.rb
54
54
  - test/test_blog.rb
55
- - test/test_homepage.rb
56
- rdoc_options: []
57
-
58
- extra_rdoc_files: []
59
-
55
+ - test/test_helpers.rb
56
+ - test/test_mock_request.rb
57
+ - test/test_mock_upload.rb
58
+ rdoc_options:
59
+ - --main
60
+ - README.txt
61
+ extra_rdoc_files:
62
+ - Manifest.txt
63
+ - README.txt
60
64
  executables: []
61
65
 
62
66
  extensions: []
@@ -91,3 +95,12 @@ dependencies:
91
95
  - !ruby/object:Gem::Version
92
96
  version: 0.0.0
93
97
  version:
98
+ - !ruby/object:Gem::Dependency
99
+ name: hoe
100
+ version_requirement:
101
+ version_requirements: !ruby/object:Gem::Version::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 1.3.0
106
+ version:
data/public/homepage.rb DELETED
@@ -1,64 +0,0 @@
1
- #!/usr/local/bin/ruby -rubygems
2
- require 'camping'
3
-
4
- Camping.goes :HomePage
5
-
6
- module HomePage::Controllers
7
-
8
- # The root slash shows the `index' view.
9
- class Index < R '/'
10
- def get
11
- render :index
12
- end
13
- end
14
-
15
- # Any other page name gets sent to the view
16
- # of the same name.
17
- #
18
- # /index -> Views#index
19
- # /sample -> Views#sample
20
- #
21
- class Page < R '/(\w+)'
22
- def get(page_name)
23
- render page_name
24
- end
25
- end
26
-
27
- end
28
-
29
- module HomePage::Views
30
-
31
- # If you have a `layout' method like this, it
32
- # will wrap the HTML in the other methods. The
33
- # `self << yield' is where the HTML is inserted.
34
- def layout
35
- html do
36
- title { 'My HomePage' }
37
- body { self << yield }
38
- end
39
- end
40
-
41
- # The `index' view. Inside your views, you express
42
- # the HTML in Ruby. See http://code.whytheluckystiff.net/markaby/.
43
- def index
44
- p 'Hi my name is Charles.'
45
- p 'Here are some links:'
46
- ul do
47
- li { a 'Google', :href => 'http://google.com' }
48
- li { a 'A sample page', :href => '/sample' }
49
- end
50
- end
51
-
52
- # The `sample' view.
53
- def sample
54
- p 'A sample page'
55
- end
56
- end
57
-
58
- if __FILE__ == $0
59
- require 'mongrel/camping'
60
-
61
- server = Mongrel::Camping::start("0.0.0.0",3002,"/homepage",HomePage)
62
- puts "** HomePage example is running at http://localhost:3002/homepage"
63
- server.run.join
64
- end
@@ -1,23 +0,0 @@
1
- require File.dirname(__FILE__) + "/../lib/mosquito"
2
- require File.dirname(__FILE__) + "/../public/homepage"
3
-
4
- class TestHomePage < Camping::FunctionalTest
5
-
6
- def setup
7
- super
8
- # Do other stuff here
9
- end
10
-
11
- def test_index
12
- get '/'
13
- assert_response :success
14
- assert_match_body %r!Charles!
15
- end
16
-
17
- def test_page
18
- get '/sample'
19
- assert_response :success
20
- assert_match_body %r!<p>A sample page</p>!
21
- end
22
-
23
- end