vedeu 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -4
  3. data/lib/vedeu/configuration.rb +2 -2
  4. data/lib/vedeu/launcher.rb +2 -2
  5. data/lib/vedeu/models/command.rb +1 -1
  6. data/lib/vedeu/models/interface.rb +4 -0
  7. data/lib/vedeu/output/interface_renderer.rb +1 -1
  8. data/lib/vedeu/output/template.rb +23 -0
  9. data/lib/vedeu/output/text_adaptor.rb +1 -1
  10. data/lib/vedeu/process/process.rb +5 -1
  11. data/lib/vedeu/repository/command_repository.rb +3 -5
  12. data/lib/vedeu/repository/event_repository.rb +27 -0
  13. data/lib/vedeu/repository/interface_repository.rb +8 -6
  14. data/lib/vedeu/repository/storage.rb +2 -0
  15. data/lib/vedeu/support/esc.rb +2 -1
  16. data/lib/vedeu/support/geometry.rb +11 -23
  17. data/lib/vedeu/support/parser.rb +1 -1
  18. data/lib/vedeu/support/queue.rb +3 -1
  19. data/lib/vedeu.rb +18 -1
  20. data/test/example_app/bin/app +9 -0
  21. data/test/example_app/lib/app.rb +63 -0
  22. data/test/lib/vedeu/application_test.rb +6 -36
  23. data/test/lib/vedeu/configuration_test.rb +5 -31
  24. data/test/lib/vedeu/input/input_test.rb +4 -16
  25. data/test/lib/vedeu/launcher_test.rb +6 -15
  26. data/test/lib/vedeu/models/background_test.rb +5 -21
  27. data/test/lib/vedeu/models/colour_test.rb +18 -49
  28. data/test/lib/vedeu/models/command_test.rb +19 -83
  29. data/test/lib/vedeu/models/composition_test.rb +78 -175
  30. data/test/lib/vedeu/models/foreground_test.rb +4 -21
  31. data/test/lib/vedeu/models/interface_collection_test.rb +13 -45
  32. data/test/lib/vedeu/models/interface_test.rb +71 -195
  33. data/test/lib/vedeu/models/line_collection_test.rb +13 -52
  34. data/test/lib/vedeu/models/line_test.rb +17 -61
  35. data/test/lib/vedeu/models/presentation_test.rb +6 -19
  36. data/test/lib/vedeu/models/stream_collection_test.rb +10 -42
  37. data/test/lib/vedeu/models/stream_test.rb +16 -54
  38. data/test/lib/vedeu/models/style_collection_test.rb +1 -10
  39. data/test/lib/vedeu/output/interface_renderer_test.rb +7 -38
  40. data/test/lib/vedeu/output/output_test.rb +1 -18
  41. data/test/lib/vedeu/output/template.rb +20 -0
  42. data/test/lib/vedeu/output/text_adaptor_test.rb +9 -46
  43. data/test/lib/vedeu/process/process_test.rb +36 -38
  44. data/test/lib/vedeu/repository/command_repository_test.rb +16 -45
  45. data/test/lib/vedeu/repository/interface_repository_test.rb +36 -74
  46. data/test/lib/vedeu/repository/repository_test.rb +9 -33
  47. data/test/lib/vedeu/repository/storage_test.rb +7 -42
  48. data/test/lib/vedeu/support/esc_test.rb +46 -130
  49. data/test/lib/vedeu/support/event_repository_test.rb +31 -0
  50. data/test/lib/vedeu/support/exit_test.rb +1 -9
  51. data/test/lib/vedeu/support/geometry_test.rb +81 -105
  52. data/test/lib/vedeu/support/parser_test.rb +10 -54
  53. data/test/lib/vedeu/support/parsing/hash_parser_test.rb +18 -33
  54. data/test/lib/vedeu/support/parsing/json_parser_test.rb +4 -23
  55. data/test/lib/vedeu/support/queue_test.rb +33 -57
  56. data/test/lib/vedeu/support/terminal_test.rb +21 -52
  57. data/test/lib/vedeu/support/translator_test.rb +16 -33
  58. data/test/lib/vedeu/support/wordwrap_test.rb +29 -46
  59. data/test/lib/vedeu_test.rb +3 -5
  60. data/test/support/template.erb +3 -0
  61. data/test/test_helper.rb +1 -12
  62. data/vedeu.gemspec +8 -10
  63. metadata +26 -38
  64. data/lib/vedeu/support/events.rb +0 -21
  65. data/lib/vedeu/version.rb +0 -3
  66. data/test/lib/vedeu/support/events_test.rb +0 -45
  67. data/test/lib/vedeu/version_test.rb +0 -12
  68. data/test/support/output_1.json +0 -9
  69. data/test/support/output_1.rb +0 -14
