roku_builder 3.12.8 → 3.13.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -2
  3. data/CHANGELOG +9 -0
  4. data/Gemfile.lock +17 -11
  5. data/bin/roku +4 -8
  6. data/lib/roku_builder.rb +16 -24
  7. data/lib/roku_builder/config.rb +213 -0
  8. data/lib/roku_builder/config_parser.rb +304 -267
  9. data/lib/roku_builder/config_validator.rb +149 -126
  10. data/lib/roku_builder/controller.rb +34 -184
  11. data/lib/roku_builder/controller_commands.rb +85 -79
  12. data/lib/roku_builder/error_handler.rb +0 -11
  13. data/lib/roku_builder/errors.rb +12 -0
  14. data/lib/roku_builder/inspector.rb +6 -4
  15. data/lib/roku_builder/keyer.rb +1 -1
  16. data/lib/roku_builder/loader.rb +1 -1
  17. data/lib/roku_builder/logger.rb +32 -0
  18. data/lib/roku_builder/manifest_manager.rb +2 -2
  19. data/lib/roku_builder/monitor.rb +1 -1
  20. data/lib/roku_builder/options.rb +113 -0
  21. data/lib/roku_builder/stager.rb +2 -2
  22. data/lib/roku_builder/tester.rb +57 -11
  23. data/lib/roku_builder/util.rb +3 -4
  24. data/lib/roku_builder/version.rb +1 -1
  25. data/roku_builder.gemspec +2 -1
  26. data/test/roku_builder/test_config.rb +168 -0
  27. data/test/roku_builder/test_config_parser.rb +347 -394
  28. data/test/roku_builder/test_config_validator.rb +193 -190
  29. data/test/roku_builder/test_controller.rb +59 -178
  30. data/test/roku_builder/test_controller_commands.rb +407 -394
  31. data/test/roku_builder/test_error_handler.rb +67 -69
  32. data/test/roku_builder/test_files/config_test/bad.json +2 -0
  33. data/test/roku_builder/test_files/config_test/child.json +11 -0
  34. data/test/roku_builder/test_files/config_test/config.json +29 -0
  35. data/test/roku_builder/test_files/config_test/non_json.json +1 -0
  36. data/test/roku_builder/test_files/config_test/parent.json +21 -0
  37. data/test/roku_builder/test_files/config_test/parent_projects.json +35 -0
  38. data/test/roku_builder/test_files/manifest_manager_test/manifest_template_2 +1 -1
  39. data/test/roku_builder/test_helper.rb +55 -45
  40. data/test/roku_builder/test_inspector.rb +278 -213
  41. data/test/roku_builder/test_keyer.rb +144 -147
  42. data/test/roku_builder/test_linker.rb +91 -95
  43. data/test/roku_builder/test_loader.rb +279 -289
  44. data/test/roku_builder/test_logger.rb +47 -0
  45. data/test/roku_builder/test_manifest_manager.rb +92 -94
  46. data/test/roku_builder/test_monitor.rb +101 -103
  47. data/test/roku_builder/test_navigator.rb +240 -245
  48. data/test/roku_builder/test_options.rb +156 -0
  49. data/test/roku_builder/test_packager.rb +108 -108
  50. data/test/roku_builder/test_profiler.rb +20 -19
  51. data/test/roku_builder/test_scripter.rb +83 -81
  52. data/test/roku_builder/test_stager.rb +299 -311
  53. data/test/roku_builder/test_tester.rb +112 -115
  54. data/test/roku_builder/test_util.rb +18 -17
  55. metadata +39 -6
  56. data/lib/roku_builder/config_manager.rb +0 -161
  57. data/test/roku_builder/test_config_manager.rb +0 -372
