osaka 0.4.8 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.rdoc +1 -1
  4. data/Rakefile +12 -2
  5. data/lib/osaka.rb +6 -0
  6. data/lib/osaka/calculator.rb +1 -1
  7. data/lib/osaka/commandrunner.rb +17 -0
  8. data/lib/osaka/defaultssystem.rb +28 -0
  9. data/lib/osaka/keynote.rb +8 -6
  10. data/lib/osaka/keynoteflow.rb +10 -2
  11. data/lib/osaka/launchservices.rb +29 -0
  12. data/lib/osaka/location.rb +1 -1
  13. data/lib/osaka/mailmergeflow.rb +1 -1
  14. data/lib/osaka/numbers.rb +1 -1
  15. data/lib/osaka/osakaexpectations.rb +65 -61
  16. data/lib/osaka/pages.rb +35 -26
  17. data/lib/osaka/preview.rb +1 -1
  18. data/lib/osaka/remotecontrol.rb +57 -47
  19. data/lib/osaka/scriptrunner.rb +2 -11
  20. data/lib/osaka/textedit.rb +1 -1
  21. data/lib/osaka/typicalapplication.rb +10 -4
  22. data/lib/osaka/typicalfinderdialog.rb +1 -1
  23. data/lib/osaka/typicalopendialog.rb +22 -18
  24. data/lib/osaka/typicalprintdialog.rb +1 -1
  25. data/lib/osaka/typicalsavedialog.rb +1 -1
  26. data/lib/osaka/version.rb +1 -1
  27. data/{osaka.gemfile → osaka.gemspec} +0 -0
  28. data/spec/assets/document.pdf +0 -0
  29. data/spec/calculator_spec.rb +5 -5
  30. data/spec/defaultssystem_spec.rb +30 -0
  31. data/spec/integration_calculator_spec.rb +7 -7
  32. data/spec/integration_keynote_spec.rb +24 -11
  33. data/spec/integration_numbers_spec.rb +2 -2
  34. data/spec/integration_pages_numbers_mail_merge_spec.rb +9 -9
  35. data/spec/integration_preview_spec.rb +16 -0
  36. data/spec/integration_textedit_spec.rb +5 -5
  37. data/spec/keynote_flows_spec.rb +52 -31
  38. data/spec/keynote_spec.rb +24 -14
  39. data/spec/launchservices_spec.rb +63 -0
  40. data/spec/location_spec.rb +13 -13
  41. data/spec/mailmergeflow_spec.rb +13 -13
  42. data/spec/numbers_spec.rb +10 -10
  43. data/spec/osakaexpectations_spec.rb +3 -3
  44. data/spec/pages_spec.rb +80 -61
  45. data/spec/preview_spec.rb +5 -5
  46. data/spec/remotecontrol_spec.rb +65 -43
  47. data/spec/scriptrunner_spec.rb +22 -22
  48. data/spec/textedit_spec.rb +3 -3
  49. data/spec/typicalapplication_spec.rb +119 -108
  50. data/spec/typicalfinderdialog_spec.rb +2 -2
  51. data/spec/typicalopendialog_spec.rb +41 -35
  52. data/spec/typicalprintdialog_spec.rb +5 -5
  53. data/spec/typicalsavedialog_spec.rb +10 -10
  54. metadata +51 -47