@@ -3,67 +3,23 @@ require_relative '../../../../lib/vedeu/support/parser'
3
3
 
4
4
  module Vedeu
5
5
  describe Parser do
6
- let(:described_class) { Parser }
7
- let(:subject) { described_class.new(output) }
8
- let(:output) { File.read('test/support/output_1.json') }
9
-
10
- describe '#initialize' do
11
- let(:subject) { described_class.new(output) }
12
-
13
- it 'returns a Parser instance' do
14
- subject.must_be_instance_of(Parser)
15
- end
16
-
17
- it 'sets an instance variable' do
18
- subject.instance_variable_get("@output").must_equal(output)
19
- end
20
-
21
- context 'when the instance variable is nil' do
22
- let(:subject) { described_class.new }
23
-
24
- it 'set an instance variable' do
25
- subject.instance_variable_get("@output").must_equal({})
26
- end
27
- end
28
- end
29
-
30
6
  describe '#parse' do
31
- let(:subject) { described_class.parse(output) }
32
-
33
- context 'when the output is empty' do
34
- let(:output) {}
35
-
36
- it 'returns a NilClass' do
37
- subject.must_be_instance_of(NilClass)
38
- end
7
+ it 'returns a NilClass when the output is empty' do
8
+ Parser.parse.must_be_instance_of(NilClass)
39
9
  end
40
10
 
41
- context 'when the output is JSON' do
42
- let(:output) { "{\"some\": \"JSON\"}" }
43
-
44
- it 'returns a Composition' do
45
- subject.must_be_instance_of(Composition)
46
- end
11
+ it 'returns a Composition when the output is JSON' do
12
+ Parser.parse("{\"some\": \"JSON\"}").must_be_instance_of(Composition)
47
13
  end
48
14
 
49
- context 'when the output is a Hash' do
50
- let(:output) {
51
- {
52
- dummy: 'Some text...'
53
- }
54
- }
55
-
56
- it 'returns a Composition' do
57
- subject.must_be_instance_of(Composition)
58
- end
15
+ it 'returns a Composition when the output is a Hash' do
16
+ Parser.parse({
17
+ parser_parse: 'Parser#parse'
18
+ }).must_be_instance_of(Composition)
59
19
  end
60
20
 
61
- context 'when the output is anything else' do
62
- let(:output) { [:invalid] }
63
-
64
- it 'raises an exception' do
65
- proc { subject }.must_raise(ParseError)
66
- end
21
+ it 'raises an exception when the output is anything else' do
22
+ proc { Parser.parse([:invalid]) }.must_raise(ParseError)
67
23
  end
68
24
  end
69
25
  end
@@ -3,42 +3,27 @@ require_relative '../../../../../lib/vedeu/support/parsing/hash_parser'
3
3
 
4
4
  module Vedeu
5
5
  describe HashParser do
6
- let(:described_module) { HashParser }
7
- let(:output) { {} }
8
-
9
6
  describe '.parse' do
10
- let(:subject) { described_module.parse(output) }
11
- let(:lines) { mock }
12
-
13
- before { TextAdaptor.stubs(:adapt).returns(lines) }
14
-
15
- it 'returns a Hash' do
16
- subject.must_be_instance_of(Hash)
7
+ it 'returns a Hash when the output is content for multiple interfaces' do
8
+ HashParser.parse({
9
+ test: 'Some content...',
10
+ dummy: 'More content...'
11
+ }).must_equal({
12
+ interfaces: [
13
+ { name: "test", lines: [{ streams: { text: "Some content..." } }] },
14
+ { name: "dummy", lines: [{streams: { text: "More content..." } }] }
15
+ ]
16
+ })
17
17
  end
