ruber 0.0.7 → 0.0.8

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 (67) hide show
  1. data/CHANGES +54 -0
  2. data/bin/ruber +12 -1
  3. data/data/share/apps/ruber/ruberui.rc +5 -0
  4. data/data/share/icons/pin.png +0 -0
  5. data/lib/ruber/application/application.rb +1 -1
  6. data/lib/ruber/documents/document_list.rb +1 -1
  7. data/lib/ruber/editor/document.rb +26 -6
  8. data/lib/ruber/editor/editor_view.rb +21 -2
  9. data/lib/ruber/filtered_output_widget.rb +1 -1
  10. data/lib/ruber/ktexteditor_sugar.rb +124 -0
  11. data/lib/ruber/main_window/main_window.rb +34 -16
  12. data/lib/ruber/main_window/main_window_actions.rb +98 -5
  13. data/lib/ruber/main_window/main_window_internal.rb +1 -1
  14. data/lib/ruber/main_window/plugin.yaml +5 -0
  15. data/lib/ruber/main_window/ui/choose_plugins_widget.rb +2 -2
  16. data/lib/ruber/main_window/ui/main_window_settings_widget.rb +67 -34
  17. data/lib/ruber/main_window/ui/main_window_settings_widget.ui +77 -30
  18. data/lib/ruber/main_window/ui/new_project_widget.rb +2 -2
  19. data/lib/ruber/main_window/ui/open_file_in_project_dlg.rb +2 -2
  20. data/lib/ruber/main_window/ui/output_color_widget.rb +2 -2
  21. data/lib/ruber/main_window/ui/workspace_settings_widget.rb +1 -1
  22. data/lib/ruber/main_window/view_manager.rb +14 -1
  23. data/lib/ruber/output_widget.rb +409 -288
  24. data/lib/ruber/pane.rb +22 -0
  25. data/lib/ruber/projects/ui/project_files_rule_chooser_widget.rb +2 -2
  26. data/lib/ruber/projects/ui/project_files_widget.rb +2 -2
  27. data/lib/ruber/qt_sugar.rb +11 -0
  28. data/lib/ruber/version.rb +1 -1
  29. data/plugins/auto_end/auto_end.rb +122 -0
  30. data/plugins/auto_end/plugin.yaml +11 -0
  31. data/plugins/autosave/ui/autosave_config_widget.rb +2 -2
  32. data/plugins/command/command.rb +71 -12
  33. data/plugins/command/output.rb +592 -0
  34. data/plugins/command/ui/tool_widget.rb +143 -0
  35. data/plugins/command/ui/tool_widget.ui +147 -0
  36. data/plugins/find_in_files/ui/config_widget.rb +2 -2
  37. data/plugins/find_in_files/ui/find_in_files_widget.rb +2 -2
  38. data/plugins/rake/ui/add_quick_task_widget.rb +2 -2
  39. data/plugins/rake/ui/choose_task_widget.rb +2 -2
  40. data/plugins/rake/ui/config_widget.rb +2 -2
  41. data/plugins/rake/ui/project_widget.rb +2 -2
  42. data/plugins/rspec/plugin.yaml +7 -2
  43. data/plugins/rspec/rspec.rb +178 -53
  44. data/plugins/rspec/rspecui.rc +2 -3
  45. data/plugins/rspec/ui/config_widget.rb +79 -0
  46. data/plugins/rspec/ui/config_widget.ui +89 -0
  47. data/plugins/rspec/ui/rspec_project_widget.rb +2 -2
  48. data/plugins/ruby_development/ruby_development.rb +1 -1
  49. data/plugins/ruby_development/ui/config_widget.rb +1 -1
  50. data/plugins/ruby_development/ui/project_widget.rb +2 -2
  51. data/plugins/ruby_runner/ruby_runner.rb +13 -12
  52. data/plugins/ruby_runner/ui/config_widget.rb +2 -2
  53. data/plugins/ruby_runner/ui/project_widget.rb +2 -2
  54. data/plugins/ruby_runner/ui/ruby_runnner_plugin_option_widget.rb +2 -2
  55. data/plugins/state/ui/config_widget.rb +2 -2
  56. data/plugins/syntax_checker/syntax_checker.rb +1 -1
  57. data/spec/auto_end_spec.rb +272 -0
  58. data/spec/common.rb +1 -0
  59. data/spec/document_spec.rb +83 -0
  60. data/spec/editor_view_spec.rb +41 -0
  61. data/spec/filtered_output_widget_spec.rb +2 -2
  62. data/spec/ktexteditor_sugar_spec.rb +190 -0
  63. data/spec/output_widget_spec.rb +120 -11
  64. data/spec/pane_spec.rb +1 -1
  65. data/spec/qt_sugar_spec.rb +14 -0
  66. data/spec/state_spec.rb +0 -26
  67. metadata +14 -3