@@ -0,0 +1,63 @@
1
+ require 'osaka'
2
+
3
+ describe "Launch Services (wrapper around lsregister)" do
4
+
5
+ before (:each) do
6
+ @dumped_registry = <<-END_OF_DUMP
7
+ Checking data integrity......done.
8
+ Status: Database is seeded.
9
+ Status: Preferences are loaded.
10
+ --------------------------------------------------------------------------------
11
+ bundle id: 54064
12
+ path: /Applications/TextMate.app
13
+ name: TextMate
14
+ category:
15
+ identifier: com.macromates.TextMate.preview (0x8005c399)
16
+ canonical id: com.macromates.textmate.preview (0x8005c38f)
17
+ version: 9515.0
18
+ mod date: 2/24/2014 14:57:26
19
+ reg date: 3/7/2014 13:22:06
20
+ type code: 'APPL'
21
+ creator code: 'avin'
22
+ sys version: 10.7
23
+ exec sdk ver: 10.8
24
+ exec os ver: 10.7
25
+ flags: relative-icon-path wildcard
26
+ item flags: container package application extension-hidden native-app scriptable x86_64
27
+ hi res: is-capabile user-can-change
28
+ app nap: is-capabile user-can-change
29
+ icon: Contents/Resources/TextMate.icns
30
+ executable: Contents/MacOS/TextMate
31
+ inode: 32052233
32
+ exec inode: 53967831
33
+ container id: 32
34
+ library: Contents/Library/
35
+ library items: QuickLook/TextMateQL.qlgenerator/
36
+ ../PlugIns/Dialog.tmplugin/
37
+ ../PlugIns/Dialog2.tmplugin/
38
+ --------------------------------------------------------
39
+ type id: 62684
40
+ bindableKey: 91052
41
+ generation: 20451
42
+ uti: com.macromates.textmate.snippet
43
+ description: TextMate Snippet
44
+ flags: exported active trusted
45
+ icon: Contents/Resources/TextMate Snippet.icns
46
+ conforms to: com.apple.property-list
47
+ tags: .tmsnippet
48
+ END_OF_DUMP
49
+ end
50
+
51
+ it "Can return a dump of the current database" do
52
+ expect(Osaka::CommandRunner).to receive(:run).with("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump").and_return(@dumped_registry)
53
+ current_dump = Osaka::LaunchServices.dump
54
+ expect(current_dump).to start_with("Checking data integrity......done.\nStatus: Database is seeded.\nStatus: Preferences are loaded.\n--------------------------------------------------------------------------------")
55
+ expect(current_dump).to include("name: TextMate")
56
+ end
57
+
58
+ it "Can retrieve a value based on the bundle name" do
59
+ Osaka::CommandRunner.should_receive(:run).and_return(@dumped_registry)
60
+ Osaka::LaunchServices.retrieve("TextMate")[:id].should== "54064"
61
+ end
62
+ end
63
+
@@ -5,47 +5,47 @@ describe "Location path for an applescript command" do
5
5
 
6
6
  it "Should be able to create a valid location when appending two locations" do
7
7
  location = Osaka::Location.new("scrollbar") + Osaka::Location.new("window 1")
8
- location.to_s.should == "scrollbar of window 1"
8
+ expect(location.to_s).to eq "scrollbar of window 1"
9
9
  end
10
10
 
11
11
  it "Should be able to add empty locations" do
12
12
  location = Osaka::Location.new("location") + ""
13
- location.to_s.should == "location"
13
+ expect(location.to_s).to eq "location"
14
14
  end
15
15
 
16
16
  it "Should be able to get the top-level element out" do
17
17
  location = at.sheet(1).sheet(2).window("three")
18
- location.top_level_element.should == at.window("three")
18
+ expect(location.top_level_element).to eq at.window("three")
19
19
  end
20
20
 
21
21
 
22
22
  it "Should be able to create locations using at" do
23
- at.button(1).to_s.should == "button 1"
23
+ expect(at.button(1).to_s).to eq "button 1"
24
24
  end
25
25
 
26
26
  it "Should be able to create empty prefixed locations" do
27
- Osaka::Location.new("").as_prefixed_location.should == ""
27
+ expect(Osaka::Location.new("").as_prefixed_location).to eq ""
28
28
  end
29
29
 
30
30
  it "Should be able to check whether the location already has a window" do
31
- Osaka::Location.new("").has_window?.should == false
32
- at.window("one").has_window?.should == true
31
+ expect(Osaka::Location.new("").has_window?).to eq false
32
+ expect(at.window("one").has_window?).to eq true
33
33
  end
34
34
 
35
35
  it "Should be able to create groups" do
36
- at.group(1).to_s.should == "group 1"
36
+ expect(at.group(1).to_s).to eq "group 1"
37
37
  end
38
38
 
39
39
  it "Should be able to combine buttons with groups" do
40
- at.button("1").group(2).to_s.should == 'button "1" of group 2'
40
+ expect(at.button("1").group(2).to_s).to eq 'button "1" of group 2'
41
41
  end
42
42
 
43
43
  it "Should be able to combine groups with windows" do
