xcpretty 0.0.6 → 0.0.7

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +3 -1
  4. data/CHANGELOG.md +24 -0
  5. data/README.md +3 -1
  6. data/Rakefile +6 -1
  7. data/bin/xcpretty +51 -16
  8. data/features/custom_formatter.feature +15 -0
  9. data/features/junit_report.feature +9 -1
  10. data/features/simple_format.feature +68 -4
  11. data/features/steps/formatting_steps.rb +87 -4
  12. data/features/steps/junit_steps.rb +18 -6
  13. data/features/steps/xcpretty_steps.rb +7 -0
  14. data/features/support/env.rb +18 -15
  15. data/features/test_format.feature +1 -0
  16. data/features/xcpretty.feature +12 -0
  17. data/lib/xcpretty.rb +25 -3
  18. data/lib/xcpretty/ansi.rb +1 -0
  19. data/lib/xcpretty/formatters/formatter.rb +90 -0
  20. data/lib/xcpretty/formatters/rspec.rb +22 -0
  21. data/lib/xcpretty/formatters/simple.rb +137 -0
  22. data/lib/xcpretty/parser.rb +283 -0
  23. data/lib/xcpretty/printer.rb +7 -112
  24. data/lib/xcpretty/reporters/junit.rb +53 -45
  25. data/lib/xcpretty/syntax.rb +22 -0
  26. data/lib/xcpretty/version.rb +1 -1
  27. data/spec/fixtures/constants.rb +63 -15
  28. data/spec/fixtures/custom_formatter.rb +17 -0
  29. data/spec/spec_helper.rb +1 -1
  30. data/spec/support/matchers/colors.rb +1 -1
  31. data/spec/xcpretty/formatters/formatter_spec.rb +56 -0
  32. data/spec/xcpretty/formatters/rspec_spec.rb +46 -0
  33. data/spec/xcpretty/formatters/simple_spec.rb +132 -0
  34. data/spec/xcpretty/parser_spec.rb +258 -0
  35. data/spec/xcpretty/printer_spec.rb +39 -74
  36. data/spec/xcpretty/syntax_spec.rb +35 -0
  37. data/xcpretty.gemspec +1 -1
  38. metadata +40 -25
  39. data/lib/xcpretty/printers/rspec.rb +0 -23
  40. data/lib/xcpretty/printers/simple.rb +0 -153
  41. data/spec/xcpretty/printers/printer_spec.rb +0 -117
  42. data/spec/xcpretty/printers/rspec_spec.rb +0 -52
  43. data/spec/xcpretty/printers/simple_spec.rb +0 -125