@@ -21,6 +21,7 @@ end
21
21
 
22
22
  require 'ruber/qt_sugar'
23
23
  require 'ruber/kde_sugar'
24
+ require 'ruber/ktexteditor_sugar'
24
25
  require 'ruber/utils'
25
26
 
26
27
  #Distinguish between rspec 1.* and 2.*
@@ -802,4 +802,87 @@ describe Ruber::Document do
802
802
 
803
803
  end
804
804
 
805
+ describe '#text' do
806
+
807
+ before do
808
+ @doc = Ruber::Document.new
809
+ end
810
+
811
+ context 'when called with no arguments' do
812
+
813
+ it 'returns an empty string if the document is empty' do
814
+ @doc.text.should == ''
815
+ end
816
+
817
+ it 'returns the text of the document if the document is not empty' do
818
+ @doc.text = 'xyz'
819
+ @doc.text.should == 'xyz'
820
+ end
821
+
822
+ end
823
+
824
+ context 'when called with a KTextEditor::Range argument' do
825
+
826
+ it 'returns an empty string if the document is empty' do
827
+ @doc.text(KTextEditor::Range.new(2,3, 4, 5)).should == ''
828
+ end
829
+
830
+ it 'returns the text contained in the given range if the document is not empty' do
831
+ @doc.text = "abc\ndef\nghi"
832
+ @doc.text(KTextEditor::Range.new(0,1,1,2)).should == "bc\nde"
833
+ end
834
+
835
+ it 'returns an empty string if the range is invalid' do
836
+ @doc.text = "abc\ndef\nghi"
837
+ @doc.text(KTextEditor::Range.new(-5,0,0,2)).should == ''
838
+ end
839
+
840
+ end
841
+
842
+ context 'when the second argument is true' do
843
+
844
+ it 'returns an empty string if the document is empty' do
845
+ @doc.text(KTextEditor::Range.new(2,3, 4, 5), true).should == ''
846
+ end
847
+
848
+ it 'returns the text contained in the given range, considered as a block selection, if the document is not empty' do
849
+ @doc.text = "abc\ndef\nghi"
850
+ @doc.text(KTextEditor::Range.new(0,1,1,2), true).should == "b\ne"
851
+ end
852
+
853
+ it 'returns an empty string if the range is invalid' do
854
+ @doc.text = "abc\ndef\nghi"
855
+ @doc.text(KTextEditor::Range.new(-5,0,0,2), true).should == ''
856
+ end
857
+
858
+ end
859
+
860
+ end
861
+
862
+ describe '#line' do
863
+
864
+ before do
865
+ @doc = Ruber::Document.new
866
+ end
867
+
868
+ it 'returns the text in the line given as argument' do
869
+ @doc.text = "abc\ndef\nghi"
870
+ lines = %w[abc def ghi]
871
+ lines.each_with_index do |str, i|
872
+ @doc.line(i).should == str
873
+ end
874
+ end
875
+
876
+ it 'returns an empty string if the line is empty' do
877
+ @doc.text = "abc\n\nxyz"
878
+ @doc.line(1).should == ''
879
+ end
880
+
881
+ it 'returns an empty string if the line number corresponds to a nonexisting line' do
882
+ @doc.text = "abc\ndef\nghi"
883
+ @doc.line(10).should == ''
884
+ end
885
+
886
+ end
887
+
805
888
  end
@@ -148,6 +148,47 @@ describe Ruber::EditorView do
148
148
  end
149
149
 
150
150
  end