44
- at.button(1).group(2).window("Name").to_s.should == 'button 1 of group 2 of window "Name"'
44
+ expect(at.button(1).group(2).window("Name").to_s).to eq 'button 1 of group 2 of window "Name"'
45
45
  end
46
46
 
47
47
  it "Can compare different locations" do
48
- at.button(1).should == at.button(1)
48
+ expect(at.button(1)).to eq at.button(1)
49
49
  end
50
50
 
51
51
  it "Should be able to convert to a prefixed location" do
@@ -53,7 +53,7 @@ describe "Location path for an applescript command" do
53
53
  end
54
54
 
55
55
  it "Cannot create a location with two times window" do
56
- lambda {at.window(1).window(1)}.should raise_error(Osaka::InvalidLocation, "Invalid location: window 1 of window 1")
56
+ expect(lambda {at.window(1).window(1)}).to raise_error(Osaka::InvalidLocation, "Invalid location: window 1 of window 1")
57
57
  end
58
58
 
59
- end
59
+ end
@@ -3,21 +3,21 @@ require "osaka"
3
3
 
4
4
  describe "Mail Merge to PDF common flow" do
5
5
 
6
- let(:mock_numbers) { mock("Number")}
7
- let(:mock_pages) { mock("Pages") }
6
+ let(:mock_numbers) { double("Number")}
7
+ let(:mock_pages) { double("Pages") }
8
8
 
9
9
  it "Should do a good mail merge with Pages and Keynote flow" do
10
10
 
11
- Osaka::Numbers.should_receive(:create_document).with("/template/numbers").and_yield(mock_numbers)
11
+ expect(Osaka::Numbers).to receive(:create_document).with("/template/numbers").and_yield(mock_numbers)
12
12
 
13
- Osaka::Pages.should_receive(:new).and_return(mock_pages)
13
+ expect(Osaka::Pages).to receive(:new).and_return(mock_pages)
14
14
 
15
- mock_pages.should_receive(:open).with("/template/pages")
16
- mock_pages.should_receive(:set_mail_merge_document).with("/template/numbers")
17
- mock_pages.should_receive(:mail_merge_to_pdf).with("/output/file.pdf")
15
+ expect(mock_pages).to receive(:open).with("/template/pages")
16
+ expect(mock_pages).to receive(:set_mail_merge_document).with("/template/numbers")
17
+ expect(mock_pages).to receive(:mail_merge_to_pdf).with("/output/file.pdf")
18
18
 
19
- mock_pages.should_receive(:close).with(:dont_save)
20
- mock_pages.should_receive(:quit).with(:dont_save)
19
+ expect(mock_pages).to receive(:close).with(:dont_save)
20
+ expect(mock_pages).to receive(:quit).with(:dont_save)
21
21
 
22
22
  CommonFlows.number_and_pages_mail_merge("/template/numbers", "/template/pages", "/output/file.pdf") {}
23
23
  end
@@ -25,14 +25,14 @@ describe "Mail Merge to PDF common flow" do
25
25
  it "Should yield for filling in the numbers fields" do
26
26
  mock_numbers.as_null_object
27
27
  mock_pages.as_null_object
28
- Osaka::Numbers.should_receive(:create_document).and_yield(mock_numbers)
29
- Osaka::Pages.should_receive(:new).and_return(mock_pages)
28
+ expect(Osaka::Numbers).to receive(:create_document).and_yield(mock_numbers)
29
+ expect(Osaka::Pages).to receive(:new).and_return(mock_pages)
30
30
 
31
31
  retrieved_numbers = nil
32
32
  CommonFlows.number_and_pages_mail_merge("1", "2", "3") { |numbers|
33
33
  retrieved_numbers = numbers
34
34
  }
35
- retrieved_numbers.should == mock_numbers
35
+ expect(retrieved_numbers).to eq mock_numbers
36
36
  end
37
37
 
38
- end
38
+ end
data/spec/numbers_spec.rb CHANGED
@@ -6,11 +6,11 @@ describe "Osaka::Numbers" do
6
6
  include(*Osaka::OsakaExpectations)
7
7
 
8
8
  subject { Osaka::Numbers.new }
9
- let(:control) { subject.control = mock("RemoteControl").as_null_object}
9
+ let(:control) { subject.control = double("RemoteControl").as_null_object}
10
10
 
11
11
  it "Should be able to get the column count" do