@@ -0,0 +1,156 @@
1
+ # ********** Copyright Viacom, Inc. Apache 2.0 **********
2
+
3
+ require_relative "test_helper.rb"
4
+
5
+ module RokuBuilder
6
+ class OptionsTest < Minitest::Test
7
+ def test_options_validate_extra_commands
8
+ options = {
9
+ sideload: true,
10
+ package: true
11
+ }
12
+ assert_raises InvalidOptions do
13
+ build_options(options)
14
+ end
15
+ end
16
+ def test_options_validate_no_commands
17
+ options = {}
18
+ assert_raises InvalidOptions do
19
+ build_options(options)
20
+ end
21
+ end
22
+ def test_options_validate_extra_sources_sideload
23
+ options = {
24
+ sideload: true,
25
+ working: true,
26
+ current: true
27
+ }
28
+ assert_raises InvalidOptions do
29
+ build_options(options)
30
+ end
31
+ end
32
+ def test_options_validate_working
33
+ options = {
34
+ sideload: true,
35
+ working: true
36
+ }
37
+ build_options(options)
38
+ end
39
+ def test_options_validate_no_source
40
+ options = {
41
+ package: true
42
+ }
43
+ assert_raises InvalidOptions do
44
+ build_options(options)
45
+ end
46
+ end
47
+ def test_options_validate_bad_current
48
+ options = {
49
+ package: true,
50
+ current: true
51
+ }
52
+ assert_raises InvalidOptions do
53
+ build_options(options)
54
+ end
55
+ end
56
+ def test_options_validate_bad_in
57
+ options = {
58
+ package: true,
59
+ in: true
60
+ }
61
+ assert_raises InvalidOptions do
62
+ build_options(options)
63
+ end
64
+ end
65
+ def test_options_validate_depricated
66
+ options = {
67
+ deeplink: "a:b c:d",
68
+ deeplink_depricated: true
69
+ }
70
+ build_options(options)
71
+ end
72
+ def test_options_validate_current
73
+ options = {
74
+ sideload: true,
75
+ current: true
76
+ }
77
+ build_options(options)
78
+ end
79
+ def test_options_validate_extra_sources_package
80
+ options = {
81
+ package: true,
82
+ in: "",
83
+ set_stage: true
84
+ }
85
+ assert_raises InvalidOptions do
86
+ build_options(options)
87
+ end
88
+ end
89
+ def test_options_exclude_command_package
90
+ options = build_options({
91
+ package:true,
92
+ set_stage: true
93
+ })
94
+ assert options.exclude_command?
95
+ end
96
+ def test_options_exclude_command_build
97
+ options = build_options({
98
+ build:true,
99
+ set_stage: true
100
+ })
101
+ assert options.exclude_command?
102
+ end
103
+ def test_options_exclude_command_sideload
104
+ options = build_options({
105
+ sideload:true,
106
+ set_stage: true
107
+ })
108
+ refute options.exclude_command?
109
+ end
110
+ def test_options_source_command_sideload
111
+ options = build_options({
112
+ sideload:true,
113
+ working: true
114
+ })
115
+ assert options.source_command?
116
+ end
117
+ def test_options_source_command_deeplink
118
+ options = build_options({
119
+ deeplink: true,
120
+ })
121
+ refute options.source_command?
122
+ end
123
+ def test_options_command
124
+ options = build_options({
125
+ deeplink: true,
126
+ })
127
+ assert_equal :deeplink, options.command
128
+ end
129
+ def test_options_device_command_true
130
+ options = build_options({
131
+ deeplink: true,
132
+ })
133
+ assert options.device_command?
134
+ end
135
+ def test_options_device_command_false
136
+ options = build_options({
137
+ build: true,
138
+ working: true
139
+ })
140
+ refute options.device_command?
141
+ end
142
+ def test_options_has_source_false
143
+ options = build_options({
144
+ deeplink: true,
145
+ })
146
+ refute options.has_source?
147
+ end
148
+ def test_options_has_source_true
149
+ options = build_options({
150
+ deeplink: true,
151
+ working: true
152
+ })
153
+ assert options.has_source?
154
+ end
155
+ end
156
+ end
@@ -2,126 +2,126 @@
2
2
 
3
3
  require_relative "test_helper.rb"
4
4
 