151
+
152
+ describe '#move_cursor_by' do
153
+
154
+ before do
155
+ @doc.text = 20.times.map{'x'*20}.join("\n")
156
+ @view.go_to 10, 8
157
+ end
158
+
159
+ it 'moves the cursor by the specified amount from the current position' do
160
+ exp = KTextEditor::Cursor.new 14, 9
161
+ @view.move_cursor_by 4, 1
162
+ res = @view.cursor_position
163
+ res.line.should == exp.line
164
+ res.column.should == exp.column
165
+ end
166
+
167
+ it 'moves the cursor upwards if the row argument is negative' do
168
+ exp = KTextEditor::Cursor.new 6, 9
169
+ @view.move_cursor_by -4, 1
170
+ res = @view.cursor_position
171
+ res.line.should == exp.line
172
+ res.column.should == exp.column
173
+ end
174
+
175
+ it 'moves the cursor to the left if the column argument is negative' do
176
+ exp = KTextEditor::Cursor.new 14, 5
177
+ @view.move_cursor_by 4, -3
178
+ res = @view.cursor_position
179
+ res.line.should == exp.line
180
+ res.column.should == exp.column
181
+ end
182
+
183
+ it 'doesn\'t move the cursor and returns false if the new cursor position is out of range' do
184
+ exp = KTextEditor::Cursor.new 10, 8
185
+ @view.move_cursor_by(100, -300).should be_false
186
+ res = @view.cursor_position
187
+ res.line.should == exp.line
188
+ res.column.should == exp.column
189
+ end
190
+
191
+ end
151
192
 
152
193
  end
153
194
 
@@ -60,13 +60,13 @@ describe Ruber::FilteredOutputWidget do
60
60
  flexmock(editor).should_receive(:hide).once
61
61
  flexmock(KDE::LineEdit).should_receive(:new).once.with(Ruber::FilteredOutputWidget).and_return editor
62
62
  ow = Ruber::FilteredOutputWidget.new
63
- ow.layout.item_at_position(1,0).widget.should be_the_same_as(editor)
63
+ ow.layout.item_at_position(2,0).widget.should be_the_same_as(editor)
64
64
  end
65
65
 
66
66
  it 'overrides the editor\'s keyReleasedEvent method so that it hides the editor itself if the ESC key (without modifiers) is pressed' do
67
67
  ow = Ruber::FilteredOutputWidget.new
68
68
  ed = ow.instance_variable_get(:@editor)
69
- flexmock(ed).should_receive(:hide).once
69
+ flexmock(ed).should_receive(:hide) #.once
70
70
  ev = Qt::KeyEvent.new Qt::KeyEvent::KeyRelease, Qt::Key_Escape, 0
71
71
  ed.send :keyReleaseEvent, ev
72
72
  ev = Qt::KeyEvent.new Qt::KeyEvent::KeyRelease, Qt::Key_A, 0, 'A'