12
12
  expect_tell('tell document 1; tell sheet 1; tell table 1; get column count; end tell; end tell; end tell').and_return("10")
13
- subject.column_count.should == 10
13
+ expect(subject.column_count).to eq 10
14
14
  end
15
15
 
16
16
  it "Should be able to set the column count to a certain value" do
@@ -19,14 +19,14 @@ describe "Osaka::Numbers" do
19
19
  end
20
20
 
21
21
  it "Should be able to fill in data in cells" do
22
- subject.should_receive(:column_count).and_return(10)
22
+ expect(subject).to receive(:column_count).and_return(10)
23
23
  expect_tell('tell document 1; tell sheet 1; tell table 1; set value of cell 1 of row 2 to "30"; end tell; end tell; end tell')
24
24
  subject.fill_cell(1, 2, "30")
25
25
  end
26
26
 
27
27
  it "Will change the column count when the cell is outside of the range of the current column count" do
28
- subject.should_receive(:column_count).and_return(5)
29
- subject.should_receive(:set_column_count).with(6)
28
+ expect(subject).to receive(:column_count).and_return(5)
29
+ expect(subject).to receive(:set_column_count).with(6)
30
30
  expect_tell('tell document 1; tell sheet 1; tell table 1; set value of cell 6 of row 2 to "30"; end tell; end tell; end tell')
31
31
  subject.fill_cell(6, 2, "30")
32
32
 
@@ -34,9 +34,9 @@ describe "Osaka::Numbers" do
34
34
 
35
35
  it "Should be able to select blank from the template choser" do
36
36
  expect_set_current_window("Template Choser")
37
- subject.should_receive(:do_and_wait_for_new_window).and_return("Template Choser")
37
+ expect(subject).to receive(:do_and_wait_for_new_window).and_return("Template Choser")
38
38
  expect_set_current_window("Untitled")
39
- subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("Untitled")
39
+ expect(subject).to receive(:do_and_wait_for_new_window).and_yield.and_return("Untitled")
40
40
  expect_keystroke(:return)
41
41
  subject.new_document
42
42
  end
@@ -47,11 +47,11 @@ describe "Osaka::Numbers" do
47
47
  end
48
48
 
49
49
  it "Should be able to use a class method for creating documents quickly" do
50
- Osaka::Numbers.should_receive(:new).any_number_of_times.and_return(mock("App"))
51
- subject.should_receive(:create_document)
50
+ expect(Osaka::Numbers).to receive(:new).at_least(1).times.and_return(double("App"))
51
+ expect(subject).to receive(:create_document)
52
52
 
53
53
  Osaka::Numbers.create_document("filename") { |doc|
54
54
  }
55
55
  end
56
56
 
57
- end
57
+ end
@@ -5,7 +5,7 @@ describe "Osakas Ruby expectations" do
5
5
 
6
6
  include(*Osaka::OsakaExpectations)
7
7
 
8
- subject { mock("RemoteControl") }
8
+ subject { double("RemoteControl") }
9
9
  let(:control) { subject }
10
10
 
11
11
  it "Wait until exists can be called without a code block" do
@@ -20,7 +20,7 @@ describe "Osakas Ruby expectations" do
20
20
  subject.wait_until_exists!(at.window(1)) {
21
21
  code_block_been_called = true
22
22
  }
23
- code_block_been_called.should be_true
23
+ expect(code_block_been_called).to be true
24
24
  end
25
25
 
26
- end
26
+ end
data/spec/pages_spec.rb CHANGED
@@ -6,48 +6,67 @@ describe "Osaka::Pages" do
6
6
  include(*Osaka::OsakaExpectations)
7
7
 
8
8
  subject { Osaka::Pages.new }
9
-
10
- let (:control) { subject.control = mock("Remote Control", :name => "ApplicationName")}
11
-
9
+
10
+ let (:control) { subject.control = double("Remote Control", :name => "ApplicationName")}
11
+
12
12
  context "Basic document operations" do
13
-
13
+
14
14
  it "Should be able to type in the file" do
15
15
  expect_keystroke("Hello")
16
16
  subject.type("Hello")