18
18
 
19
- context 'when the output is content for a collection of interfaces' do
20
- let(:output) {
21
- {
22
- test: 'Some content...',
23
- dummy: 'More content...'
24
- }
25
- }
26
-
27
- it 'returns a Hash' do
28
- subject.must_equal({ interfaces: [{ name: 'test', lines: lines }, { name: 'dummy', lines: lines }] })
29
- end
30
- end
31
-
32
- context 'when the output is content for a single interface' do
33
- let(:output) {
34
- {
35
- dummy: 'Some content...'
36
- }
37
- }
38
-
39
- it 'returns a Hash' do
40
- subject.must_equal({ interfaces: [{ name: 'dummy', lines: lines }] })
41
- end
19
+ it 'returns a Hash when the output is content for a single interface' do
20
+ HashParser.parse({
21
+ dummy: 'Some content...'
22
+ }).must_equal({
23
+ interfaces: [
24
+ { name: "dummy", lines: [{ streams: { text: "Some content..." } }] }
25
+ ]
26
+ })
42
27
  end
43
28
  end
44
29
  end
@@ -3,32 +3,13 @@ require_relative '../../../../../lib/vedeu/support/parsing/json_parser'
3
3
 
4
4
  module Vedeu
5
5
  describe JSONParser do
6
- let(:described_module) { JSONParser }
7
- let(:output) { "{}" }
8
-
9
6
  describe '.parse' do
10
- let(:subject) { described_module.parse(output) }
11
-
12
- it 'returns a Hash' do
13
- subject.must_be_instance_of(Hash)
7
+ it 'returns a hash when the JSON is valid' do
8
+ JSONParser.parse("{\"some\": \"JSON\"}").must_be_instance_of(Hash)
14
9
  end
15
10
 
16
- context 'when the JSON is valid' do
17
- let(:output) { File.read('test/support/json/int1_lin1_str1.json')}
18
-
19
- it 'returns a Hash' do
20
- subject.must_be_instance_of(Hash)
21
- end
22
- end
23
-
24
- context 'when the JSON is invalid' do
25
- let(:output) { "{}" }
26
-
27
- before { Oj.stubs(:load).raises(Oj::ParseError) }
28
-
29
- it 'returns a Hash' do
30
- subject.must_be_instance_of(Hash)
31
- end
11
+ it 'returns an empty hash when the JSON is invalid' do
12
+ JSONParser.parse("{ invalid JSON }").must_be_instance_of(Hash)
32
13
  end
33
14
  end
34
15
  end
@@ -3,94 +3,70 @@ require_relative '../../../../lib/vedeu/support/queue'
3
3
 
4
4
  module Vedeu
5
5
  describe Queue do
6
- let(:described_class) { Queue }
7
-
8
6
  describe '.dequeue' do
9
- let(:subject) { described_class.dequeue }
10
-
11
- context 'when the queue is empty' do
12
- it 'returns a NilClass' do
13
- subject.must_be_instance_of(NilClass)
14
- end
7
+ it 'returns a NilClass when the queue is empty' do
8
+ Queue.reset
9
+ Queue.dequeue.must_be_instance_of(NilClass)
15
10
  end
16
11
 
17
- context 'when the queue is not empty' do
18
- before { described_class.enqueue(:result) }
19
- after { described_class.clear }
20
-
21
- it 'returns the first entry added' do
22
- subject.must_be_instance_of(Symbol)
23
- end
12
+ it 'returns the first entry added when the queue is not empty' do
13
+ Queue.reset
14
+ Queue.enqueue(:result)
15
+ Queue.dequeue.must_be_instance_of(Symbol)
24
16
  end
25
17
  end
26
18
 
27
19
  describe '.enqueue' do