5
- class PackagerTest < Minitest::Test
6
- def test_packager_package_failed
7
- connection = Minitest::Mock.new
8
- faraday = Minitest::Mock.new
9
- response = Minitest::Mock.new
10
-
11
- device_config = {
12
- ip: "111.222.333",
13
- user: "user",
14
- password: "password",
15
- logger: Logger.new("/dev/null")
16
- }
17
- payload = {
18
- mysubmit: "Package",
19
- app_name: "app_name",
20
- passwd: "password",
21
- pkg_time: 0
22
- }
23
- package_config ={
24
- app_name_version: "app_name",
25
- out_file: "out_file",
26
- password: "password"
27
- }
28
- path = "/plugin_package"
29
-
30
- faraday.expect(:headers, {})
31
- faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
32
- faraday.expect(:request, nil, [:multipart])
33
- faraday.expect(:request, nil, [:url_encoded])
34
- faraday.expect(:adapter, nil, [Faraday.default_adapter])
35
- connection.expect(:post, response) do |arg1, arg2|
36
- assert_equal path, arg1
37
- assert_equal payload[:mysubmit], arg2[:mysubmit]
38
- assert_equal payload[:app_name], arg2[:app_name]
39
- assert_equal payload[:passwd], arg2[:passwd]
40
- assert_equal payload[:pkg_time], arg2[:pkg_time]
41
- end
42
- response.expect(:body, "Failed: Error.")
43
-
44
- packager = RokuBuilder::Packager.new(**device_config)
45
- result = nil
46
- Faraday.stub(:new, connection, faraday) do
47
- Time.stub(:now, Time.at(0)) do
48
- result = packager.package(**package_config)
5
+ module RokuBuilder
6
+ class PackagerTest < Minitest::Test
7
+ def test_packager_package_failed
8
+ connection = Minitest::Mock.new
9
+ faraday = Minitest::Mock.new
10
+ response = Minitest::Mock.new
11
+
12
+ device_config = {
13
+ ip: "111.222.333",
14
+ user: "user",
15
+ password: "password"
16
+ }
17
+ payload = {
18
+ mysubmit: "Package",
19
+ app_name: "app_name",
20
+ passwd: "password",
21
+ pkg_time: 0
22
+ }
23
+ package_config ={
24
+ app_name_version: "app_name",
25
+ out_file: "out_file",
26
+ password: "password"
27
+ }
28
+ path = "/plugin_package"
29
+
30
+ faraday.expect(:headers, {})
31
+ faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
32
+ faraday.expect(:request, nil, [:multipart])
33
+ faraday.expect(:request, nil, [:url_encoded])
34
+ faraday.expect(:adapter, nil, [Faraday.default_adapter])
35
+ connection.expect(:post, response) do |arg1, arg2|
36
+ assert_equal path, arg1
37
+ assert_equal payload[:mysubmit], arg2[:mysubmit]
38
+ assert_equal payload[:app_name], arg2[:app_name]
39
+ assert_equal payload[:passwd], arg2[:passwd]
40
+ assert_equal payload[:pkg_time], arg2[:pkg_time]
49
41
  end
50
- end
42
+ response.expect(:body, "Failed: Error.")
51
43
 
52
- assert_equal "Failed: Error.", result
44
+ packager = Packager.new(**device_config)
45
+ result = nil
46
+ Faraday.stub(:new, connection, faraday) do
47
+ Time.stub(:now, Time.at(0)) do
48
+ result = packager.package(**package_config)
49
+ end
50
+ end
53
51
 
54
- connection.verify
55
- faraday.verify
56
- response.verify
57
- end
52
+ assert_equal "Failed: Error.", result
58
53
 
59
- def test_packager_package
60
- connection = Minitest::Mock.new
61
- faraday = Minitest::Mock.new
62
- response = Minitest::Mock.new
63
- io = Minitest::Mock.new
64
-
65
- device_config = {
66
- ip: "111.222.333",
67
- user: "user",
68
- password: "password",
69
- logger: Logger.new("/dev/null")
70
- }
71
- payload = {
72
- mysubmit: "Package",
73
- app_name: "app_name",
74
- passwd: "password",
75
- pkg_time: 0
76
- }
77
- package_config ={
78
- app_name_version: "app_name",
79
- out_file: "out_file",
80
- password: "password"
81
- }
82
- path = "/plugin_package"
83
-
84
- faraday.expect(:headers, {})
85
- faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
86
- faraday.expect(:request, nil, [:multipart])
87
- faraday.expect(:request, nil, [:url_encoded])
88
- faraday.expect(:adapter, nil, [Faraday.default_adapter])
89
-
90
- faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
91
- faraday.expect(:adapter, nil, [Faraday.default_adapter])
92
-
93
- connection.expect(:post, response) do |arg1, arg2|
94
- assert_equal path, arg1
95
- assert_equal payload[:mysubmit], arg2[:mysubmit]
96
- assert_equal payload[:app_name], arg2[:app_name]
97
- assert_equal payload[:passwd], arg2[:passwd]
98
- assert_equal payload[:pkg_time], arg2[:pkg_time]
54
+ connection.verify
55
+ faraday.verify
56
+ response.verify
99
57
  end