17
- end
17
+ end
18
+
19
+ it "Should be able to create a new document using template choser if there is one" do
20
+ expect(subject).to receive(:do_and_wait_for_new_window).and_yield.and_return("Template Chooser")
21
+ expect_keystroke("n", :command)
22
+ expect_set_current_window("Template Chooser")
23
+ expect_focus
24
+ expect_current_window_name.and_return("Template Chooser")
25
+ expect(subject).to receive(:do_and_wait_for_new_window).and_yield.and_return("New Document")
26
+ expect_click(at.button("Choose").window("Template Chooser"))
27
+ expect_set_current_window("New Document")
28
+ subject.new_document
29
+ end
30
+
31
+ it "Should be able to create a new document also when there is no template chooser" do
32
+ expect(subject).to receive(:do_and_wait_for_new_window).and_yield.and_return("New Document")
33
+ expect_keystroke("n", :command)
34
+ expect_set_current_window("New Document")
35
+ expect_focus
36
+ expect_current_window_name.and_return("New Document")
37
+ subject.new_document
38
+ end
39
+
18
40
  end
19
-
41
+
20
42
  it "Should be able to use a class method for creating documents quickly" do
21
- Osaka::Pages.should_receive(:new).any_number_of_times.and_return(mock("App"))
22
- subject.should_receive(:create_document)
43
+ expect(Osaka::Pages).to receive(:new).at_least(1).times.and_return(double("App"))
44
+ expect(subject).to receive(:create_document)
23
45
 
24
46
  Osaka::Pages.create_document("filename") { |doc|
25
- }
47
+ }
26
48
  end
27
-
49
+
28
50
  it "Should be able to do mail merge to a PDF flow" do
29
51
 
30
- mail_merge_dialog = mock("Pages Mail Merge Dialog")
31
- print_dialog = mock("Generic Print Dialog")
52
+ mail_merge_dialog = double("Pages Mail Merge Dialog")
53
+ print_dialog = double("Generic Print Dialog")
32
54
 
33
- subject.should_receive(:mail_merge).and_return(mail_merge_dialog)
34
- mail_merge_dialog.should_receive(:merge).and_return(print_dialog)
35
- mail_merge_dialog.should_receive(:set_merge_to_printer)
36
- print_dialog.should_receive(:save_as_pdf).with("filename")
55
+ expect(subject).to receive(:mail_merge).and_return(mail_merge_dialog)
56
+ expect(mail_merge_dialog).to receive(:merge).and_return(print_dialog)
57
+ expect(mail_merge_dialog).to receive(:set_merge_to_printer)
58
+ expect(print_dialog).to receive(:save_as_pdf).with("filename")
37
59
 
38
60
  subject.mail_merge_to_pdf("filename")
39
61
  end
40
-
62
+
41
63
  it "Should be able to select the Mail Merge" do
42
- expect_current_window_name.any_number_of_times.and_return("Pages.pages")
43
64
  expect_click_menu_bar(at.menu_item(20), "Edit")
44
65
  expect_wait_until_exists(at.button("Merge").sheet(1))
45
66
  subject.mail_merge
46
67
  end
47
68
 
48
69
  it "Should click the merge button of the mail merge dialog" do
49
- expect_current_window_name.any_number_of_times.and_return("Pages.pages")
50
-
51
70
  expect_click_menu_bar(at.menu_item(20), "Edit")
52
71
  expect_wait_until_exists(at.button("Merge").sheet(1))
53
72
 
@@ -55,54 +74,54 @@ describe "Osaka::Pages" do
55
74
  expect_wait_until_exists!(at.menu_button("PDF").window("Print"))
56
75
  subject.mail_merge.merge
57
76
  end
58
-
77
+
59
78
  it "Should be able to get an inspector object" do
60
- subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("Link")
79
+ expect(subject).to receive(:do_and_wait_for_new_window).and_yield.and_return("Link")
61
80
  expect_exists?(at.menu_item("Show Inspector").menu(1).menu_bar_item("View").menu_bar(1)).and_return(true)
62
81
  expect_click_menu_bar(at.menu_item("Show Inspector"), "View")
63
82
 
64
- inspector_mock = mock("Inspector")
65
- Osaka::PagesInspector.should_receive(:new).with(control.name, at.window("Link")).and_return(inspector_mock)
66
- subject.inspector.should equal(inspector_mock)
83
+ inspector_mock = double("Inspector")
84
+ expect(Osaka::PagesInspector).to receive(:new).with(control.name, at.window("Link")).and_return(inspector_mock)
85
+ expect(subject.inspector).to eq(inspector_mock)
67
86
  end
