nitro 0.20.0 → 0.21.0
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.
- data/CHANGELOG +752 -543
- data/INSTALL +38 -38
- data/README +264 -225
- data/Rakefile +48 -49
- data/bin/nitro +3 -3
- data/bin/nitrogen +6 -6
- data/doc/AUTHORS +10 -10
- data/doc/CHANGELOG.1 +1939 -1939
- data/doc/CHANGELOG.2 +954 -954
- data/doc/LICENSE +3 -3
- data/doc/MIGRATION +28 -0
- data/doc/RELEASES +814 -643
- data/doc/config.txt +5 -5
- data/install.rb +7 -17
- data/lib/nitro.rb +38 -9
- data/lib/nitro/adapter/cgi.rb +311 -312
- data/lib/nitro/adapter/fastcgi.rb +18 -25
- data/lib/nitro/adapter/webrick.rb +128 -137
- data/lib/nitro/adapter/wee.rb +51 -0
- data/lib/nitro/caching.rb +20 -20
- data/lib/nitro/caching/actions.rb +43 -43
- data/lib/nitro/caching/fragments.rb +46 -46
- data/lib/nitro/caching/invalidation.rb +11 -11
- data/lib/nitro/caching/output.rb +65 -65
- data/lib/nitro/caching/stores.rb +67 -67
- data/lib/nitro/compiler.rb +262 -0
- data/lib/nitro/compiler/elements.rb +0 -0
- data/lib/nitro/compiler/errors.rb +65 -0
- data/lib/nitro/compiler/localization.rb +25 -0
- data/lib/nitro/compiler/markup.rb +19 -0
- data/lib/nitro/compiler/shaders.rb +206 -0
- data/lib/nitro/compiler/squeeze.rb +20 -0
- data/lib/nitro/compiler/xslt.rb +61 -0
- data/lib/nitro/context.rb +87 -88
- data/lib/nitro/controller.rb +151 -158
- data/lib/nitro/cookie.rb +34 -34
- data/lib/nitro/dispatcher.rb +195 -186
- data/lib/nitro/element.rb +132 -126
- data/lib/nitro/element/java_script.rb +6 -6
- data/lib/nitro/flash.rb +66 -66
- data/lib/nitro/mail.rb +192 -192
- data/lib/nitro/mixin/buffer.rb +66 -0
- data/lib/nitro/mixin/debug.rb +16 -16
- data/lib/nitro/mixin/form.rb +88 -0
- data/lib/nitro/mixin/helper.rb +2 -2
- data/lib/nitro/mixin/javascript.rb +108 -108
- data/lib/nitro/mixin/markup.rb +144 -0
- data/lib/nitro/mixin/pager.rb +202 -202
- data/lib/nitro/mixin/rss.rb +67 -0
- data/lib/nitro/mixin/table.rb +63 -0
- data/lib/nitro/mixin/xhtml.rb +75 -0
- data/lib/nitro/mixin/xml.rb +124 -0
- data/lib/nitro/render.rb +183 -359
- data/lib/nitro/request.rb +140 -140
- data/lib/nitro/response.rb +27 -27
- data/lib/nitro/routing.rb +21 -21
- data/lib/nitro/scaffold.rb +124 -118
- data/lib/nitro/server.rb +117 -80
- data/lib/nitro/server/runner.rb +341 -0
- data/lib/nitro/service.rb +12 -12
- data/lib/nitro/service/xmlrpc.rb +22 -22
- data/lib/nitro/session.rb +122 -120
- data/lib/nitro/session/drb.rb +9 -9
- data/lib/nitro/session/drbserver.rb +34 -34
- data/lib/nitro/template.rb +171 -155
- data/lib/nitro/testing/assertions.rb +90 -90
- data/lib/nitro/testing/context.rb +16 -16
- data/lib/nitro/testing/testcase.rb +34 -34
- data/proto/conf/lhttpd.conf +9 -9
- data/proto/public/error.xhtml +75 -75
- data/proto/public/index.xhtml +18 -18
- data/proto/public/js/behaviour.js +65 -65
- data/proto/public/js/controls.js +1 -1
- data/proto/public/js/prototype.js +3 -3
- data/proto/public/settings.xhtml +61 -61
- data/proto/run.rb +1 -5
- data/test/nitro/adapter/raw_post1.bin +0 -0
- data/test/nitro/adapter/tc_cgi.rb +57 -57
- data/test/nitro/adapter/tc_webrick.rb +4 -4
- data/test/nitro/mixin/tc_pager.rb +25 -25
- data/test/nitro/mixin/tc_rss.rb +24 -0
- data/test/nitro/mixin/tc_table.rb +31 -0
- data/test/nitro/mixin/tc_xhtml.rb +13 -0
- data/test/nitro/tc_caching.rb +10 -10
- data/test/nitro/tc_context.rb +8 -8
- data/test/nitro/tc_controller.rb +48 -48
- data/test/nitro/tc_cookie.rb +6 -6
- data/test/nitro/tc_dispatcher.rb +64 -64
- data/test/nitro/tc_element.rb +27 -27
- data/test/nitro/tc_flash.rb +31 -31
- data/test/nitro/tc_mail.rb +63 -63
- data/test/nitro/tc_server.rb +26 -26
- data/test/nitro/tc_session.rb +9 -9
- data/test/nitro/tc_template.rb +19 -19
- data/test/public/blog/list.xhtml +1 -1
- metadata +31 -37
- data/lib/nitro/buffering.rb +0 -45
- data/lib/nitro/builder/form.rb +0 -104
- data/lib/nitro/builder/rss.rb +0 -104
- data/lib/nitro/builder/table.rb +0 -80
- data/lib/nitro/builder/xhtml.rb +0 -132
- data/lib/nitro/builder/xml.rb +0 -131
- data/lib/nitro/conf.rb +0 -36
- data/lib/nitro/environment.rb +0 -21
- data/lib/nitro/errors.rb +0 -69
- data/lib/nitro/localization.rb +0 -153
- data/lib/nitro/markup.rb +0 -147
- data/lib/nitro/output.rb +0 -24
- data/lib/nitro/runner.rb +0 -348
- data/lib/nitro/shaders.rb +0 -206
- data/test/nitro/builder/tc_rss.rb +0 -23
- data/test/nitro/builder/tc_table.rb +0 -30
- data/test/nitro/builder/tc_xhtml.rb +0 -39
- data/test/nitro/builder/tc_xml.rb +0 -56
- data/test/nitro/tc_localization.rb +0 -49
data/test/nitro/tc_context.rb
CHANGED
|
@@ -6,12 +6,12 @@ require 'ostruct'
|
|
|
6
6
|
require 'nitro/context'
|
|
7
7
|
|
|
8
8
|
class TC_Context < Test::Unit::TestCase # :nodoc: all
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
include Nitro
|
|
10
|
+
|
|
11
|
+
def test_context
|
|
12
|
+
conf = OpenStruct.new
|
|
13
|
+
conf.dispatcher = nil
|
|
14
|
+
c = Context.new(conf)
|
|
15
|
+
assert_equal 200, c.status
|
|
16
|
+
end
|
|
17
17
|
end
|
data/test/nitro/tc_controller.rb
CHANGED
|
@@ -10,53 +10,53 @@ require 'nitro/dispatcher'
|
|
|
10
10
|
require 'nitro/controller'
|
|
11
11
|
|
|
12
12
|
class TC_Controller < Test::Unit::TestCase # :nodoc: all
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
13
|
+
include Nitro
|
|
14
|
+
|
|
15
|
+
class Blog2Controller < Controller
|
|
16
|
+
attr_reader :aflag, :tflag
|
|
17
|
+
|
|
18
|
+
@template_root = File.expand_path(Nitro::LibPath + '../../test/public/blog')
|
|
19
|
+
|
|
20
|
+
def list
|
|
21
|
+
@aflag = true
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def setup
|
|
26
|
+
@disp = Dispatcher.new({
|
|
27
|
+
'/blog' => Blog2Controller,
|
|
28
|
+
})
|
|
29
|
+
@conf = OpenStruct.new
|
|
30
|
+
@conf.dispatcher = @disp
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_render
|
|
34
|
+
ctx = Context.new(@conf)
|
|
35
|
+
ctx.headers = {}
|
|
36
|
+
ctx.params = {}
|
|
37
|
+
ctx.headers['REQUEST_URI'] = '/blog/list'
|
|
38
|
+
ctx.instance_eval '@session = {}'
|
|
39
|
+
klass, action = ctx.dispatcher.dispatch(ctx.path, ctx)
|
|
40
|
+
c = klass.new(ctx)
|
|
41
|
+
|
|
42
|
+
begin
|
|
43
|
+
c.send(action)
|
|
44
|
+
rescue RenderExit
|
|
45
|
+
# drink
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
assert_equal true, c.aflag
|
|
49
|
+
assert_equal true, $include1
|
|
50
|
+
assert_equal true, $include2
|
|
51
|
+
|
|
52
|
+
# the template is compiled
|
|
53
|
+
assert_equal true, c.tflag
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_action_methods
|
|
57
|
+
# aflag/tflag are counted too!
|
|
58
|
+
assert_equal 3, Blog2Controller.action_methods.size
|
|
59
|
+
assert Blog2Controller.action_methods.include?('list')
|
|
60
|
+
end
|
|
61
61
|
|
|
62
62
|
end
|
data/test/nitro/tc_cookie.rb
CHANGED
|
@@ -5,10 +5,10 @@ require 'test/unit'
|
|
|
5
5
|
require 'nitro/cookie'
|
|
6
6
|
|
|
7
7
|
class TC_Cookie < Test::Unit::TestCase # :nodoc: all
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
include Nitro
|
|
9
|
+
|
|
10
|
+
def test_init
|
|
11
|
+
c = Cookie.new('hello', 'world')
|
|
12
|
+
assert_equal '/', c.path
|
|
13
|
+
end
|
|
14
14
|
end
|
data/test/nitro/tc_dispatcher.rb
CHANGED
|
@@ -4,78 +4,78 @@ require 'test/unit'
|
|
|
4
4
|
require 'nitro/dispatcher'
|
|
5
5
|
|
|
6
6
|
class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
|
|
7
|
-
|
|
7
|
+
include Nitro
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
class MainController < Controller
|
|
10
|
+
end
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
class BlogController < Controller
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def setup
|
|
16
|
+
@d = Dispatcher.new({
|
|
17
|
+
'/' => MainController,
|
|
18
|
+
'/blog' => BlogController
|
|
19
|
+
})
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
@dxml = Dispatcher.new({
|
|
22
|
+
'/' => MainController,
|
|
23
|
+
'/blog' => BlogController,
|
|
24
|
+
# FIXME: this is a hack!
|
|
25
|
+
'xml:blog' => BlogController
|
|
26
|
+
})
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def teardown
|
|
30
|
+
@d = @dxml = nil
|
|
31
|
+
end
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
33
|
+
def test_initialize
|
|
34
|
+
d = Dispatcher.new(BlogController)
|
|
35
|
+
assert_equal BlogController, d.controllers['/']
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_dispatch
|
|
39
|
+
klass, action = @d.dispatch('/blog/list')
|
|
40
|
+
assert_equal BlogController, klass
|
|
41
|
+
assert_equal 'list_action', action
|
|
42
|
+
|
|
43
|
+
klass, action = @d.dispatch('/blog/another/very_litle/list')
|
|
44
|
+
assert_equal BlogController, klass
|
|
45
|
+
assert_equal 'another__very_litle__list_action', action
|
|
46
|
+
|
|
47
|
+
klass, action = @d.dispatch('/another/litle/list')
|
|
48
|
+
assert_equal MainController, klass
|
|
49
|
+
assert_equal 'another__litle__list_action', action
|
|
50
|
+
|
|
51
|
+
klass, action = @d.dispatch('/blog')
|
|
52
|
+
assert_equal BlogController, klass
|
|
53
|
+
assert_equal 'index_action', action
|
|
54
|
+
|
|
55
|
+
klass, action, ctype = @d.dispatch('/login')
|
|
56
|
+
assert_equal MainController, klass
|
|
57
|
+
assert_equal 'login_action', action
|
|
58
|
+
|
|
59
|
+
klass, action = @d.dispatch('/')
|
|
60
|
+
assert_equal MainController, klass
|
|
61
|
+
assert_equal 'index_action', action
|
|
62
62
|
|
|
63
63
|
=begin
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
# gmosx: this functionality is deprecated. Use multiple
|
|
65
|
+
# controller to define multiple apis.
|
|
66
|
+
|
|
67
|
+
# multi-api dispatcher.
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
# no xml prefix, use xhtml api.
|
|
70
|
+
klass, action = @dxml.dispatch('/blog/list')
|
|
71
|
+
assert_equal BlogController, klass
|
|
72
|
+
assert_equal 'list_action', action
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
# xml prefix, use xml api.
|
|
75
|
+
klass, action = @dxml.dispatch('/xml:blog/list')
|
|
76
|
+
assert_equal BlogController, klass
|
|
77
|
+
assert_equal 'list_action', action
|
|
78
78
|
=end
|
|
79
|
-
|
|
79
|
+
end
|
|
80
80
|
|
|
81
81
|
end
|
data/test/nitro/tc_element.rb
CHANGED
|
@@ -8,38 +8,38 @@ include Nitro
|
|
|
8
8
|
|
|
9
9
|
$source = %{
|
|
10
10
|
<html>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
<?r a = 5 ?>
|
|
12
|
+
Here is some text
|
|
13
|
+
<body style="hidden" name="1">
|
|
14
|
+
Some more
|
|
15
|
+
<Box color="#f00">
|
|
16
|
+
Hello World
|
|
17
|
+
<Box color="#ff0">
|
|
18
|
+
<b>nice</b>
|
|
19
|
+
<i>stuff</i>
|
|
20
|
+
<Box color="#fff">
|
|
21
|
+
It works
|
|
22
|
+
</Box>
|
|
23
|
+
</Box>
|
|
24
|
+
Text
|
|
25
|
+
</Box>
|
|
26
|
+
The End
|
|
27
|
+
</body>
|
|
28
28
|
</html>
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
class Box < Nitro::Element
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
def open
|
|
33
|
+
%|<div style="color: #@color">|
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def close
|
|
37
|
+
"</div>"
|
|
38
|
+
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
class TC_Element < Test::Unit::TestCase # :nodoc: all
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
def test_all
|
|
43
|
+
res = ElementProcessor.transform($source)
|
|
44
|
+
end
|
|
45
45
|
end
|
data/test/nitro/tc_flash.rb
CHANGED
|
@@ -8,38 +8,38 @@ require 'nitro/controller'
|
|
|
8
8
|
require 'nitro/flash'
|
|
9
9
|
|
|
10
10
|
class TC_Flash < Test::Unit::TestCase # :nodoc: all
|
|
11
|
-
|
|
11
|
+
include Nitro
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
class MyController < Controller
|
|
14
|
+
attr_accessor :flag
|
|
15
|
+
|
|
16
|
+
def action1
|
|
17
|
+
flash[:msg] = 'Hello world!'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def action2
|
|
21
|
+
@flag = flash[:msg]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
def setup
|
|
26
|
+
@conf = OpenStruct.new
|
|
27
|
+
end
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
def teardown
|
|
30
|
+
@conf = nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_all
|
|
34
|
+
ctx = Context.new(@conf)
|
|
35
|
+
ctx.headers = {}
|
|
36
|
+
ctx.params = {}
|
|
37
|
+
ctx.instance_eval '@session = {}'
|
|
38
|
+
c = MyController.new(ctx)
|
|
39
|
+
c.action1
|
|
40
|
+
c.action2
|
|
41
|
+
assert_equal 'Hello world!', c.flag
|
|
42
|
+
c.action2
|
|
43
|
+
assert_equal 'Hello world!', c.flag
|
|
44
|
+
end
|
|
45
45
|
end
|
data/test/nitro/tc_mail.rb
CHANGED
|
@@ -9,74 +9,74 @@ require 'nitro'
|
|
|
9
9
|
require 'nitro/mail'
|
|
10
10
|
|
|
11
11
|
class TestCaseMail < Test::Unit::TestCase # :nodoc: all
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
12
|
+
include Nitro
|
|
13
|
+
|
|
14
|
+
class DummyMailer < Mailer
|
|
15
|
+
def initialize
|
|
16
|
+
super
|
|
17
|
+
@bcc = 'gm@navel.gr'
|
|
18
|
+
@template_root = 'test/public/dummy_mailer'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def registration(to, username, token)
|
|
22
|
+
@to = to
|
|
23
|
+
@from = 'system@navel.gr'
|
|
24
|
+
@subject = 'Nitro.com registration'
|
|
25
|
+
@cc = 'gm@navel.gr'
|
|
26
|
+
@body.username = username
|
|
27
|
+
@body.token = token
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def greek(to)
|
|
31
|
+
@to = to
|
|
32
|
+
@from = 'system@navel.gr'
|
|
33
|
+
@subject = 'Ελληνικός Τίτλος'
|
|
34
|
+
@cc = 'gm@navel.gr'
|
|
35
|
+
@body = 'Τί έγινε ρε παιδιά;'
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
class DummyController < Controller
|
|
40
|
+
# mailer DummyMailer
|
|
41
|
+
|
|
42
|
+
def register
|
|
43
|
+
token = 999
|
|
44
|
+
deliver_registration('gmosx@navel.gr', 'gmosx', token)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_mail
|
|
49
|
+
m = Mail.new 'gmosx@navel.gr', 'drak@navel.gr', 'A simple test', 'This is the body of the message'
|
|
50
|
+
expected = %{From: gmosx@navel.gr
|
|
51
51
|
To: drak@navel.gr
|
|
52
52
|
Subject: A simple test
|
|
53
53
|
|
|
54
54
|
This is the body of the message}
|
|
55
|
-
|
|
55
|
+
assert_equal expected, m.encoded
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
m.to = %w{ renos@navel.gr stella@navel.gr }
|
|
58
|
+
expected = %{From: gmosx@navel.gr
|
|
59
59
|
To: renos@navel.gr, stella@navel.gr
|
|
60
60
|
Subject: A simple test
|
|
61
61
|
|
|
62
62
|
This is the body of the message}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
assert_equal expected, m.encoded
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_mailer
|
|
68
|
+
assert_equal 0, DummyMailer.deliveries.size
|
|
69
|
+
|
|
70
|
+
Mailer.server[:address] = 'mail.navel.gr'
|
|
71
|
+
assert_equal 'mail.navel.gr', DummyMailer.server[:address]
|
|
72
|
+
|
|
73
|
+
DummyMailer.delivery_method = :test
|
|
74
|
+
DummyMailer.template_root = File.join(File.dirname(__FILE__), '..', 'root', 'dummy_mailer')
|
|
75
|
+
token = 999
|
|
76
|
+
DummyMailer.deliver_registration('gm@navel.gr', 'gmosx', token)
|
|
77
|
+
assert_equal 1, DummyMailer.deliveries.size
|
|
78
|
+
|
|
79
|
+
expected = %{From: system@navel.gr
|
|
80
80
|
To: gm@navel.gr
|
|
81
81
|
Cc: gm@navel.gr
|
|
82
82
|
Bcc: gm@navel.gr
|
|
@@ -88,10 +88,10 @@ how do you feel?
|
|
|
88
88
|
|
|
89
89
|
Here is your <b>Token</b>: 999
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
assert_equal expected, DummyMailer.deliveries[0].encoded
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
DummyMailer.deliver_greek('gm@navel.gr')
|
|
94
|
+
assert_equal 2, DummyMailer.deliveries.size
|
|
95
|
+
end
|
|
96
96
|
|
|
97
97
|
end
|