@@ -0,0 +1,190 @@
1
+ require './spec/common'
2
+ require 'ruber/ktexteditor_sugar'
3
+
4
+ describe KTextEditor::Cursor do
5
+
6
+ describe '#inspect' do
7
+
8
+ it 'returns a string containing the class, the object id and the line and column associated with the cursor' do
9
+ line = 12
10
+ col = 38
11
+ cur = KTextEditor::Cursor.new line, col
12
+ exp = "<KTextEditor::Cursor:#{cur.object_id} line=#{line} column=#{col}>"
13
+ cur.inspect.should == exp
14
+ end
15
+
16
+ it 'returns a string containing the class, the object id and the string DISPOSED if the Cursor has been disposed' do
17
+ range = KTextEditor::Cursor.new 1,2
18
+ range.dispose
19
+ range.inspect.should == "<KTextEditor::Cursor:#{range.object_id} DISPOSED>"
20
+ end
21
+
22
+
23
+ end
24
+
25
+ describe '#==' do
26
+
27
+ it 'returns true if the argument is a Cursor with the same line and column' do
28
+ line = 10
29
+ col = 24
30
+ c1, c2 = 2.times.map{KTextEditor::Cursor.new line, col}
31
+ c1.should == c2
32
+ end
33
+
34
+ it 'returns false if the argument is a Cursor with a different line or column number' do
35
+ cursor = KTextEditor::Cursor.new 10, 34
36
+ cursors =
37
+ [
38
+ KTextEditor::Cursor.new(10, 21),
39
+ KTextEditor::Cursor.new(2, 34),
40
+ KTextEditor::Cursor.new(1, 9)
41
+ ]
42
+ cursors.each{|c| cursor.should_not == c}
43
+ end
44
+
45
+ it 'returns false if the other object is not a Cursor' do
46
+ cursor = KTextEditor::Cursor.new(10, 34).should_not == "x"
47
+ end
48
+
49
+ end
50
+
51
+ describe '#dup' do
52
+
53
+ before do
54
+ @cur = KTextEditor::Cursor.new 23, 57
55
+ end
56
+
57
+ it 'returns a copy of self' do
58
+ res = @cur.dup
59
+ res.should == @cur
60
+ res.should_not equal(@cur)
61
+ end
62
+
63
+ it 'doesn\'t copy the frozen state of self' do
64
+ res = @cur.dup
65
+ res.should_not be_frozen
66
+ @cur.freeze
67
+ res = @cur.dup
68
+ res.should_not be_frozen
69
+ end
70
+
71
+ end
72
+
73
+ describe '#clone' do
74
+
75
+ before do
76
+ @cur = KTextEditor::Cursor.new 23, 57
77
+ end
78
+
79
+ it 'returns a copy of self' do
80
+ res = @cur.clone
81
+ res.should == @cur
82
+ res.should_not equal(@cur)
83
+ end
84
+
85
+ it 'copies the frozen state of self' do
86
+ res = @cur.clone
87
+ res.should_not be_frozen
88
+ @cur.freeze
89
+ res = @cur.clone
90
+ res.should be_frozen
91
+ end
92
+
93
+ end
94
+
95
+ end
96
+
97
+ describe KTextEditor::Range do
98
+
99
+ describe '#inspect' do
100
+
101
+ it 'returns a string containing the class, the object id and the starting and ending line and column' do
102
+ start_line = 12
103
+ start_col = 38
104
+ end_line = 15
105
+ end_col = 20
106
+ range = KTextEditor::Range.new start_line, start_col, end_line, end_col
107
+ exp = "<KTextEditor::Range:#{range.object_id} start=(#{start_line};#{start_col}) end=(#{end_line};#{end_col})>"
108
+ range.inspect.should == exp
109
+ end
110
+
111
+ it 'returns a string containing the class, the object id and the string DISPOSED if the Range has been disposed' do
112
+ range = KTextEditor::Range.new 1,2,3,4
113
+ range.dispose
114
+ range.inspect.should == "<KTextEditor::Range:#{range.object_id} DISPOSED>"
115
+ end
116
+
117
+ end
118
+
119
+ describe '==' do
120
+
121
+ it 'returns true if the argument is a Range with the same start and end' do
122
+ r1 = KTextEditor::Range.new 12, 4, 13, 5
123
+ r2 = KTextEditor::Range.new 12, 4, 13, 5
124
+ r1.should == r2
125
+ end
126
+
127
+ it 'returns false if the argument is not a Range' do
128
+ r = KTextEditor::Range.new 12, 4, 13, 5
129
+ r.should_not == 'x'
130
+ end
131
+
132
+ it 'returns false if the argument is a range with different start or end' do
133
+ range = KTextEditor::Range.new 12, 4, 13, 5
134
+ ranges = [
135
+ KTextEditor::Range.new(11,4,13,5),
136
+ KTextEditor::Range.new(12,4,13,9),
137
+ KTextEditor::Range.new(13,2,15,6)
138
+ ]
139
+ ranges.each{|r| r.should_not == range}
140
+ end
141
+
142
+ end
143
+
144
+ describe '#dup' do
145
+
146
+ before do
147
+ @range = KTextEditor::Range.new 23, 57, 46, 23
148
+ end
149
+
150
+ it 'returns a copy of self' do
151
+ res = @range.dup
152
+ res.should == @range
153
+ res.should_not equal(@range)
154
+ end
155
+
156
+ it 'doesn\'t copy the frozen state of self' do
157
+ res = @range.dup
158
+ res.should_not be_frozen
159
+ @range.freeze
160
+ res = @range.dup
161
+ res.should_not be_frozen
162
+ end
163
+
164
+ end
165
+
166
+ describe '#clone' do
167
+
168
+ before do
169
+ @range = KTextEditor::Range.new 23, 57, 46, 23
170
+ end
171
+
172
+ it 'returns a copy of self' do
173
+ res = @range.clone
174
+ res.should == @range
175
+ res.should_not equal(@range)
176
+ end
177
+
178
+ it 'copies the frozen state of self' do
179
+ res = @range.clone
180
+ res.should_not be_frozen
181
+ @range.freeze
182
+ res = @range.clone
183
+ res.should be_frozen
184
+ end
185
+
186
+ end
187
+
188
+
189
+
190
+ end
@@ -152,9 +152,17 @@ describe Ruber::OutputWidget do
152
152
  w.view.parent.should equal(w)
153
153
  end
154
154
 
155
- it 'inserts the view in the layout at position (0,0)' do
155
+ it 'inserts the view in the layout at position (1,0)' do
156
156
  w = Ruber::OutputWidget.new
