blob: 3f4c01f7bb65eb34a5d97dafd502a67d26081d0b (
plain)
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
|
require 'test_helper'
require 'lib/cert'
class CertTest < MiniTest::Unit::TestCase
def setup
@sample = Cert.new
@sample.set_random
@sample.attach_zip
end
def test_certs_come_with_attachments
assert @sample.has_attachment? "cert.zip"
end
def test_zipper_returns_zip_attachement
assert_equal "application/zip", @sample.zipped["content_type"]
end
def test_zipname_returns_name_of_zip_file
assert_equal "cert.zip", @sample.zipname
end
def test_test_data
assert @sample.valid?
end
def test_validation_of_random
@sample.stubs(:set_random)
[0, 1, nil, "asdf"].each do |invalid|
@sample.random = invalid
assert !@sample.valid?, "#{invalid} should not be a valid value for random"
end
end
def test_validation_of_attachement
@sample.stubs(:attach_zip)
@sample.delete_attachment(@sample.zipname)
assert !@sample.valid?, "Cert should require zipped attachment"
end
end
|