rake-funnel 0.3.2.pre → 0.4.0.pre

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 (122) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -2
  3. data/Gemfile +4 -0
  4. data/README.md +2 -2
  5. data/lib/rake/funnel/ambiguous_file_error.rb +31 -29
  6. data/lib/rake/funnel/execution_error.rb +28 -26
  7. data/lib/rake/funnel/extensions/case/camel_case.rb +24 -19
  8. data/lib/rake/funnel/extensions/case/pascal_case.rb +24 -19
  9. data/lib/rake/funnel/extensions/case.rb +3 -3
  10. data/lib/rake/funnel/extensions/common_path.rb +60 -52
  11. data/lib/rake/funnel/extensions/disable_colors.rb +33 -27
  12. data/lib/rake/funnel/extensions/rexml.rb +27 -23
  13. data/lib/rake/funnel/extensions/shell.rb +92 -56
  14. data/lib/rake/funnel/extensions/windows_path.rb +15 -11
  15. data/lib/rake/funnel/framework.rb +11 -16
  16. data/lib/rake/funnel/integration/progress_report.rb +72 -70
  17. data/lib/rake/funnel/integration/sync_output.rb +12 -8
  18. data/lib/rake/funnel/integration/teamcity/nunit_plugin.rb +61 -55
  19. data/lib/rake/funnel/integration/teamcity/progress_report.rb +39 -33
  20. data/lib/rake/funnel/integration/teamcity/service_messages.rb +46 -40
  21. data/lib/rake/funnel/integration/teamcity/teamcity.rb +19 -15
  22. data/lib/rake/funnel/integration/teamcity.rb +3 -5
  23. data/lib/rake/funnel/support/argument_mapper/key_value_pair.rb +16 -10
  24. data/lib/rake/funnel/support/argument_mapper/styles/default.rb +39 -31
  25. data/lib/rake/funnel/support/argument_mapper/styles/msbuild.rb +41 -33
  26. data/lib/rake/funnel/support/argument_mapper/styles/msdeploy.rb +55 -47
  27. data/lib/rake/funnel/support/argument_mapper/styles/nunit.rb +41 -33
  28. data/lib/rake/funnel/support/argument_mapper/styles.rb +3 -5
  29. data/lib/rake/funnel/support/argument_mapper/switch.rb +16 -10
  30. data/lib/rake/funnel/support/argument_mapper/value.rb +16 -10
  31. data/lib/rake/funnel/support/assembly_version/from_version_files.rb +39 -35
  32. data/lib/rake/funnel/support/assembly_version/languages/cs +5 -5
  33. data/lib/rake/funnel/support/assembly_version/languages/fs +12 -12
  34. data/lib/rake/funnel/support/assembly_version/languages/vb +5 -5
  35. data/lib/rake/funnel/support/assembly_version_writer.rb +56 -52
  36. data/lib/rake/funnel/support/binary_version_reader.rb +37 -32
  37. data/lib/rake/funnel/support/copier.rb +31 -27
  38. data/lib/rake/funnel/support/environments/loader.rb +46 -40
  39. data/lib/rake/funnel/support/environments.rb +3 -3
  40. data/lib/rake/funnel/support/internal/finder.rb +55 -51
  41. data/lib/rake/funnel/support/internal/instantiate_symbol.rb +38 -34
  42. data/lib/rake/funnel/support/mapper.rb +57 -53
  43. data/lib/rake/funnel/support/mono.rb +21 -17
  44. data/lib/rake/funnel/support/msbuild/build_tool.rb +30 -24
  45. data/lib/rake/funnel/support/msbuild.rb +3 -3
  46. data/lib/rake/funnel/support/msdeploy/registry_patch.rb +90 -84
  47. data/lib/rake/funnel/support/msdeploy.rb +3 -3
  48. data/lib/rake/funnel/support/patch.rb +41 -37
  49. data/lib/rake/funnel/support/specs_remover.rb +66 -62
  50. data/lib/rake/funnel/support/template_engine.rb +30 -26
  51. data/lib/rake/funnel/support/timing/report.rb +95 -89
  52. data/lib/rake/funnel/support/timing/statistics.rb +32 -26
  53. data/lib/rake/funnel/support/timing.rb +3 -3
  54. data/lib/rake/funnel/support/version_info.rb +103 -72
  55. data/lib/rake/funnel/support/which.rb +19 -15
  56. data/lib/rake/funnel/support/zipper.rb +53 -49
  57. data/lib/rake/funnel/tasks/assembly_version.rb +44 -40
  58. data/lib/rake/funnel/tasks/bin_path.rb +45 -41
  59. data/lib/rake/funnel/tasks/copy.rb +43 -39
  60. data/lib/rake/funnel/tasks/environments.rb +89 -89
  61. data/lib/rake/funnel/tasks/msbuild.rb +55 -51
  62. data/lib/rake/funnel/tasks/msdeploy.rb +54 -50
  63. data/lib/rake/funnel/tasks/nunit.rb +52 -48
  64. data/lib/rake/funnel/tasks/paket.rb +51 -47
  65. data/lib/rake/funnel/tasks/quick_template.rb +53 -49
  66. data/lib/rake/funnel/tasks/side_by_side_specs.rb +41 -37
  67. data/lib/rake/funnel/tasks/timing.rb +108 -104
  68. data/lib/rake/funnel/tasks/zip.rb +46 -42
  69. data/lib/rake/funnel/version.rb +1 -1
  70. data/lib/rake/funnel.rb +7 -7
  71. data/rake-funnel.gemspec +12 -3
  72. data/spec/rake/funnel/execution_error_spec.rb +67 -67
  73. data/spec/rake/funnel/extensions/case/camel_case_spec.rb +17 -17
  74. data/spec/rake/funnel/extensions/case/pascal_case_spec.rb +17 -17
  75. data/spec/rake/funnel/extensions/common_path_spec.rb +56 -56
  76. data/spec/rake/funnel/extensions/disable_colors_spec.rb +33 -33
  77. data/spec/rake/funnel/extensions/rexml_spec.rb +20 -20
  78. data/spec/rake/funnel/extensions/shell_spec.rb +237 -237
  79. data/spec/rake/funnel/extensions/windows_path_spec.rb +5 -5
  80. data/spec/rake/funnel/integration/progress_report_spec.rb +149 -149
  81. data/spec/rake/funnel/integration/sync_output_spec.rb +16 -16
  82. data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +110 -110
  83. data/spec/rake/funnel/integration/teamcity/progress_report_spec.rb +174 -174
  84. data/spec/rake/funnel/integration/teamcity/service_messages_spec.rb +136 -136
  85. data/spec/rake/funnel/integration/teamcity/teamcity_spec.rb +34 -34
  86. data/spec/rake/funnel/support/argument_mapper/styles/msdeploy_spec.rb +222 -222
  87. data/spec/rake/funnel/support/argument_mapper/styles/nunit_spec.rb +25 -25
  88. data/spec/rake/funnel/support/argument_mapper/styles/styles_spec.rb +214 -214
  89. data/spec/rake/funnel/support/assembly_version/from_version_files_spec.rb +66 -61
  90. data/spec/rake/funnel/support/assembly_version_writer_spec.rb +140 -140
  91. data/spec/rake/funnel/support/binary_version_reader_spec.rb +29 -29
  92. data/spec/rake/funnel/support/copier_spec.rb +58 -58
  93. data/spec/rake/funnel/support/environments/loader_spec.rb +143 -143
  94. data/spec/rake/funnel/support/internal/finder_spec.rb +229 -229
  95. data/spec/rake/funnel/support/internal/instantiate_symbol_spec.rb +182 -183
  96. data/spec/rake/funnel/support/mapper_spec.rb +87 -87
  97. data/spec/rake/funnel/support/mono_spec.rb +57 -57
  98. data/spec/rake/funnel/support/msbuild/build_tool_spec.rb +21 -21
  99. data/spec/rake/funnel/support/msdeploy/registry_patch_spec.rb +139 -139
  100. data/spec/rake/funnel/support/patch_spec.rb +108 -108
  101. data/spec/rake/funnel/support/specs_remover/Sample.csproj +28 -28
  102. data/spec/rake/funnel/support/specs_remover_spec.rb +116 -116
  103. data/spec/rake/funnel/support/template_engine_spec.rb +65 -65
  104. data/spec/rake/funnel/support/timing/report_spec.rb +129 -129
  105. data/spec/rake/funnel/support/version_info_spec.rb +333 -228
  106. data/spec/rake/funnel/support/which_spec.rb +65 -65
  107. data/spec/rake/funnel/support/zipper_spec.rb +77 -77
  108. data/spec/rake/funnel/tasks/assembly_version_spec.rb +45 -45
  109. data/spec/rake/funnel/tasks/bin_path_spec.rb +52 -52
  110. data/spec/rake/funnel/tasks/copy_spec.rb +44 -44
  111. data/spec/rake/funnel/tasks/environments_spec.rb +249 -247
  112. data/spec/rake/funnel/tasks/msbuild_spec.rb +91 -91
  113. data/spec/rake/funnel/tasks/msdeploy_spec.rb +220 -220
  114. data/spec/rake/funnel/tasks/nunit_spec.rb +74 -74
  115. data/spec/rake/funnel/tasks/paket_spec.rb +140 -142
  116. data/spec/rake/funnel/tasks/quick_template_spec.rb +62 -62
  117. data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +58 -58
  118. data/spec/rake/funnel/tasks/timing_spec.rb +133 -133
  119. data/spec/rake/funnel/tasks/zip_spec.rb +50 -50
  120. data/spec/spec_helper.rb +43 -33
  121. metadata +2 -3
  122. data/lib/rake/funnel/support/side_by_side_specs.rb +0 -3