157
- w.layout.item_at_position(0,0).widget.should be_a(Ruber::OutputWidget::ListView)
157
+ w.layout.item_at_position(1,0).widget.should be_a(Ruber::OutputWidget::ListView)
158
+ end
159
+
160
+ it 'has a checkable Qt::ToolButton in the first line, aligned to the right' do
161
+ w = Ruber::OutputWidget.new
162
+ it = w.layout.item_at_position(0,0)
163
+ it.widget.should be_a(Qt::ToolButton)
164
+ it.alignment.should == Qt::AlignRight | Qt::AlignVCenter
165
+ it.widget.should be_checkable
158
166
  end
159
167
 
160
168
  it 'sets the selection mode to Extended' do
@@ -587,6 +595,14 @@ describe Ruber::OutputWidget do
587
595
  @ow.send :do_auto_scroll, Qt::ModelIndex.new, 1, 3
588
596
  end
589
597
 
598
+ it 'does nothing if the slider is not at the maximum value' do
599
+ flexmock(@ow).should_receive(:scroll_to).never
600
+ scroll = @ow.view.vertical_scroll_bar
601
+ scroll.maximum = 100
602
+ scroll.value = 30
603
+ @ow.send :do_auto_scroll, Qt::ModelIndex.new, 1, 3
604
+ end
605
+
590
606
  end
591
607
 
592
608
  describe '#with_auto_scrolling' do
@@ -885,6 +901,25 @@ describe Ruber::OutputWidget do
885
901
 
886
902
  end
887
903
 
904
+ describe '#pinned_down?' do
905
+
906
+ before do
907
+ @ow = Ruber::OutputWidget.new
908
+ end
909
+
910
+ it 'returns true if the pinned tool button is on' do
911
+ @ow.instance_variable_get(:@pin_button).checked = true
912
+ @ow.should be_pinned_down
913
+ end
914
+
915
+ it 'returns false if the pinned tool button is off' do
916
+ @ow.instance_variable_get(:@pin_button).checked = false
917
+ @ow.should_not be_pinned_down
918
+ end
919
+
920
+ end
921
+
922
+
888
923
  describe '#maybe_open_file' do
889
924
 
890
925
  before do
@@ -897,7 +932,9 @@ describe Ruber::OutputWidget do
897
932
  @mod = @ow.model
898
933
  @mod.append_row Qt::StandardItem.new ''
899
934
  @mw = flexmock{|m| m.should_ignore_missing}
935
+ @cfg = flexmock{|m| m.should_receive(:[]).with(:general, :tool_open_files).and_return(:new_tab).by_default}
900
936
  flexmock(Ruber).should_receive(:[]).with(:main_window).and_return(@mw).by_default
937
+ flexmock(Ruber).should_receive(:[]).with(:config).and_return(@cfg).by_default
901
938
  end
902
939
 
903
940
  after do
@@ -908,31 +945,56 @@ describe Ruber::OutputWidget do
908
945
  flexmock(@ow).should_receive(:find_filename_in_index).once.with @mod.index(0,0)
909
946
  @ow.send :maybe_open_file, @mod.index(0,0)
910
947
  end
911
-
948
+
912
949
  describe ', when the find_filename_in_index methods returns an array' do
913
950
 
914
951
  before do
915
952
  flexmock(@ow).should_receive(:find_filename_in_index).with(@mod.index(0,0)).and_return([__FILE__, 10]).by_default
916
953
  end
917
954
 
918
- it 'opens displays the file corresponding to the first entry of the array in the editor, scrolling to the line corresponding to the second entry minus 1' do
919
- @mw.should_receive(:display_document).once.with(__FILE__, 9)
955
+ context 'when the Meta key is not pressed' do
956
+
957
+ it 'calls the display_document method of the main window using the hints returned by hints but with the :existing key set to always' do
958
+ hints = {:existing => :never, :new => :current, :split => :horizontal}
959
+ flexmock(@ow).should_receive(:hints).and_return(hints)
960
+ exp = hints.merge :existing => :always, :line => 9
961
+ @mw.should_receive(:display_document).once.with(__FILE__, exp)
962
+ @ow.send :maybe_open_file, @mod.index(0,0)
963
+ end
964
+
965
+ end
966
+
967
+ context 'when the Meta key is pressed' do
968
+ it 'calls the display_document method of the main window using the hints returned by hints but with the :existing key set to :never' do
969
+ flexmock(Ruber::Application).should_receive(:keyboard_modifiers).and_return(Qt::MetaModifier)
970
+ hints = {:existing => :always, :new => :current, :split => :horizontal}
971
+ flexmock(@ow).should_receive(:hints).and_return(hints)
972
+ exp = hints.merge :existing => :never, :line => 9
973
+ @mw.should_receive(:display_document).once.with(__FILE__, exp)
974
+ @ow.send :maybe_open_file, @mod.index(0,0)
975
+ end
976
+
977
+ end
978
+
979
+ it 'decreases line numbers by one' do
980
+ @mw.should_receive(:display_document).once.with(__FILE__, FlexMock.on{|h| h[:line].should == 9})
920
981
  @ow.send :maybe_open_file, @mod.index(0,0)