28
- let(:subject) { described_class.enqueue(:result) }
29
-
30
- before { described_class.clear }
31
- after { described_class.clear }
32
-
33
- it 'returns an Array' do
34
- subject.must_be_instance_of(Array)
35
- end
36
-
37
20
  it 'contains the enqueued item' do
38
- subject.size.must_equal(1)
21
+ Queue.reset
22
+ Queue.enqueue(:result).size.must_equal(1)
39
23
  end
40
24
  end
41
25
 
42
26
  describe '.enqueued?' do
43
- let(:subject) { described_class.enqueued? }
44
-
45
- context 'when the queue contains data' do
46
- before { described_class.enqueue(:result) }
47
- after { described_class.clear }
48
-
49
- it 'returns a TrueClass' do
50
- subject.must_be_instance_of(TrueClass)
51
- end
27
+ it 'returns true when the queue is not empty' do
28
+ Queue.reset
29
+ Queue.enqueue(:result)
30
+ Queue.enqueued?.must_be_instance_of(TrueClass)
52
31
  end
53
32
 
54
- context 'when the queue is empty' do
55
- it 'returns a FalseClass' do
56
- subject.must_be_instance_of(FalseClass)
57
- end
33
+ it 'returns false when the queue is empty' do
34
+ Queue.reset
35
+ Queue.enqueued?.must_be_instance_of(FalseClass)
58
36
  end
59
37
  end
60
38
 
61
39
  describe '.size' do
62
- let(:subject) { described_class.size }
63
-
64
- it 'returns a Fixnum' do
65
- subject.must_be_instance_of(Fixnum)
40
+ it 'returns the size of the queue when the queue is empty' do
41
+ Queue.reset
42
+ Queue.size.must_equal(0)
66
43
  end
67
44
 
68
- it 'returns the size of the queue' do
69
- subject.must_equal(0)
45
+ it 'returns the size of the queue when the queue is not empty' do
46
+ Queue.reset
47
+ Queue.enqueue(:result).enqueue(:result)
48
+ Queue.size.must_equal(2)
70
49
  end
71
50
  end
72
51
 
73
52
  describe '.clear' do
74
- let(:subject) { described_class.clear }
75
-
76
- it 'returns an Array' do
77
- subject.must_be_instance_of(Array)
78
- end
79
-
80
53
  it 'returns an empty array' do
81
- subject.must_be_empty
54
+ Queue.reset
55
+ Queue.enqueue(:result)
56
+ Queue.reset.must_be_empty
82
57
  end
83
58
  end
84
59
 
85
60
  describe '.view' do
86
- let(:subject) { described_class.view }
87
-
88
- it 'returns a String' do
89
- subject.must_be_instance_of(String)
61
+ it 'returns the queue as a String when the queue is empty' do
62
+ Queue.reset
63
+ Queue.view.must_equal('[]')
90
64
  end
91
65
 
92
- it 'returns the queue as a String' do
93
- subject.must_equal('[]')
66
+ it 'returns the queue as a String when the queue is not empty' do
67
+ Queue.reset
68
+ Queue.enqueue(:result)
69
+ Queue.view.must_equal('[:result]')
94
70
  end
95
71
  end
96
72
  end
@@ -3,90 +3,59 @@ require_relative '../../../../lib/vedeu/support/terminal'
3
3
 
4
4
  module Vedeu
5
5
  describe Terminal do
6
- let(:described_class) { Terminal }
7
- let(:console) { stub }
8
-
9
- before do
10
- IO.stubs(:console).returns(console)
11
- console.stubs(:winsize).returns([25, 80])
12
- console.stubs(:print)
13
- end
14
-
15
6
  describe '.input' do
16
- let(:subject) { described_class.input }
17
-
18
- before { console.stubs(:gets).returns("test\n") }
19
-
20
- it 'returns a String' do
21
- subject.must_be_instance_of(String)
22
- end
23
-
24
7
  it 'returns the entered string' do
25
- subject.must_equal('test')
8
+ console = IO.console
9
+ console.stub :gets, "test\n" do
10
+ Terminal.input.must_equal('test')
11
+ end
26
12
  end