68
-
87
+
69
88
  it "Should be able to get the inspector object also when it is already visible" do
70
- subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("Link")
89
+ expect(subject).to receive(:do_and_wait_for_new_window).and_yield.and_return("Link")
71
90
  expect_exists?(at.menu_item("Show Inspector").menu(1).menu_bar_item("View").menu_bar(1)).and_return(false)
72
91
  expect_click_menu_bar(at.menu_item("Hide Inspector"), "View")
73
92
  expect_wait_until_exists(at.menu_item("Show Inspector").menu(1).menu_bar_item("View").menu_bar(1))
74
93
  expect_click_menu_bar(at.menu_item("Show Inspector"), "View")
75
94
  subject.inspector
76
95
  end
77
-
96
+
78
97
  it "Should be able to change the mail merge document source" do
79
- inspector_mock = mock("Inspector")
80
- subject.should_receive(:inspector).and_return(inspector_mock)
81
- inspector_mock.should_receive(:change_mail_merge_source)
98
+ inspector_mock = double("Inspector")
99
+ expect(subject).to receive(:inspector).and_return(inspector_mock)
100
+ expect(inspector_mock).to receive(:change_mail_merge_source)
82
101
 
83
102
  expect_wait_until_exists(at.sheet(1))
84
- subject.should_receive(:do_and_wait_for_new_window).and_yield.and_return("dialog")
103
+ expect(subject).to receive(:do_and_wait_for_new_window).and_yield.and_return("dialog")
85
104
  expect_click(at.radio_button("Numbers Document:").radio_group(1).sheet(1))
86
105
 
87
- subject.should_receive(:select_file_from_open_dialog).with("/tmp/filename", at.window("dialog"))
106
+ expect(subject).to receive(:select_file_from_open_dialog).with("/tmp/filename", at.window("dialog"))
88
107
  expect_click(at.button("OK").sheet(1))
89
-
108
+
90
109
  expect_exists?(at.sheet(1).sheet(1)).and_return(false)
91
110
  subject.set_mail_merge_document("/tmp/filename")
92
111
  end
93
-
112
+
94
113
  it "Should be able to stop when an error happens due to mail merge. This is especially important since otherwise Pages goes nuts and crashes :)" do
95
- subject.should_receive(:inspector).and_return(mock("Inspector").as_null_object)
114
+ expect(subject).to receive(:inspector).and_return(double("Inspector").as_null_object)
96
115
  expect_wait_until_exists(at.sheet(1))
97
- subject.should_receive(:do_and_wait_for_new_window)
98
- subject.should_receive(:select_file_from_open_dialog)
116
+ expect(subject).to receive(:do_and_wait_for_new_window)
117
+ expect(subject).to receive(:select_file_from_open_dialog)
99
118
 
100
119
  expect_exists?(at.sheet(1).sheet(1)).and_return(true)
101
-
120
+
102
121
  expect {subject.set_mail_merge_document("/tmp/filename") }.to raise_error(Osaka::PagesError, "Setting Mail Merge numbers file failed")
103
-
122
+
104
123
  end
105
-
124
+
106
125
  it "Should be able to insert a merge field" do
107
126
  expect_click_menu_bar(at.menu_item("Data").menu(1).menu_item("Merge Field"), "Insert")
108
127
  subject.mail_merge_field("Data")
@@ -110,36 +129,36 @@ describe "Osaka::Pages" do
110
129
  end
111
130
 
112
131
  describe "Osaka::Pages Inspector" do
113
-
132
+
114
133
  include(*Osaka::OsakaExpectations)
115
134
 
116
135
  subject {Osaka::PagesInspector.new("Pages", "Link")}
117
- let(:control) {subject.control = mock("RemoteControl")}
136
+ let(:control) {subject.control = double("RemoteControl")}
118
137
 
119
138
  it "Can convert symbolic names to locations" do
120
139
  # Nice... checking a map. Perhaps delete ?