@@ -1,67 +1,67 @@
1
- describe Rake::Funnel::ExecutionError do
2
- its(:to_s) { should == described_class.to_s }
3
-
4
- context 'with command' do
5
- subject { described_class.new('command') }
6
-
7
- its(:command) { should == 'command' }
8
- its(:exit_code) { should be_nil }
9
- its(:output) { should be_nil }
10
- its(:description) { should be_nil }
11
- its(:to_s) { should =~ /^Error executing:\scommand/ }
12
- end
13
-
14
- context 'with command and exit code' do
15
- subject { described_class.new('command', 127) }
16
-
17
- its(:command) { should == 'command' }
18
- its(:exit_code) { should == 127 }
19
- its(:output) { should be_nil }
20
- its(:description) { should be_nil }
21
- its(:to_s) { should =~ /^Error executing:\scommand/ }
22
- its(:to_s) { should =~ /^Exit code: 127/ }
23
- end
24
-
25
- context 'with command and exit code and output' do
26
- subject { described_class.new('command', 127, 'output') }
27
-
28
- its(:command) { should == 'command' }
29
- its(:exit_code) { should == 127 }
30
- its(:output) { should == 'output' }
31
- its(:description) { should be_nil }
32
- its(:to_s) { should =~ /^Error executing:\scommand/ }
33
- its(:to_s) { should =~ /^Exit code: 127/ }
34
- its(:to_s) { should =~ /^Command output \(last 10 lines\):\soutput/ }
35
- end
36
-
37
- context 'with command and exit code and output and message' do
38
- subject { described_class.new('command', 127, 'output', 'description') }
39
-
40
- its(:command) { should == 'command' }
41
- its(:exit_code) { should == 127 }
42
- its(:output) { should == 'output' }
43
- its(:description) { should == 'description' }
44
- its(:to_s) { should =~ /^description/ }
45
- its(:to_s) { should =~ /^Error executing:\scommand/ }
46
- its(:to_s) { should =~ /^Exit code: 127/ }
47
- its(:to_s) { should =~ /^Command output \(last 10 lines\):\soutput/ }
48
- end
49
-
50
- context 'with output longer than 10 lines' do
51
- let(:output) {
52
- output = []
53
-
54
- 11.times.each do |i|
55
- output << "output #{i}"
56
- end
57
-
58
- output.join("\n")
59
- }
60
-
61
- subject { described_class.new(nil, nil, output) }
62
-
63
- it 'should display the last 10 lines of output' do
64
- expect(subject.to_s).not_to match(/^output 0/)
65
- end
66
- end
67
- end
1
+ describe Rake::Funnel::ExecutionError do
2
+ its(:to_s) { should == described_class.to_s }
3
+
4
+ context 'with command' do
5
+ subject { described_class.new('command') }
6
+
7
+ its(:command) { should == 'command' }
8
+ its(:exit_code) { should be_nil }
9
+ its(:output) { should be_nil }
10
+ its(:description) { should be_nil }
11
+ its(:to_s) { should =~ /^Error executing:\scommand/ }
12
+ end
13
+
14
+ context 'with command and exit code' do
15
+ subject { described_class.new('command', 127) }
16
+
17
+ its(:command) { should == 'command' }
18
+ its(:exit_code) { should == 127 }
19
+ its(:output) { should be_nil }
20
+ its(:description) { should be_nil }
21
+ its(:to_s) { should =~ /^Error executing:\scommand/ }
22
+ its(:to_s) { should =~ /^Exit code: 127/ }
23
+ end
24
+
25
+ context 'with command and exit code and output' do
26
+ subject { described_class.new('command', 127, 'output') }
27
+
28
+ its(:command) { should == 'command' }
29
+ its(:exit_code) { should == 127 }
30
+ its(:output) { should == 'output' }
31
+ its(:description) { should be_nil }
32
+ its(:to_s) { should =~ /^Error executing:\scommand/ }
33
+ its(:to_s) { should =~ /^Exit code: 127/ }
34
+ its(:to_s) { should =~ /^Command output \(last 10 lines\):\soutput/ }
35
+ end
36
+
37
+ context 'with command and exit code and output and message' do
38
+ subject { described_class.new('command', 127, 'output', 'description') }
39
+
40
+ its(:command) { should == 'command' }
41
+ its(:exit_code) { should == 127 }
42
+ its(:output) { should == 'output' }
43
+ its(:description) { should == 'description' }
44
+ its(:to_s) { should =~ /^description/ }
45
+ its(:to_s) { should =~ /^Error executing:\scommand/ }
46
+ its(:to_s) { should =~ /^Exit code: 127/ }
47
+ its(:to_s) { should =~ /^Command output \(last 10 lines\):\soutput/ }
48
+ end
49
+
50
+ context 'with output longer than 10 lines' do
51
+ let(:output) {
52
+ output = []
53
+
54
+ 11.times.each do |i|
55
+ output << "output #{i}"
56
+ end
57
+
58
+ output.join("\n")
59
+ }
60
+
61
+ subject { described_class.new(nil, nil, output) }
62
+
63
+ it 'should display the last 10 lines of output' do
64
+ expect(subject.to_s).not_to match(/^output 0/)
65
+ end
66
+ end
67
+ end
@@ -1,17 +1,17 @@
1
- describe Rake::Funnel::Extensions::CamelCase do
2
- it 'should not touch values without underscores' do
3
- expect('foo'.camelize).to eq('foo')
4
- end
5
-
6
- it 'should convert strings with underscores' do
7
- expect('foo_bar'.camelize).to eq('fooBar')
8
- end
9
-
10
- it 'should convert symbols to string' do
11
- expect(:foo.camelize).to eq('foo')
12
- end
13
-
14
- it 'should convert symbols with underscores' do
15
- expect(:foo_bar.camelize).to eq('fooBar')
16
- end
17
- end
1
+ describe Rake::Funnel::Extensions::Case::CamelCase do
2
+ it 'should not touch values without underscores' do
3
+ expect('foo'.camelize).to eq('foo')
4
+ end
5
+
6
+ it 'should convert strings with underscores' do
7
+ expect('foo_bar'.camelize).to eq('fooBar')
8
+ end
9
+
10
+ it 'should convert symbols to string' do
11
+ expect(:foo.camelize).to eq('foo')
12
+ end
13
+
14
+ it 'should convert symbols with underscores' do
15
+ expect(:foo_bar.camelize).to eq('fooBar')
16
+ end
17
+ end
@@ -1,17 +1,17 @@
1
- describe Rake::Funnel::Extensions::PascalCase do
2
- it 'should convert strings' do
3
- expect('foo'.pascalize).to eq('Foo')
4
- end
5
-
6
- it 'should convert strings with underscores' do
7
- expect('foo_bar'.pascalize).to eq('FooBar')
8
- end
9
-
10
- it 'should convert symbols to string' do
11
- expect(:foo.pascalize).to eq('Foo')
12
- end
13
-
14
- it 'should convert symbols with underscores' do
15
- expect(:foo_bar.pascalize).to eq('FooBar')
16
- end
17
- end
1
+ describe Rake::Funnel::Extensions::Case::PascalCase do
2
+ it 'should convert strings' do
3
+ expect('foo'.pascalize).to eq('Foo')
4
+ end
5
+
6
+ it 'should convert strings with underscores' do
7
+ expect('foo_bar'.pascalize).to eq('FooBar')
8
+ end
9
+
10
+ it 'should convert symbols to string' do
11
+ expect(:foo.pascalize).to eq('Foo')
12
+ end
13
+
14
+ it 'should convert symbols with underscores' do
15
+ expect(:foo_bar.pascalize).to eq('FooBar')
16
+ end
17
+ end
@@ -1,56 +1,56 @@
1
- describe Rake::Funnel::Extensions::CommonPath do
2
- describe 'Manual debugging test case' do
3
- it 'should work' do
4
- expect(%w(/common/one /com/two).common_path).to be
5
-
6
- skip('for manual testing only')
7
- end
8
- end
9
-
10
- describe 'modification of FileList' do
11
- it 'should not modify the input' do
12
- input = FileList[File.join(File.dirname(__FILE__), '**/*')]
13
- duped = input.dup
14
-
15
- expect(input.common_path).to be
16
- expect(input).to match_array(duped)
17
- end
18
- end
19
-
20
- {
21
- array: [
22
- { input: [], expected: '' },
23
- { input: %w(one two), expected: '' },
24
- { input: %w(1-common 2-common), expected: '' },
25
- { input: %w(common.1 common-2), expected: '' },
26
- { input: %w(common-1 common-2), expected: '' },
27
- { input: %w(/common common), expected: '' },
28
- { input: %w(/ /foo), expected: '/' },
29
- { input: %w(/common/one /com/two), expected: '/' },
30
- { input: %w(/common/1 /common/2), expected: '/common' },
31
- { input: %w(/common/1 /common/2 /common/3/4), expected: '/common' },
32
- { input: %w(/common /common), expected: '/common' },
33
- { input: %w(/common /common/), expected: '/common' },
34
- { input: %w(/common/ /common/), expected: '/common' },
35
- { input: ['common/ 1', 'common/ 2'], expected: 'common' },
36
- { input: ['com mon/1', 'com mon/2'], expected: 'com mon' },
37
- { input: [' common/1', ' common/2'], expected: ' common' },
38
- { input: ['common /1', 'common /2'], expected: 'common ' },
39
- { input: [''], expected: '' },
40
- { input: ['', nil], expected: '' }
41
- ],
42
- file_list: [
43
- { input: FileList.new, expected: '' },
44
- { input: FileList['lib/*', 'spec/*'], expected: '' },
45
- { input: FileList['spec/*'], expected: 'spec' }
46
- ]
47
- }.each do |group, pairs|
48
- describe group do
49
- pairs.each do |pair|
50
- it "#{pair[:input]} should equal '#{pair[:expected]}'" do
51
- expect(pair[:input].common_path).to eq(pair[:expected])
52
- end
53
- end
54
- end
55
- end
56
- end
1
+ describe Rake::Funnel::Extensions::CommonPath do
2
+ describe 'Manual debugging test case' do
3
+ it 'should work' do
4
+ expect(%w(/common/one /com/two).common_path).to be
5
+
6
+ skip('for manual testing only')
7
+ end
8
+ end
9
+
10
+ describe 'modification of FileList' do
11
+ it 'should not modify the input' do
12
+ input = FileList[File.join(File.dirname(__FILE__), '**/*')]
13
+ duped = input.dup
14
+
15
+ expect(input.common_path).to be
16
+ expect(input).to match_array(duped)
17
+ end
18
+ end
19
+
20
+ {
21
+ array: [
22
+ { input: [], expected: '' },
23
+ { input: %w(one two), expected: '' },
24
+ { input: %w(1-common 2-common), expected: '' },
25
+ { input: %w(common.1 common-2), expected: '' },
26
+ { input: %w(common-1 common-2), expected: '' },
27
+ { input: %w(/common common), expected: '' },
28
+ { input: %w(/ /foo), expected: '/' },
29
+ { input: %w(/common/one /com/two), expected: '/' },
30
+ { input: %w(/common/1 /common/2), expected: '/common' },
31
+ { input: %w(/common/1 /common/2 /common/3/4), expected: '/common' },
32
+ { input: %w(/common /common), expected: '/common' },
33
+ { input: %w(/common /common/), expected: '/common' },
34
+ { input: %w(/common/ /common/), expected: '/common' },
35
+ { input: ['common/ 1', 'common/ 2'], expected: 'common' },
36
+ { input: ['com mon/1', 'com mon/2'], expected: 'com mon' },
37
+ { input: [' common/1', ' common/2'], expected: ' common' },
38
+ { input: ['common /1', 'common /2'], expected: 'common ' },
39
+ { input: [''], expected: '' },
40
+ { input: ['', nil], expected: '' }
41
+ ],
42
+ file_list: [
43
+ { input: FileList.new, expected: '' },
44
+ { input: FileList['lib/*', 'spec/*'], expected: '' },
45
+ { input: FileList['spec/*'], expected: 'spec' }
46
+ ]
47
+ }.each do |group, pairs|
48
+ describe group do
49
+ pairs.each do |pair|
50
+ it "#{pair[:input]} should equal '#{pair[:expected]}'" do
51
+ expect(pair[:input].common_path).to eq(pair[:expected])
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,33 +1,33 @@
1
- describe Rake::Funnel::Extensions::DisableColors do
2
- context 'when connected to a terminal' do
3
- before { allow($stdout).to receive(:tty?).and_return(true) }
4
-
5
- it 'should color strings' do
6
- expect('foo'.colored.green).to eq("\e[32mfoo\e[0m")
7
- end
8
-
9
- it 'should color strings with extension' do
10
- expect('foo'.green).to eq("\e[32mfoo\e[0m")
11
- end
12
-
13
- it 'should support combinators' do
14
- expect('foo'.green.inverse.bold).to eq("\e[1;7;32mfoo\e[0m")
15
- end
16
- end
17
-
18
- context 'when not connected to a terminal' do
19
- before { allow($stdout).to receive(:tty?).and_return(false) }
20
-
21
- it 'should not color strings' do
22
- expect('foo'.colored.green).to eq('foo')
23
- end
24
-
25
- it 'should not color strings with extension' do
26
- expect('foo'.green).to eq('foo')
27
- end
28
-
29
- it 'should support combinators' do
30
- expect('foo'.green.inverse.bold).to eq('foo')
31
- end
32
- end
33
- end
1
+ describe Rake::Funnel::Extensions::DisableColors do
2
+ context 'when connected to a terminal' do
3
+ before { allow($stdout).to receive(:tty?).and_return(true) }
4
+
5
+ it 'should color strings' do
6
+ expect('foo'.colored.green).to eq("\e[32mfoo\e[0m")
7
+ end
8
+
9
+ it 'should color strings with extension' do
10
+ expect('foo'.green).to eq("\e[32mfoo\e[0m")
11
+ end
12
+
13
+ it 'should support combinators' do
14
+ expect('foo'.green.inverse.bold).to eq("\e[1;7;32mfoo\e[0m")
15
+ end
16
+ end
17
+
18
+ context 'when not connected to a terminal' do
19
+ before { allow($stdout).to receive(:tty?).and_return(false) }
20
+
21
+ it 'should not color strings' do
22
+ expect('foo'.colored.green).to eq('foo')
23
+ end
24
+
25
+ it 'should not color strings with extension' do
26
+ expect('foo'.green).to eq('foo')
27
+ end
28
+
29
+ it 'should support combinators' do
30
+ expect('foo'.green.inverse.bold).to eq('foo')
31
+ end
32
+ end
33
+ end
@@ -1,20 +1,20 @@
1
- describe Rake::Funnel::Extensions::REXML::Functions do
2
- let(:xml) { <<EOF
3
- <editors xmlns="http://example.com">
4
- <editor id="emacs">EMACS</editor>
5
- <editor id="vi">VIM</editor>
6
- <editor id="notepad">Notepad</editor>
7
- </editors>
8
- EOF
9
- }
10
-
11
- subject { REXML::Document.new(xml) }
12
-
13
- it 'should support lower-case function' do
14
- expect(REXML::XPath.match(subject, "//editor[lower-case(text())='vim']").first.to_s).to match(/VIM/)
15
- end
16
-
17
- it 'should support matches function' do
18
- expect(REXML::XPath.match(subject, "//editor[matches(@id, '*pad')]").first.to_s).to match(/Notepad/)
19
- end
20
- end
1
+ describe Rake::Funnel::Extensions::REXML::Functions do
2
+ let(:xml) { <<EOF
3
+ <editors xmlns="http://example.com">
4
+ <editor id="emacs">EMACS</editor>
5
+ <editor id="vi">VIM</editor>
6
+ <editor id="notepad">Notepad</editor>
7
+ </editors>
8
+ EOF
9
+ }
10
+
11
+ subject { REXML::Document.new(xml) }
12
+
13
+ it 'should support lower-case function' do
14
+ expect(REXML::XPath.match(subject, "//editor[lower-case(text())='vim']").first.to_s).to match(/VIM/)
15
+ end
16
+
17
+ it 'should support matches function' do
18
+ expect(REXML::XPath.match(subject, "//editor[matches(@id, '*pad')]").first.to_s).to match(/Notepad/)
19
+ end
20
+ end