27
13
  end
28
14
 
29
15
  describe '.output' do
30
- let(:subject) { described_class.output }
31
-
32
- it 'returns a String' do
33
- subject.must_be_instance_of(String)
34
- end
35
-
36
16
  it 'returns the output' do
37
- subject.must_equal('')
17
+ Terminal.output.must_equal('')
38
18
  end
39
19
  end
40
20
 
41
21
  describe '.width' do
42
- let(:subject) { described_class.width }
43
-
44
- it 'returns a Fixnum' do
45
- subject.must_be_instance_of(Fixnum)
46
- end
47
-
48
22
  it 'returns the width of the terminal' do
49
- subject.must_equal(80)
23
+ console = IO.console
24
+ console.stub :winsize, [25, 80] do
25
+ Terminal.width.must_equal(80)
26
+ end
50
27
  end
51
28
  end
52
29
 
53
30
  describe '.height' do
54
- let(:subject) { described_class.height }
55
-
56
- it 'returns a Fixnum' do
57
- subject.must_be_instance_of(Fixnum)
58
- end
59
-
60
31
  it 'returns the height of the terminal' do
61
- subject.must_equal(25)
32
+ console = IO.console
33
+ console.stub :winsize, [25, 80] do
34
+ Terminal.height.must_equal(25)
35
+ end
62
36
  end
63
37
  end
64
38
 
65
39
  describe '.size' do
66
- let(:subject) { described_class.size }
67
-
68
- it 'returns an Array' do
69
- subject.must_be_instance_of(Array)
70
- end
71
-
72
40
  it 'returns the width and height of the terminal' do
73
- subject.must_equal([25, 80])
41
+ console = IO.console
42
+ console.stub :winsize, [25, 80] do
43
+ Terminal.size.must_equal([25, 80])
44
+ end
74
45
  end
75
46
  end
76
47
 
77
48
  describe '.open' do
78
- let(:subject) { described_class.open }
79
-
80
49
  it 'returns a NilClass' do
81
- subject.must_be_instance_of(NilClass)
50
+ skip
51
+ Terminal.open.must_be_instance_of(NilClass)
82
52
  end
83
53
  end
84
54
 
85
55
  describe '.console' do
86
- let(:subject) { described_class.console }
87
-
88
56
  it 'returns the console' do
89
- subject.must_equal(console)
57
+ console = IO.console
58
+ Terminal.console.must_equal(console)
90
59
  end
91
60
  end
92
61
  end
@@ -3,17 +3,6 @@ require_relative '../../../../lib/vedeu/support/translator'
3
3
 
4
4
  module Vedeu
5
5
  describe Translator do
6
- let(:described_class) { Translator }
7
- let(:html_colour) {}
8
-
9
- describe '#initialize' do
10
- let(:subject) { described_class.new(html_colour) }
11
-
12
- it 'returns a Translator instance' do
13
- subject.must_be_instance_of(Translator)
14
- end
15
- end
16
-
17
6
  describe '#translate' do
18
7
  {
19
8
  '#ff0000' => 196, # red
@@ -23,35 +12,29 @@ module Vedeu
23
12
  '#aadd00' => 148, # lime green
24
13
  '#b94f1c' => 130, # sunset orange
25
14
  }.map do |html_colour, terminal_colour|
26
- context 'valid' do
27
- it 'translation is performed' do
28
- described_class.translate(html_colour).must_be_instance_of(Fixnum)
29
-
30
- described_class.translate(html_colour).must_equal(terminal_colour)
31
- end
15
+ it 'translation is performed' do
16
+ Translator.translate(html_colour).must_equal(terminal_colour)
32
17
  end
33
18
  end
34
19
 
35
- context 'invalid' do
36
- it 'returns empty string when not present' do
37
- described_class.translate.must_equal('')
38
- end
20
+ it 'returns empty string when not present' do
21
+ Translator.translate.must_equal('')
22
+ end
39
23
 