100
- connection.expect(:get, response, ["/pkgs/pkg_url"])
101
58
 
102
- response.expect(:body, "<a href=\"pkgs\">pkg_url</a>")
103
- response.expect(:body, "<a href=\"pkgs\">pkg_url</a>")
59
+ def test_packager_package
60
+ connection = Minitest::Mock.new
61
+ faraday = Minitest::Mock.new
62
+ response = Minitest::Mock.new
63
+ io = Minitest::Mock.new
64
+
65
+ device_config = {
66
+ ip: "111.222.333",
67
+ user: "user",
68
+ password: "password"
69
+ }
70
+ payload = {
71
+ mysubmit: "Package",
72
+ app_name: "app_name",
73
+ passwd: "password",
74
+ pkg_time: 0
75
+ }
76
+ package_config ={
77
+ app_name_version: "app_name",
78
+ out_file: "out_file",
79
+ password: "password"
80
+ }
81
+ path = "/plugin_package"
82
+
83
+ faraday.expect(:headers, {})
84
+ faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
85
+ faraday.expect(:request, nil, [:multipart])
86
+ faraday.expect(:request, nil, [:url_encoded])
87
+ faraday.expect(:adapter, nil, [Faraday.default_adapter])
88
+
89
+ faraday.expect(:request, nil, [:digest, device_config[:user], device_config[:password]])
90
+ faraday.expect(:adapter, nil, [Faraday.default_adapter])
91
+
92
+ connection.expect(:post, response) do |arg1, arg2|
93
+ assert_equal path, arg1
94
+ assert_equal payload[:mysubmit], arg2[:mysubmit]
95
+ assert_equal payload[:app_name], arg2[:app_name]
96
+ assert_equal payload[:passwd], arg2[:passwd]
97
+ assert_equal payload[:pkg_time], arg2[:pkg_time]
98
+ end
99
+ connection.expect(:get, response, ["/pkgs/pkg_url"])
104
100
 
105
- response.expect(:status, 200)
106
- response.expect(:body, "package_body")
101
+ response.expect(:body, "<a href=\"pkgs\">pkg_url</a>")
102
+ response.expect(:body, "<a href=\"pkgs\">pkg_url</a>")
107
103
 
108
- io.expect(:write, nil, ["package_body"])
104
+ response.expect(:status, 200)
105
+ response.expect(:body, "package_body")
109
106
 
110
- packager = RokuBuilder::Packager.new(**device_config)
111
- result = nil
112
- Faraday.stub(:new, connection, faraday) do
113
- Time.stub(:now, Time.at(0)) do
114
- File.stub(:open, nil, io) do
115
- result = packager.package(**package_config)
107
+ io.expect(:write, nil, ["package_body"])
108
+
109
+ packager = Packager.new(**device_config)
110
+ result = nil
111
+ Faraday.stub(:new, connection, faraday) do
112
+ Time.stub(:now, Time.at(0)) do
113
+ File.stub(:open, nil, io) do
114
+ result = packager.package(**package_config)
115
+ end
116
116
  end
117
117
  end
118
- end
119
118
 
120
- assert_equal true, result
119
+ assert_equal true, result
121
120
 
122
- connection.verify
123
- faraday.verify
124
- response.verify
125
- io.verify
121
+ connection.verify
122
+ faraday.verify
123
+ response.verify
124
+ io.verify
125
+ end
126
126
  end
127
127
  end
@@ -2,33 +2,34 @@
2
2
 
3
3
  require_relative "test_helper.rb"
4
4
 
5
- class ProfilerTest < Minitest::Test
6
- def test_profiler_stats
7
- waitfor = Proc.new do |config, &blk|
5
+ module RokuBuilder
6
+ class ProfilerTest < Minitest::Test
7
+ def test_profiler_stats
8
+ waitfor = Proc.new do |config, &blk|
8
9
  assert_equal(/.+/, config["Match"])
9
10
  assert_equal(5, config["Timeout"])
10
11
  txt = "<All_Nodes><NodeA /><NodeB /><NodeC><NodeD /></NodeC></All_Nodes>\n"
11
12
  blk.call(txt)
12
13
  true