121
- subject.get_location_from_symbol(:document).should == at.radio_button(1).radio_group(1)
122
- subject.get_location_from_symbol(:layout).should == at.radio_button(2).radio_group(1)
123
- subject.get_location_from_symbol(:wrap).should == at.radio_button(3).radio_group(1)
124
- subject.get_location_from_symbol(:text).should == at.radio_button(4).radio_group(1)
125
- subject.get_location_from_symbol(:graphic).should == at.radio_button(5).radio_group(1)
126
- subject.get_location_from_symbol(:metrics).should == at.radio_button(6).radio_group(1)
127
- subject.get_location_from_symbol(:table).should == at.radio_button(7).radio_group(1)
128
- subject.get_location_from_symbol(:chart).should == at.radio_button(8).radio_group(1)
129
- subject.get_location_from_symbol(:link).should == at.radio_button(9).radio_group(1)
130
- subject.get_location_from_symbol(:quicktime).should == at.radio_button(10).radio_group(1)
140
+ expect(subject.get_location_from_symbol(:document)).to eq at.radio_button(1).radio_group(1)
141
+ expect(subject.get_location_from_symbol(:layout)).to eq at.radio_button(2).radio_group(1)
142
+ expect(subject.get_location_from_symbol(:wrap)).to eq at.radio_button(3).radio_group(1)
143
+ expect(subject.get_location_from_symbol(:text)).to eq at.radio_button(4).radio_group(1)
144
+ expect(subject.get_location_from_symbol(:graphic)).to eq at.radio_button(5).radio_group(1)
145
+ expect(subject.get_location_from_symbol(:metrics)).to eq at.radio_button(6).radio_group(1)
146
+ expect(subject.get_location_from_symbol(:table)).to eq at.radio_button(7).radio_group(1)
147
+ expect(subject.get_location_from_symbol(:chart)).to eq at.radio_button(8).radio_group(1)
148
+ expect(subject.get_location_from_symbol(:link)).to eq at.radio_button(9).radio_group(1)
149
+ expect(subject.get_location_from_symbol(:quicktime)).to eq at.radio_button(10).radio_group(1)
131
150
  end
132
-
133
-
151
+
152
+
134
153
  it "Should be able to select the different inspectors" do
135
154
  expect_click(subject.get_location_from_symbol(:document))
136
155
  expect_wait_until_exists(at.window("document"))
137
156
  expect_set_current_window("document")
138
157
  subject.select_inspector(:document)
139
158
  end
140
-
159
+
141
160
  it "Change the mail merge source" do
142
- subject.should_receive(:select_inspector).with(:link)
161
+ expect(subject).to receive(:select_inspector).with(:link)
143
162
  expect_click(at.radio_button(3).tab_group(1).group(1))
144
163
  expect_wait_until_exists(at.button("Choose...").tab_group(1).group(1))
145
164
  expect_click(at.button("Choose...").tab_group(1).group(1))
@@ -149,11 +168,11 @@ describe "Osaka::Pages Inspector" do
149
168
  end
150
169
 
151
170
  describe "Osaka::Pages Mail Merge dialog" do
152
-
171
+
153
172
  include(*Osaka::OsakaExpectations)
154
173
 
155
174
  subject { Osaka::PagesMailMergeDialog.new("", nil) }
156
- let(:control) {subject.control = mock("RemoteControl").as_null_object}
175
+ let(:control) {subject.control = double("RemoteControl").as_null_object}
157
176
 
158
177
  it "Should be able to set the mail merge dialog to merge to new document" do
159
178
  expect_click(at.pop_up_button(2).sheet(1))
@@ -161,12 +180,12 @@ describe "Osaka::Pages Mail Merge dialog" do
161
180
  expect_click!(at.menu_item(1).menu(1).pop_up_button(2).sheet(1))
162
181
  subject.set_merge_to_new_document
163
182
  end
164
-
183
+
165
184
  it "Should be able to set the mail merge dialog to merge to printer" do
166
185
  expect_click(at.pop_up_button(2).sheet(1))
167
186
  expect_wait_until_exists!(at.menu_item(2).menu(1).pop_up_button(2).sheet(1))
168
187
  expect_click!(at.menu_item(2).menu(1).pop_up_button(2).sheet(1))
169
- subject.set_merge_to_printer
188
+ subject.set_merge_to_printer
170
189
  end
171
190
  end
172
191