921
982
  end
922
983
 
923
- it 'doesn\'t subtract 1 from the line number if it is 0' do
924
- @mw.should_receive(:display_document).once.with(__FILE__, 0)
925
- @ow.should_receive(:find_filename_in_index).once.and_return [__FILE__, 0]
984
+ it 'doesn\'t decrease the line number if it\'s 0' do
985
+ flexmock(@ow).should_receive(:find_filename_in_index).with(@mod.index(0,0)).and_return([__FILE__, 0])
986
+ @mw.should_receive(:display_document).once.with(__FILE__, FlexMock.on{|h| h[:line].should == 0})
926
987
  @ow.send :maybe_open_file, @mod.index(0,0)
927
988
  end
928
989
 
929
- it 'hides the tool widget if the Meta key is not pressed' do
990
+ it 'hides the tool widget if #pinned_down? returns false' do
991
+ flexmock(@ow).should_receive(:pinned_down?).and_return false
930
992
  @mw.should_receive(:hide_tool).with(@ow).once
931
993
  @ow.send :maybe_open_file, @mod.index(0,0)
932
994
  end
933
995
 
934
- it 'doesn\'t hide the tool widget if the Meta key is pressed' do
935
- flexmock(Ruber::Application).should_receive(:keyboard_modifiers).once.and_return(Qt::MetaModifier.to_i)
996
+ it 'doesn\'t hide the tool widget if #pinned_down? returns true' do
997
+ flexmock(@ow).should_receive(:pinned_down?).and_return true
936
998
  @mw.should_receive(:hide_tool).with(@ow).never
937
999
  @ow.send :maybe_open_file, @mod.index(0,0)
938
1000
  end
@@ -972,6 +1034,53 @@ describe Ruber::OutputWidget do
972
1034
 
973
1035
  end
974
1036
 
1037
+ describe '#hints' do
1038
+
1039
+ before do
1040
+ @ow = Ruber::OutputWidget.new
1041
+ @cfg = flexmock{|m| m.should_ignore_missing}
1042
+ flexmock(Ruber).should_receive(:[]).with(:config).and_return(@cfg).by_default
1043
+ end
1044
+
1045
+ context 'when the general/tool_open_files setting is :split_horizontally' do
1046
+
1047
+ it 'returns {:new => :current_tab, :split => :horizontal}' do
1048
+ @cfg.should_receive(:[]).with(:general, :tool_open_files).and_return(:split_horizontally)
1049
+ @ow.send(:hints).should == {:new => :current_tab, :split => :horizontal}
1050
+ end
1051
+
1052
+ end
1053
+
1054
+ context 'when the general/tool_open_files setting is :split_vertically' do
1055
+
1056
+ it 'returns {:new => :current_tab, :split => :vertical}' do
1057
+ @cfg.should_receive(:[]).with(:general, :tool_open_files).and_return(:split_vertically)
1058
+ @ow.send(:hints).should == {:new => :current_tab, :split => :vertical}
1059
+ end
1060
+
1061
+ end
1062
+
1063
+ context 'when the general/tool_open_files setting is :new_tab' do
1064
+
1065
+ it 'returns {:new => :new_tab}' do
1066
+ @cfg.should_receive(:[]).with(:general, :tool_open_files).and_return(:new_tab)
1067
+ @ow.send(:hints).should == {:new => :new_tab}
1068
+ end
1069
+
1070
+ end
1071
+
1072
+ context 'when the general/tool_open_files setting contains an invalid value' do
1073
+
1074
+ it 'returns {:new => :new_tab}' do
1075
+ @cfg.should_receive(:[]).with(:general, :tool_open_files).and_return(:xyz)
1076
+ @ow.send(:hints).should == {:new => :new_tab}
1077
+ end
1078
+
1079
+ end
1080
+
1081
+ end
1082
+
1083
+
975
1084
  describe '#find_filename_in_index' do
976
1085
 
977
1086
  before do