13
- end
14
- connection = Minitest::Mock.new
15
- device_config = {
16
- ip: "111.222.333",
17
- user: "user",
18
- password: "password",
19
- logger: Logger.new("/dev/null")
20
- }
21
- profiler = RokuBuilder::Profiler.new(**device_config)
14
+ end
15
+ connection = Minitest::Mock.new
16
+ device_config = {
17
+ ip: "111.222.333",
18
+ user: "user",
19
+ password: "password"
20
+ }
21
+ profiler = Profiler.new(**device_config)
22
22
 
23
- connection.expect(:puts, nil, ["sgnodes all\n"])
24
- connection.expect(:waitfor, nil, &waitfor)
23
+ connection.expect(:puts, nil, ["sgnodes all\n"])
24
+ connection.expect(:waitfor, nil, &waitfor)
25
25
 
26
- Net::Telnet.stub(:new, connection) do
27
- profiler.stub(:printf, nil) do
28
- profiler.run(command: :stats)
26
+ Net::Telnet.stub(:new, connection) do
27
+ profiler.stub(:printf, nil) do
28
+ profiler.run(command: :stats)
29
+ end
29
30
  end
30
- end
31
31
 
32
- connection.verify
32
+ connection.verify
33
+ end
33
34
  end
34
35
  end
@@ -2,99 +2,101 @@
2
2
 
3
3
  require_relative "test_helper.rb"
4
4
 
5
- class Scriptertest < Minitest::Test
5
+ module RokuBuilder
6
+ class Scriptertest < Minitest::Test
6
7
 
7
- def test_scripter_print_bad_attr
8
- code = RokuBuilder::Scripter.print(attribute: :bad, configs: {})
9
- assert_equal RokuBuilder::BAD_PRINT_ATTRIBUTE, code
10
- end
8
+ def test_scripter_print_bad_attr
9
+ code = Scripter.print(attribute: :bad, configs: {})
10
+ assert_equal BAD_PRINT_ATTRIBUTE, code
11
+ end
11
12
 
12
- def test_scripter_print_config_root_dir
13
- call_count = 0
14
- code = nil
15
- fake_print = lambda { |message, path|
16
- assert_equal "%s", message
17
- assert_equal "/dev/null", path
18
- call_count+=1
19
- }
20
- configs = {project_config: {directory: "/dev/null"}}
21
- RokuBuilder::Scripter.stub(:printf, fake_print) do
22
- code = RokuBuilder::Scripter.print(attribute: :root_dir, configs: configs)
13
+ def test_scripter_print_config_root_dir
14
+ call_count = 0
15
+ code = nil
16
+ fake_print = lambda { |message, path|
17
+ assert_equal "%s", message
18
+ assert_equal "/dev/null", path
19
+ call_count+=1
20
+ }
21
+ configs = {project_config: {directory: "/dev/null"}}
22
+ Scripter.stub(:printf, fake_print) do
23
+ code = Scripter.print(attribute: :root_dir, configs: configs)
24
+ end
25
+ assert_equal 1, call_count
26
+ assert_equal SUCCESS, code
23
27
  end
24
- assert_equal 1, call_count
25
- assert_equal RokuBuilder::SUCCESS, code
26
- end
27
- def test_scripter_print_config_app_name
28
- call_count = 0
29
- code = nil
30
- fake_print = lambda { |message, path|
31
- assert_equal "%s", message
32
- assert_equal "TestApp", path
33
- call_count+=1
34
- }
35
- configs = {project_config: {app_name: "TestApp"}}
36
- RokuBuilder::Scripter.stub(:printf, fake_print) do
37
- code = RokuBuilder::Scripter.print(attribute: :app_name, configs: configs)
28
+ def test_scripter_print_config_app_name
29
+ call_count = 0
30
+ code = nil
31
+ fake_print = lambda { |message, path|
32
+ assert_equal "%s", message
33
+ assert_equal "TestApp", path
34
+ call_count+=1
35
+ }
36
+ configs = {project_config: {app_name: "TestApp"}}
37
+ Scripter.stub(:printf, fake_print) do
38
+ code = Scripter.print(attribute: :app_name, configs: configs)
39
+ end
40
+ assert_equal 1, call_count
41
+ assert_equal SUCCESS, code
38
42
  end
39
- assert_equal 1, call_count
40
- assert_equal RokuBuilder::SUCCESS, code
41
- end
42
43
 