40
- it 'returns empty string when the wrong type!' do
41
- described_class.translate(:wrong_type).must_equal('')
42
- end
24
+ it 'returns empty string when the wrong type!' do
25
+ Translator.translate(:wrong_type).must_equal('')
26
+ end
43
27
 
44
- it 'returns empty string when invalid format' do
45
- described_class.translate('345678').must_equal('')
46
- end
28
+ it 'returns empty string when invalid format' do
29
+ Translator.translate('345678').must_equal('')
30
+ end
47
31
 
48
- it 'returns empty string when invalid format' do
49
- described_class.translate('#h11111').must_equal('')
50
- end
32
+ it 'returns empty string when invalid format' do
33
+ Translator.translate('#h11111').must_equal('')
34
+ end
51
35
 
52
- it 'returns empty string when invalid format' do
53
- described_class.translate('#1111').must_equal('')
54
- end
36
+ it 'returns empty string when invalid format' do
37
+ Translator.translate('#1111').must_equal('')
55
38
  end
56
39
  end
57
40
  end
@@ -3,70 +3,53 @@ require_relative '../../../../lib/vedeu/support/wordwrap'
3
3
 
4
4
  module Vedeu
5
5
  describe Wordwrap do
6
- let(:described_class) { Wordwrap }
7
- let(:value) {
8
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' \
9
- "Curabitur aliquet turpis id dui condimentum elementum.\n" \
10
- 'Pellentesque blandit vulputate imperdiet. Quisque ut arcu ' \
11
- "dolor. Morbi nec vulputate purus.\n\nQuisque porta feugiat " \
12
- 'egestas. Aenean ac ipsum varius, lobortis lacus at, mattis ' \
13
- "est.\nQuisque viverra facilisis tortor, id convallis metus " \
14
- 'laoreet quis. Curabitur auctor nunc blandit enim volutpat ' \
15
- 'hendrerit. Phasellus accumsan tempor iaculis. Ut in semper ' \
16
- "massa. Cras quis viverra elit.\n\nInteger vitae mattis est. " \
17
- 'Cras id nisl porttitor lectus placerat gravida sit amet ' \
18
- "quis diam.\n\nDonec mollis, nisi sit amet congue sagittis, " \
19
- 'sapien magna rhoncus justo, vel molestie metus sapien eget ' \
20
- "libero.\n\n\n"
21
- }
22
- let(:options) { {} }
23
-
24
6
  describe '#wordwrap' do
25
7
  let(:formatted_value) {
26
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " \
8
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' \
27
9
  "Curabitur\naliquet turpis id dui condimentum elementum.\n" \
28
- "Pellentesque blandit vulputate imperdiet. Quisque ut arcu " \
10
+ 'Pellentesque blandit vulputate imperdiet. Quisque ut arcu ' \
29
11
  "dolor.\nMorbi nec vulputate purus.\n\nQuisque porta " \
30
12
  "feugiat egestas. Aenean ac ipsum varius, lobortis\nlacus " \
31
13
  "at, mattis est.\nQuisque viverra facilisis tortor, id " \
32
14
  "convallis metus laoreet quis.\nCurabitur auctor nunc " \
33
15
  "blandit enim volutpat hendrerit. Phasellus\naccumsan " \
34
- "tempor iaculis. Ut in semper massa. Cras quis viverra " \
16
+ 'tempor iaculis. Ut in semper massa. Cras quis viverra ' \
35
17
  "elit.\n\nInteger vitae mattis est. Cras id nisl porttitor " \
36
18
  "lectus placerat\ngravida sit amet quis diam.\n\nDonec " \
37
- "mollis, nisi sit amet congue sagittis, sapien magna " \
19
+ 'mollis, nisi sit amet congue sagittis, sapien magna ' \
38
20
  "rhoncus\njusto, vel molestie metus sapien eget libero."
39
21
  }
40
22
 
41
- subject { described_class.this(value, options) }
42
-
43
- it 'returns a String' do
44
- subject.must_be_instance_of(String)
45
- end
46
-
47
23
  it 'returns formatted text' do