@@ -0,0 +1,46 @@
1
+ require "spec_helper"
2
+ require "xcpretty"
3
+ require "xcpretty/formatters/rspec"
4
+
5
+ module XCPretty
6
+
7
+ describe RSpec do
8
+
9
+ before(:each) do
10
+ @formatter = RSpec.new(false, false)
11
+ end
12
+
13
+ it "prints dots in the same line" do
14
+ @formatter.optional_newline.should == ""
15
+ end
16
+
17
+ context "without colors" do
18
+
19
+ it "prints green dots for passing tests" do
20
+ @formatter.format_passing_test("sweez testz", "sample spec", "0.002").should == "."
21
+ end
22
+
23
+ it "prints F for failing tests" do
24
+ @formatter.format_failing_test(
25
+ "///file", "NSNumber Specs", "adding numbers", "should add 2 numbers"
26
+ ).should == "F"
27
+ end
28
+ end
29
+
30
+ context "with colors" do
31
+
32
+ before { @formatter.colorize = true }
33
+
34
+ it "prints green for passing tests" do
35
+ @formatter.format_passing_test("sweez testz", "sample spec", "0.002"
36
+ ).should be_colored :green
37
+ end
38
+
39
+ it "prints red for failing tests" do
40
+ @formatter.format_failing_test(
41
+ "///file", "NSNumber Specs", "adding numbers", "should add 2 numbers"
42
+ ).should be_colored :red
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,132 @@
1
+ require 'xcpretty/formatters/formatter'
2
+ require "xcpretty/formatters/simple"
3
+ require "fixtures/constants"
4
+
5
+ module XCPretty
6
+
7
+ describe Simple do
8
+
9
+ before(:each) do
10
+ @formatter = Simple.new(false, false)
11
+ end
12
+
13
+ it "formats analyzing" do
14
+ @formatter.format_analyze("CCChip8DisplayView.m", 'path/to/file').should ==
15
+ "> Analyzing CCChip8DisplayView.m"
16
+ end
17
+
18
+ it "formats build target/project/configuration with target" do
19
+ @formatter.format_build_target("The Spacer", "Pods", "Debug").should ==
20
+ "> Building Pods/The Spacer [Debug]"
21
+ end
22
+
23
+ it "formats clean target/project/configuration" do
24
+ @formatter.format_clean_target("Pods-ObjectiveSugar", "Pods", "Debug").should ==
25
+ "> Cleaning Pods/Pods-ObjectiveSugar [Debug]"
26
+ end
27
+
28
+ it "formats cocoapods errors" do
29
+ @formatter.format_error("The sandbox is not in sync...").should ==
30
+ "[!] The sandbox is not in sync..."
31
+ end
32
+
33
+ it "formats compiling errors" do
34
+ @formatter.format_compile_error("file", "path/to/file", "expected valid syntax",
35
+ "[a should",
36
+ " ^").should ==
37
+ %Q(
38
+ path/to/file: expected valid syntax
39
+
40
+ [a should
41
+ ^
42
+
43
+ )
44
+ end
45
+
46
+ it "formats compiling output" do
47
+ @formatter.format_compile("NSMutableArray+ObjectiveSugar.m", 'path/to/file').should ==
48
+ "> Compiling NSMutableArray+ObjectiveSugar.m"
49
+ end
50
+
51
+ it "formats compiling xib output" do
52
+ @formatter.format_compile_xib("MainMenu.xib", 'path/to/file').should ==
53
+ "> Compiling MainMenu.xib"
54
+ end
55
+
56
+ it "formats copy resource" do
57
+ @formatter.format_cpresource("ObjectiveSugar/Default-568h@2x.png").should ==
58
+ "> Copying ObjectiveSugar/Default-568h@2x.png"
59
+ end
60
+
61
+ it "formats Copy strings file" do
62
+ @formatter.format_copy_strings_file("InfoPlist.strings").should ==
63
+ "> Copying InfoPlist.strings"
64
+ end
65
+
66
+ it "formats GenerateDSYMFile" do
67
+ @formatter.format_generate_dsym("ObjectiveSugarTests.octest.dSYM").should ==
68
+ "> Generating 'ObjectiveSugarTests.octest.dSYM'"
69
+ end
70
+
71
+ it "formats info.plist processing" do
72
+ @formatter.format_process_info_plist("The Spacer-Info.plist", "The Spacer/The Spacer-Info.plist").should ==
73
+ "> Processing The Spacer-Info.plist"
74
+ end
75
+
76
+ it "formats Linking" do
77
+ @formatter.format_linking("ObjectiveSugar", 'normal', 'i386').should ==
78
+ "> Linking ObjectiveSugar"
79
+ end
80
+
81
+ it "formats Libtool" do
82
+ @formatter.format_libtool("libPods-ObjectiveSugarTests-Kiwi.a").should ==
83
+ "> Building library libPods-ObjectiveSugarTests-Kiwi.a"
84
+ end
85
+
86
+ it "formats failing tests" do
87
+ @formatter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file').should ==
88
+ "x enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES, expected: 1, got: 0"
89
+ end
90
+
91
+ it "formats passing tests" do
92
+ @formatter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001").should ==
93
+ ". _tupleByAddingObject__should_add_a_non_nil_object (0.001 seconds)"
94
+ end
95
+
96
+ it "formats Phase Script Execution" do
97
+ @formatter.format_phase_script_execution("Check Pods Manifest.lock").should ==
98
+ "> Running script 'Check Pods Manifest.lock'"
99
+ end
100
+
101
+ it "formats precompiling output" do
102
+ @formatter.format_process_pch("Pods-CocoaLumberjack-prefix.pch").should ==
103
+ "> Precompiling Pods-CocoaLumberjack-prefix.pch"
104
+ end
105
+
106
+ it "formats code signing" do
107
+ @formatter.format_codesign("build/Release/CocoaChip.app").should ==
108
+ "> Signing build/Release/CocoaChip.app"
109
+ end
110
+
111
+ it "formats preprocessing a file" do
112
+ @formatter.format_preprocess("CocoaChip/CocoaChip-Info.plist").should ==
113
+ "> Preprocessing CocoaChip/CocoaChip-Info.plist"
114
+ end
115
+
116
+ it "formats PBXCp" do
117
+ @formatter.format_pbxcp("build/Release/CocoaChipCore.framework").should ==
118
+ "> Copying build/Release/CocoaChipCore.framework"
119
+ end
120
+
121
+ it "formats test run start" do
122
+ @formatter.format_test_run_started("ReactiveCocoaTests.octest(Tests)").should ==
123
+ "Test Suite ReactiveCocoaTests.octest(Tests) started"
124
+ end
125
+
126
+ it "formats tests suite started" do
127
+ @formatter.format_test_suite_started("RACKVOWrapperSpec").should ==
128
+ "RACKVOWrapperSpec"
129
+ end
130
+
131
+ end
132
+ end
@@ -0,0 +1,258 @@
1
+ require 'xcpretty'
2
+ require 'xcpretty/parser'
3
+ require 'fixtures/constants'
4
+
5
+ module XCPretty
6
+
7
+ describe Parser do
8
+
9
+ before(:each) do
10
+ @formatter = Formatter.new(false, false)
11
+ @parser = Parser.new(@formatter)
12
+ end
13
+
14
+ it "parses analyze" do
15
+ @formatter.should receive(:format_analyze).with("CCChip8DisplayView.m", "CocoaChip/CCChip8DisplayView.m")
16
+ @parser.parse(SAMPLE_ANALYZE)
17
+ end
18
+
19
+ it "parses analyze shallow" do
20
+ @formatter.should receive(:format_analyze).with("CCChip8DisplayView.m", "CocoaChip/CCChip8DisplayView.m")
21
+ @parser.parse(SAMPLE_ANALYZE_SHALLOW)
22
+ end
23
+
24
+ it "parses build target" do
25
+ @formatter.should receive(:format_build_target).with("The Spacer", "Pods", "Debug")
26
+ @parser.parse(SAMPLE_BUILD)
27
+ end
28
+
29
+ it "parses clean remove" do
30
+ @formatter.should receive(:format_clean_remove)
31
+ @parser.parse(SAMPLE_CLEAN_REMOVE)
32
+ end
33
+
34
+ it "parses clean target" do
35
+ @formatter.should receive(:format_clean_target).with("Pods-ObjectiveSugar", "Pods", "Debug")
36
+ @parser.parse(SAMPLE_CLEAN)
37
+ end
38
+
39
+ it "parses clean target withut dash in target name" do
40
+ @formatter.should receive(:format_clean_target).with("Pods", "Pods", "Debug")
41
+ @parser.parse(SAMPLE_ANOTHER_CLEAN)
42
+ end
43
+
44
+ it "parses check dependencies" do
45
+ @formatter.should receive(:format_check_dependencies)
46
+ @parser.parse("Check dependencies")
47
+ end
48
+
49
+ it "parses compiling categories" do
50
+ @formatter.should receive(:format_compile).with("NSMutableArray+ObjectiveSugar.m", "/Users/musalj/code/OSS/ObjectiveSugar/Classes/NSMutableArray+ObjectiveSugar.m")
51
+ @parser.parse(SAMPLE_COMPILE)
52
+ end
53
+
54
+ it "parses compiling classes" do
55
+ @formatter.should receive(:format_compile).with("KWNull.m", "Classes/Core/KWNull.m")
56
+ @parser.parse(SAMPLE_ANOTHER_COMPILE)
57
+ end
58
+
59
+ it "parses compiling XIBs" do
60
+ @formatter.should receive(:format_compile_xib).with("MainMenu.xib", "CocoaChip/en.lproj/MainMenu.xib")
61
+ @parser.parse(SAMPLE_COMPILE_XIB)
62
+ end
63
+
64
+ it "parses CopyStringsFile" do
65
+ @formatter.should receive(:format_copy_strings_file).with('InfoPlist.strings')
66
+ @parser.parse(SAMPLE_COPYSTRINGS)
67
+ end
68
+
69
+ it "parses CpResource" do
70
+ @formatter.should receive(:format_cpresource).with('ObjectiveSugar/Default-568h@2x.png')
71
+ @parser.parse(SAMPLE_CPRESOURCE)
72
+ end
73
+
74
+ it "parses GenerateDSYMFile" do
75
+ @formatter.should receive(:format_generate_dsym).with('ObjectiveSugarTests.octest.dSYM')
76
+ @parser.parse(SAMPLE_DSYM)
77
+ end
78
+
79
+ it "parses info.plist processing" do
80
+ @formatter.should receive(:format_process_info_plist).with('The Spacer-Info.plist', 'The Spacer/The Spacer-Info.plist')
81
+ @parser.parse(SAMPLE_PROCESS_INFOPLIST)
82
+ end
83
+
84
+ it "parses Ld" do
85
+ @formatter.should receive(:format_linking).with('ObjectiveSugar', 'normal', 'i386')
86
+ @parser.parse(SAMPLE_LD)
87
+ end
88
+
89
+ it "parses Libtool" do
90
+ @formatter.should receive(:format_libtool).with('libPods-ObjectiveSugarTests-Kiwi.a')
91
+ @parser.parse(SAMPLE_LIBTOOL)
92
+ end
93
+
94
+ it "parses failing tests" do
95
+ @formatter.should receive(:format_failing_test).with("RACCommandSpec",
96
+ "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES",
97
+ "expected: 1, got: 0",
98
+ #"expect([command.enabled first]).to.equal(@YES);", # outside of PR scope
99
+ "/Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458")
100
+ @parser.parse(SAMPLE_SPECTA_FAILURE)
101
+ end
102
+
103
+ it "parses passing tests" do
104
+ @formatter.should receive(:format_passing_test).with('RACCommandSpec',
105
+ 'enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES',
106
+ '0.001')
107
+ @parser.parse(SAMPLE_OCUNIT_TEST)
108
+ end
109
+
110
+ it "parses PhaseScriptExecution" do
111
+ @formatter.should receive(:format_phase_script_execution).with('Check Pods Manifest.lock')
112
+ @parser.parse(SAMPLE_RUN_SCRIPT)
113
+ end
114
+
115
+ it "parses process PCH" do
116
+ @formatter.should receive(:format_process_pch).with("Pods-CocoaLumberjack-prefix.pch")
117
+ @parser.parse(SAMPLE_PRECOMPILE)
118
+ end
119
+
120
+ it "parses code signing" do
121
+ @formatter.should receive(:format_codesign).with("build/Release/CocoaChip.app")
122
+ @parser.parse(SAMPLE_CODESIGN)
123
+ end
124
+
125
+ it "parses code signing a framework" do
126
+ @formatter.should receive(:format_codesign).with("build/Release/CocoaChipCore.framework")
127
+ @parser.parse(SAMPLE_CODESIGN_FRAMEWORK)
128
+ end
129
+
130
+ it "parses preprocessing" do
131
+ @formatter.should receive(:format_preprocess).with("CocoaChip/CocoaChip-Info.plist")
132
+ @parser.parse(SAMPLE_PREPROCESS)
133
+ end
134
+
135
+ it "parses PBXCp" do
136
+ @formatter.should receive(:format_pbxcp).with("build/Release/CocoaChipCore.framework")
137
+ @parser.parse(SAMPLE_PBXCP)
138
+ end
139
+
140
+ it "parses test run finished" do
141
+ @formatter.should receive(:format_test_run_finished).with('ReactiveCocoaTests.octest(Tests)', '2013-12-10 07:03:03 +0000.')
142
+ @parser.parse(SAMPLE_OCUNIT_TEST_RUN_COMPLETION)
143
+ end
144
+
145
+ it "parses test run started" do
146
+ @formatter.should receive(:format_test_run_started).with('ReactiveCocoaTests.octest(Tests)')
147
+ @parser.parse(SAMPLE_OCUNIT_TEST_RUN_BEGINNING)
148
+ end
149
+
150
+ it "parses test suite started" do
151
+ @formatter.should receive(:format_test_suite_started).with('RACKVOWrapperSpec')
152
+ @parser.parse(SAMPLE_OCUNIT_SUITE_BEGINNING)
153
+ end
154
+
155
+ context "errors" do
156
+
157
+ it "parses cocoapods errors" do
158
+ @formatter.should receive(:format_error).with("The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.")
159
+ @parser.parse(SAMPLE_PODS_ERROR)
160
+ end
161
+
162
+ it "parses compiling errors" do
163
+ @formatter.should receive(:format_compile_error).with(
164
+ "SampleTest.m",
165
+ "/Users/musalj/code/OSS/SampleApp/SampleTest.m:12:59",
166
+ "expected identifier",
167
+ " [[thread.lastMessage should] equal:thread.];",
168
+ " ^")
169
+ SAMPLE_COMPILE_ERROR.each_line do |line|
170
+ @parser.parse(line)
171
+ end
172
+ end
173
+
174
+
175
+ it "parses compiling errors with tildes" do
176
+ @formatter.should receive(:format_compile_error).with(
177
+ 'NSSetTests.m',
178
+ '/Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSSetTests.m:93:16',
179
+ "no visible @interface for 'NSArray' declares the selector 'shoulds'",
180
+ ' }] shoulds] equal:@[ @"F458 Italia", @"Testarossa" ]];',
181
+ ' ~~ ^~~~~~~')
182
+ SAMPLE_COMPILE_ERROR_WITH_TILDES.each_line do |line|
183
+ @parser.parse(line)
184
+ end
185
+ end
186
+
187
+ it "doesn't print the same error over and over" do
188
+ SAMPLE_COMPILE_ERROR.each_line do |line|
189
+ @parser.parse(line)
190
+ end
191
+ @formatter.should_not receive(:format_compile_error)
192
+ @parser.parse("hohohoooo")
193
+ end
194
+
195
+ end
196
+
197
+
198
+ context "summary" do
199
+
200
+ def given_tests_have_started(reporter = SAMPLE_OCUNIT_TEST_RUN_BEGINNING)
201
+ @parser.parse(reporter)
202
+ end
203
+
204
+ def given_tests_are_done(reporter = SAMPLE_OCUNIT_TEST_RUN_COMPLETION)
205
+ @parser.parse(reporter)
206
+ end
207
+
208
+ def given_kiwi_tests_are_done
209
+ @parser.parse(SAMPLE_KIWI_TEST_RUN_COMPLETION)
210
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
211
+ @parser.parse(SAMPLE_KIWI_SUITE_COMPLETION)
212
+ end
213
+
214
+ it "returns empty string if the suite is not done" do
215
+ @parser.parse(SAMPLE_EXECUTED_TESTS).should == ""
216
+ end
217
+
218
+ it "knows when the test suite is done for OCunit / Specta" do
219
+ given_tests_are_done
220
+ @formatter.should receive(:format_test_summary)
221
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
222
+ end
223
+
224
+ it "doesn't print executed message twice for Kiwi tests" do
225
+ @formatter.should_receive(:format_test_summary).once
226
+ given_tests_have_started(SAMPLE_KIWI_TEST_RUN_BEGINNING)
227
+ given_kiwi_tests_are_done
228
+ end
229
+
230
+ it "knows when the test suite is done for XCtest" do
231
+ @formatter.should_receive(:format_test_summary).once
232
+ 2.times {
233
+ given_tests_are_done(SAMPLE_KIWI_TEST_RUN_COMPLETION)
234
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
235
+ }
236
+ end
237
+
238
+ it "prints OCunit / XCTest summary twice if tests executed twice" do
239
+ @formatter.should_receive(:format_test_summary).twice
240
+ 2.times {
241
+ given_tests_have_started
242
+ given_tests_are_done
243
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
244
+ }
245
+ end
246
+
247
+ it "prints Kiwi summary twice if tests executed twice" do
248
+ @formatter.should_receive(:format_test_summary).twice
249
+ 2.times {
250
+ given_tests_have_started(SAMPLE_KIWI_TEST_RUN_BEGINNING)
251
+ given_kiwi_tests_are_done
252
+ }
253
+ end
254
+
255
+ end
256
+
257
+ end
258
+ end
@@ -1,88 +1,53 @@
1
- require "spec_helper"
2
1
  require "xcpretty/printer"
2
+ require 'xcpretty/formatters/formatter'
3
+ require 'xcpretty/formatters/simple'
3
4
 
4
5
  module XCPretty
6
+ describe Printer do
5
7
 
6
- module Printer
7
-
8
- describe Printer do
9
-
10
- include Printer
11
-
12
- def pretty_format(text)
13
- ""
14
- end
15
-
16
- def executed_tests_message
17
- format_test_summary(SAMPLE_EXECUTED_TESTS)
18
- end
19
-
20
- def given_tests_are_done(reporter = SAMPLE_XCTEST_SUITE_COMPLETION)
21
- pretty_print(reporter)
22
- end
23
-
24
- def given_kiwi_tests_are_done
25
- pretty_print(SAMPLE_XCTEST_SUITE_COMPLETION)
26
- pretty_print(SAMPLE_EXECUTED_TESTS)
27
- pretty_print(SAMPLE_KIWI_SUITE_COMPLETION)
28
- end
29
-
30
- before(:each) do
31
- STDOUT.stub(:print) { |text| text }
32
- end
33
-
34
- it "knows when the test suite is done for OCunit / Specta" do
35
- executed_tests_message.should == ""
36
-
37
- given_tests_are_done
38
- executed_tests_message.should == "\n\n#{SAMPLE_EXECUTED_TESTS}"
39
- end
40
-
41
- it "knows when the test suite is done for XCtest" do
42
- executed_tests_message.should == ""
43
-
44
- given_tests_are_done
45
- executed_tests_message.should == "\n\n#{SAMPLE_EXECUTED_TESTS}"
46
- end
47
-
48
- it "prints out Kiwi failures nicely" do
49
- pretty_print(SAMPLE_KIWI_FAILURE)
50
- pretty_print(SAMPLE_KIWI_FAILURE)
51
- given_tests_are_done
52
- executed_tests_message.should include(%Q(
53
- NumberAdditions
54
- Iterators_TimesIteratesTheExactNumberOfTimes, expected subject to equal 4, got 5
55
- /Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSNumberTests.m:49
8
+ before(:each) do
9
+ STDOUT.stub(:print) { |text| text }
10
+ @printer = Printer.new(:colorize => true, :unicode => true, :formatter => DummyFormatter)
11
+ end
56
12
 
57
- Iterators_TimesIteratesTheExactNumberOfTimes, expected subject to equal 4, got 5
58
- /Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSNumberTests.m:49
13
+ it "prints to stdout" do
14
+ STDOUT.should receive(:print).with("hey ho let's go\n")
15
+ @printer.pretty_print("hey ho let's go")
16
+ end
59
17
 
18
+ it "doesn't print empty lines" do
19
+ STDOUT.should_not receive(:print)
20
+ @printer.pretty_print("")
21
+ end
60
22
 
61
- #{SAMPLE_EXECUTED_TESTS}))
62
- end
23
+ it "prints with newlines only when needed" do
24
+ @printer.formatter.stub(:optional_newline).and_return("")
25
+
26
+ STDOUT.should receive(:print).with("hey ho let's go")
27
+ @printer.pretty_print("hey ho let's go")
28
+ end
63
29
 
64
- it "prints out specta failures nicely" do
65
- pretty_print(SAMPLE_SPECTA_FAILURE)
66
- pretty_print(SAMPLE_SPECTA_FAILURE)
67
- given_tests_are_done
68
- executed_tests_message.should include(%Q(
69
- RACCommandSpec
70
- enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES, expected: 1, got: 0
71
- /Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458
30
+ it "makes a formatter with unicode and colorized flags" do
31
+ @printer.formatter.colorize?.should == true
32
+ @printer.formatter.use_unicode?.should == true
33
+ end
72
34
 
73
- enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES, expected: 1, got: 0
74
- /Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458
35
+ end
36
+ end
75
37
 
38
+ module XCPretty; class DummyFormatter < Formatter
76
39
 
77
- #{SAMPLE_EXECUTED_TESTS}))
78
- end
40
+ def initialize(unicode, colorize)
41
+ @use_unicode = unicode
42
+ @colorize = colorize
43
+ end
79
44
 
80
- it "doesn't print executed message twice for Kiwi tests" do
81
- Printer.instance_variable_set(:@printed_summary, false)
82
- given_kiwi_tests_are_done
83
- executed_tests_message.should == ""
84
- end
45
+ def pretty_format(text)
46
+ text
47
+ end
85
48
 
86
- end
49
+ def optional_newline
50
+ "\n"
87
51
  end
88
- end
52
+
53
+ end; end