mac_bacon 1.1.21 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  $-w,w = nil, $-w
2
- require File.expand_path('../../lib/mac_bacon', __FILE__)
2
+ require File.expand_path('../spec_helper', __FILE__)
3
3
  $-w = w
4
4
 
5
5
  # Hooray for meta-testing.
@@ -0,0 +1,2 @@
1
+ $:.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'mac_bacon'
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../lib/mac_bacon', __FILE__)
1
+ require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  describe "NSRunloop aware Bacon" do
4
4
  it "allows the user to postpone execution of a block for n seconds, which will halt any further execution of specs" do
@@ -18,3 +18,47 @@ describe "NSRunloop aware Bacon" do
18
18
  end
19
19
  end
20
20
 
21
+ class WindowController < NSWindowController
22
+ attr_accessor :arrayController
23
+ attr_accessor :tableView
24
+ attr_accessor :textField
25
+ end
26
+
27
+ describe "Nib helper" do
28
+ def verify_outlets_of_owner(owner)
29
+ owner.arrayController.should.be.instance_of NSArrayController
30
+ owner.tableView.should.be.instance_of NSTableView
31
+ owner.textField.should.be.instance_of NSTextField
32
+ end
33
+
34
+ it "takes a NIB path and instantiates the NIB with the given `owner' object" do
35
+ nib_path = File.expand_path("../fixtures/Window.nib", __FILE__)
36
+ owner = WindowController.new
37
+ load_nib(nib_path, owner)
38
+ verify_outlets_of_owner(owner)
39
+ end
40
+
41
+ it "also returns an array or other top level objects" do
42
+ nib_path = File.expand_path("../fixtures/Window.nib", __FILE__)
43
+ owner = WindowController.new
44
+ top_level_objects = load_nib(nib_path, owner).sort_by { |o| o.class.name }
45
+ top_level_objects[0].should.be.instance_of NSApplication
46
+ top_level_objects[1].should.be.instance_of NSArrayController
47
+ top_level_objects[2].should.be.instance_of NSWindow
48
+ end
49
+
50
+ it "converts a XIB to a tmp NIB before loading it and caches it" do
51
+ xib_path = File.expand_path("../fixtures/Window.xib", __FILE__)
52
+ owner = WindowController.new
53
+ load_nib(xib_path, owner)
54
+ verify_outlets_of_owner(owner)
55
+
56
+ def self.system(cmd)
57
+ raise "Oh noes! Tried to convert again!"
58
+ end
59
+
60
+ owner = WindowController.new
61
+ load_nib(xib_path, owner)
62
+ verify_outlets_of_owner(owner)
63
+ end
64
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mac_bacon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 1
9
- - 21
10
- version: 1.1.21
8
+ - 2
9
+ version: "1.2"
11
10
  platform: ruby
12
11
  authors:
13
12
  - "Eloy Dur\xC3\xA1n"
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-01-10 00:00:00 +01:00
17
+ date: 2011-02-28 00:00:00 +01:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -42,7 +41,12 @@ files:
42
41
  - Rakefile
43
42
  - bin/macbacon
44
43
  - lib/mac_bacon.rb
44
+ - lib/mac_bacon/helpers.rb
45
+ - test/fixtures/Window.nib/designable.nib
46
+ - test/fixtures/Window.nib/keyedobjects.nib
47
+ - test/fixtures/Window.xib
45
48
  - test/spec_bacon.rb
49
+ - test/spec_helper.rb
46
50
  - test/spec_mac_bacon.rb
47
51
  - test/spec_nontrue.rb
48
52
  - test/spec_should.rb