48
- subject.must_equal(formatted_value)
24
+ value =
25
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' \
26
+ "Curabitur aliquet turpis id dui condimentum elementum.\n" \
27
+ 'Pellentesque blandit vulputate imperdiet. Quisque ut arcu ' \
28
+ "dolor. Morbi nec vulputate purus.\n\nQuisque porta feugiat " \
29
+ 'egestas. Aenean ac ipsum varius, lobortis lacus at, mattis ' \
30
+ "est.\nQuisque viverra facilisis tortor, id convallis metus " \
31
+ 'laoreet quis. Curabitur auctor nunc blandit enim volutpat ' \
32
+ 'hendrerit. Phasellus accumsan tempor iaculis. Ut in semper ' \
33
+ "massa. Cras quis viverra elit.\n\nInteger vitae mattis est." \
34
+ ' Cras id nisl porttitor lectus placerat gravida sit amet ' \
35
+ "quis diam.\n\nDonec mollis, nisi sit amet congue sagittis, " \
36
+ 'sapien magna rhoncus justo, vel molestie metus sapien eget ' \
37
+ "libero.\n\n\n"
38
+ Wordwrap.this(value, {}).must_equal(formatted_value)
49
39
  end
50
40
 
51
- context 'when the content should be pruned' do
52
- let(:options) { { width: 70, prune: true } }
53
- let(:formatted_value) {
54
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' \
55
- " Curabitur a..."
56
- }
57
-
58
- it 'returns formatted text' do
59
- subject.must_equal(formatted_value)
60
- end
41
+ it 'returns formatted text when the content should be pruned' do
42
+ value = 'Lorem ipsum dolor sit amet, consectetur ' \
43
+ 'adipiscing elit. Curabitur aviverra facil tortor.'
44
+ result = 'Lorem ipsum dolor sit amet, consectetur ' \
45
+ 'adipiscing elit. Curabitur a...'
46
+ Wordwrap.this(value, { width: 70, prune: true })
47
+ .must_equal(result)
61
48
  end
62
49
 
63
- context 'when the content is less than the prune size' do
64
- let(:options) { { width: 70, prune: true } }
65
- let(:value) { 'Some text...' }
66
-
67
- it 'returns formatted text' do
68
- subject.must_equal(value)
69
- end
50
+ it 'returns formatted text when the content is less than the prune size' do
51
+ Wordwrap.this('Wordwrap.this', { width: 70, prune: true })
52
+ .must_equal('Wordwrap.this')
70
53
  end
71
54
  end
72
55
  end
@@ -2,11 +2,9 @@ require_relative '../test_helper'
2
2
  require_relative '../../lib/vedeu'
3
3
 
4
4
  describe Vedeu do
5
- let(:described_class) { Vedeu }
6
-
7
5
  describe '.logger' do
8
- let(:subject) { described_class.logger }
9
-
10
- it { subject.must_be_instance_of(Logger) }
6
+ it 'needs a spec, please write one.' do
7
+ skip
8
+ end
11
9
  end
12
10
  end
@@ -0,0 +1,3 @@
1
+ This is the test template.
2
+
3
+ <%= @object.value -%>
data/test/test_helper.rb CHANGED
@@ -1,22 +1,13 @@
1
1
  require 'simplecov'
2
2
  require 'minitest/autorun'
3
3
  require 'minitest/pride'
4
- require 'pry'
5
- require 'ruby-prof'
4
+ require 'minitest/hell'
6
5
 
7
6
  SimpleCov.start do
8
7
  command_name 'MiniTest::Spec'
9
8
  add_filter '/test/'
10
9
  end unless ENV['no_simplecov']
11
10
 
12
- module MiniTest
13
- class Spec
14
- class << self
15
- alias_method :context, :describe
16
- end
17
- end
18
- end
19
-
20
11
  Minitest.after_run do
21
12
  print [27.chr, '[', '?25h'].join # show cursor
22
13
  end
@@ -27,5 +18,3 @@ end
27
18
  # Minitest::Reporters::DefaultReporter.new({ color: true, slow_count: 5 }),
28
19
  # Minitest::Reporters::SpecReporter.new
29
20
  # )
30
-
31
- require 'mocha/setup'