43
- def test_scripter_print_manifest_title
44
- call_count = 0
45
- code = nil
46
- fake_print = lambda { |message, title|
47
- assert_equal "%s", message
48
- assert_equal "title", title
49
- call_count+=1
50
- }
51
- manifest = {title: "title"}
52
- configs = {project_config: {directory: "/dev/null"}}
53
- RokuBuilder::Scripter.stub(:printf, fake_print) do
54
- RokuBuilder::ManifestManager.stub(:read_manifest, manifest) do
55
- code = RokuBuilder::Scripter.print(attribute: :title, configs: configs)
44
+ def test_scripter_print_manifest_title
45
+ call_count = 0
46
+ code = nil
47
+ fake_print = lambda { |message, title|
48
+ assert_equal "%s", message
49
+ assert_equal "title", title
50
+ call_count+=1
51
+ }
52
+ manifest = {title: "title"}
53
+ configs = {project_config: {directory: "/dev/null"}}
54
+ Scripter.stub(:printf, fake_print) do
55
+ ManifestManager.stub(:read_manifest, manifest) do
56
+ code = Scripter.print(attribute: :title, configs: configs)
57
+ end
56
58
  end
59
+ assert_equal 1, call_count
60
+ assert_equal SUCCESS, code
57
61
  end
58
- assert_equal 1, call_count
59
- assert_equal RokuBuilder::SUCCESS, code
60
- end
61
62
 
62
- def test_scripter_print_manifest_build_version
63
- call_count = 0
64
- code = nil
65
- fake_print = lambda { |message, build|
66
- assert_equal "%s", message
67
- assert_equal "010101.0001", build
68
- call_count+=1
69
- }
70
- manifest = {build_version: "010101.0001"}
71
- configs = {project_config: {directory: "/dev/null"}}
72
- RokuBuilder::Scripter.stub(:printf, fake_print) do
73
- RokuBuilder::ManifestManager.stub(:read_manifest, manifest) do
74
- code = RokuBuilder::Scripter.print(attribute: :build_version, configs: configs)
63
+ def test_scripter_print_manifest_build_version
64
+ call_count = 0
65
+ code = nil
66
+ fake_print = lambda { |message, build|
67
+ assert_equal "%s", message
68
+ assert_equal "010101.0001", build
69
+ call_count+=1
70
+ }
71
+ manifest = {build_version: "010101.0001"}
72
+ configs = {project_config: {directory: "/dev/null"}}
73
+ Scripter.stub(:printf, fake_print) do
74
+ ManifestManager.stub(:read_manifest, manifest) do
75
+ code = Scripter.print(attribute: :build_version, configs: configs)
76
+ end
75
77
  end
78
+ assert_equal 1, call_count
79
+ assert_equal SUCCESS, code
76
80
  end
77
- assert_equal 1, call_count
78
- assert_equal RokuBuilder::SUCCESS, code
79
- end
80
81
 
81
- def test_scripter_print_manifest_app_version
82
- call_count = 0
83
- code = nil
84
- fake_print = lambda { |message, major, minor|
85
- assert_equal "%s.%s", message
86
- assert_equal "1", major
87
- assert_equal "0", minor
88
- call_count+=1
89
- }
90
- manifest = {major_version: "1", minor_version: "0"}
91
- configs = {project_config: {directory: "/dev/null"}}
92
- RokuBuilder::Scripter.stub(:printf, fake_print) do
93
- RokuBuilder::ManifestManager.stub(:read_manifest, manifest) do
94
- code = RokuBuilder::Scripter.print(attribute: :app_version, configs: configs)
82
+ def test_scripter_print_manifest_app_version
83
+ call_count = 0
84
+ code = nil
85
+ fake_print = lambda { |message, major, minor|
86
+ assert_equal "%s.%s", message
87
+ assert_equal "1", major
88
+ assert_equal "0", minor
89
+ call_count+=1
90
+ }
91
+ manifest = {major_version: "1", minor_version: "0"}
92
+ configs = {project_config: {directory: "/dev/null"}}
93
+ Scripter.stub(:printf, fake_print) do
94
+ ManifestManager.stub(:read_manifest, manifest) do
95
+ code = Scripter.print(attribute: :app_version, configs: configs)
96
+ end
95
97
  end
98
+ assert_equal 1, call_count
99
+ assert_equal SUCCESS, code
96
100
  end
97
- assert_equal 1, call_count
98
- assert_equal RokuBuilder::SUCCESS, code
99
101
  end
100
102
  end