secretary 0.0.1 → 0.1.0
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.
- data/History.txt +22 -0
- data/Manifest.txt +5 -3
- data/README.txt +14 -50
- data/lib/secretary.rb +71 -17
- data/lib/secretary/error.rb +17 -17
- data/lib/secretary/gopher.rb +84 -48
- data/lib/secretary/gopher/yaml.rb +13 -19
- data/spec/{broken-yaml.txt → broken-yaml.yaml} +0 -0
- data/spec/error_spec.rb +3 -2
- data/spec/gopher/yaml_spec.rb +124 -0
- data/spec/one-row.csv +1 -0
- data/spec/secretary.rb +321 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/two-rows.csv +2 -0
- metadata +9 -8
- data/spec/gopher_spec.rb +0 -157
- data/spec/secretary_spec.rb +0 -259
data/spec/spec_helper.rb
CHANGED
data/spec/two-rows.csv
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secretary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Choi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.7.0
|
24
24
|
version:
|
25
|
-
description: Secretary is a gem who makes managing simple preference files in Ruby
|
25
|
+
description: Secretary is a gem who makes managing simple preference files in Ruby easier and more painless.
|
26
26
|
email:
|
27
27
|
- joshua@choi.name
|
28
28
|
executables: []
|
@@ -33,7 +33,6 @@ extra_rdoc_files:
|
|
33
33
|
- History.txt
|
34
34
|
- Manifest.txt
|
35
35
|
- README.txt
|
36
|
-
- spec/broken-yaml.txt
|
37
36
|
files:
|
38
37
|
- History.txt
|
39
38
|
- Manifest.txt
|
@@ -44,12 +43,14 @@ files:
|
|
44
43
|
- lib/secretary/gopher.rb
|
45
44
|
- lib/secretary/gopher/yaml.rb
|
46
45
|
- spec/spec_helper.rb
|
47
|
-
- spec/
|
46
|
+
- spec/secretary.rb
|
48
47
|
- spec/error_spec.rb
|
49
|
-
- spec/
|
48
|
+
- spec/gopher/yaml_spec.rb
|
50
49
|
- spec/hash.yaml
|
51
50
|
- spec/array.yaml
|
52
|
-
- spec/broken-yaml.
|
51
|
+
- spec/broken-yaml.yaml
|
52
|
+
- spec/one-row.csv
|
53
|
+
- spec/two-rows.csv
|
53
54
|
has_rdoc: true
|
54
55
|
homepage: http://secretary.rubyforge.org
|
55
56
|
post_install_message:
|
@@ -76,6 +77,6 @@ rubyforge_project: secretary
|
|
76
77
|
rubygems_version: 1.2.0
|
77
78
|
signing_key:
|
78
79
|
specification_version: 2
|
79
|
-
summary: Secretary is a gem who makes managing simple preference files in Ruby
|
80
|
+
summary: Secretary is a gem who makes managing simple preference files in Ruby easier and more painless.
|
80
81
|
test_files: []
|
81
82
|
|
data/spec/gopher_spec.rb
DELETED
@@ -1,157 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
require 'lib/secretary/gopher/yaml'
|
3
|
-
|
4
|
-
describe Secretary::Gopher::YAML do
|
5
|
-
|
6
|
-
it 'should be equal with another if they are of equal class' do
|
7
|
-
gopher0 = Secretary::Gopher::YAML.new stub_everything
|
8
|
-
gopher1 = Secretary::Gopher::YAML.new stub_everything
|
9
|
-
gopher0.should == gopher1
|
10
|
-
gopher1.should == gopher0
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should be unequal with another if they are of unequal class, even if the other is a kind of its class' do
|
14
|
-
gopher0 = Secretary::Gopher::YAML.new stub_everything
|
15
|
-
gopher1 = stub :kind_of? => true
|
16
|
-
gopher0.should_not == gopher1
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
it 'should know its valid data type' do
|
21
|
-
data_type = stub 'Data Type'
|
22
|
-
gopher = Secretary::Gopher::YAML.new data_type
|
23
|
-
gopher.valid_data_type.should == data_type
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should know its valid file type and it should be YAML' do
|
27
|
-
Secretary::Gopher::YAML.new(stub_everything).valid_file_type.should == 'YAML'
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'when trying to save an object into a YAML file using a file path' do
|
31
|
-
|
32
|
-
it 'should save a given Hash when the valid data type is Hash' do
|
33
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
34
|
-
data = {:name => 'Tracy', :url => 'http://tracy.name'}
|
35
|
-
file_path = File.dirname(__FILE__) + '/temporary.yaml'
|
36
|
-
gopher.save data, file_path
|
37
|
-
open file_path do |file|
|
38
|
-
YAML::load(file).should == data
|
39
|
-
end
|
40
|
-
File.delete file_path
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should save a given object when the object is of its valid data type' do
|
44
|
-
class Person
|
45
|
-
def initialize
|
46
|
-
@name = 'Sal'
|
47
|
-
@age = 76
|
48
|
-
end
|
49
|
-
def ==(other)
|
50
|
-
self.class == other.class
|
51
|
-
end
|
52
|
-
end
|
53
|
-
data = Person.new
|
54
|
-
gopher = Secretary::Gopher::YAML.new Person
|
55
|
-
file_path = File.dirname(__FILE__) + '/temporary.yaml'
|
56
|
-
gopher.save data, file_path
|
57
|
-
open file_path do |file|
|
58
|
-
YAML::load(file).should == data
|
59
|
-
end
|
60
|
-
File.delete file_path
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should raise an error if it tries to save data that is not of its valid data type' do
|
64
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
65
|
-
data = [3, 2, 1]
|
66
|
-
file_path = File.dirname(__FILE__) + '/temporary.yaml'
|
67
|
-
lambda { gopher.save data, file_path }.should raise_error(ArgumentError)
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'should not create a new file if it tries to save data that is not of its valid data type' do
|
71
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
72
|
-
data = [3, 2, 1]
|
73
|
-
file_path = File.dirname(__FILE__) + '/temporary.yaml'
|
74
|
-
begin
|
75
|
-
gopher.save data, file_path
|
76
|
-
rescue ArgumentError
|
77
|
-
end
|
78
|
-
File.exists?(file_path).should_not be_true
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'should not modify any file if it tries to save data that is not of its valid data type' do
|
82
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
83
|
-
data0 = {:name => 'Tracy', :url => 'http://tracy.name'}
|
84
|
-
data1 = [3, 2, 1]
|
85
|
-
file_path = File.dirname(__FILE__) + '/temporary.yaml'
|
86
|
-
gopher.save data0, file_path
|
87
|
-
begin
|
88
|
-
gopher.save data1, file_path
|
89
|
-
rescue ArgumentError
|
90
|
-
end
|
91
|
-
open file_path do |file|
|
92
|
-
YAML::load(file).should == data0
|
93
|
-
end
|
94
|
-
File.delete file_path
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
describe 'when reading from a file' do
|
100
|
-
|
101
|
-
it 'should get the file\'s data when the file is YAML and that data is a Hash and the given type is Hash' do
|
102
|
-
preferences0 = {'name' => 'Billy Bob', 'email' => 'xxx@yyy.zzz'}
|
103
|
-
file_path = File.dirname(__FILE__) + '/hash.yaml'
|
104
|
-
open file_path do |file|
|
105
|
-
require 'yaml'
|
106
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
107
|
-
preferences1 = gopher.load_from_file file
|
108
|
-
preferences1.should == preferences0
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'should raise a ParsingError when the file is not YAML' do
|
113
|
-
gopher = Secretary::Gopher::YAML.new stub_everything
|
114
|
-
file_path = File.dirname(__FILE__) + '/broken-yaml.txt'
|
115
|
-
open file_path do |file|
|
116
|
-
lambda { gopher.load_from_file file } \
|
117
|
-
.should raise_error(Secretary::Error::Parsing)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'should raise an InvalidDataError when the file\'s data is not a Hash and the valid data type is Hash' do
|
122
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
123
|
-
file_path = File.dirname(__FILE__) + '/array.yaml'
|
124
|
-
open file_path do |file|
|
125
|
-
lambda { gopher.load_from_file file } \
|
126
|
-
.should raise_error(Secretary::Error::InvalidData)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
describe 'when reading from a path to a file' do
|
133
|
-
|
134
|
-
it 'should raise a MissingFileError when the path leads to nowhere' do
|
135
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
136
|
-
lambda { gopher.load_from_path 'missing-file.yaml' } \
|
137
|
-
.should raise_error(Secretary::Error::MissingFile)
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'should get the path\'s file\'s data when the file is YAML and that data is a Hash and the given type is Hash' do
|
141
|
-
preferences0 = {'name' => 'Billy Bob', 'email' => 'xxx@yyy.zzz'}
|
142
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
143
|
-
file_path = File.dirname(__FILE__) + '/hash.yaml'
|
144
|
-
preferences1 = gopher.load_from_path(file_path)
|
145
|
-
preferences1.should == preferences0
|
146
|
-
end
|
147
|
-
|
148
|
-
it 'should raise an InvalidDataError when the path\'s file\'s data is not a Hash and the valid data type is Hash' do
|
149
|
-
gopher = Secretary::Gopher::YAML.new Hash
|
150
|
-
file_path = File.dirname(__FILE__) + '/array.yaml'
|
151
|
-
lambda { gopher.load_from_path file_path } \
|
152
|
-
.should raise_error(Secretary::Error::InvalidData)
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
end
|
data/spec/secretary_spec.rb
DELETED
@@ -1,259 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
require 'lib/secretary'
|
3
|
-
require 'lib/secretary/gopher/yaml'
|
4
|
-
|
5
|
-
describe Secretary do
|
6
|
-
|
7
|
-
it 'should be enumerable' do
|
8
|
-
gopher = stub 'Gopher', :load_from_path => {}
|
9
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
10
|
-
file_path = stub 'File Path'
|
11
|
-
secretary = Secretary.new file_path, {}, gopher_class
|
12
|
-
secretary.should be_a_kind_of(Enumerable)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should know the file path it saves to' do
|
16
|
-
gopher = stub 'Gopher', :load_from_path => {}
|
17
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
18
|
-
file_path = stub 'File Path'
|
19
|
-
secretary = Secretary.new file_path, {}, gopher_class
|
20
|
-
secretary.file_path.should == file_path
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should know its defaults' do
|
24
|
-
gopher = stub 'Gopher', :load_from_path => {}
|
25
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
26
|
-
secretary = Secretary.new stub_everything, {'name' => ''}, gopher_class
|
27
|
-
secretary.defaults.should == {'name' => ''}
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should have an empty hash for its defaults by default' do
|
31
|
-
gopher = stub 'Gopher', :load_from_path => {}
|
32
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
33
|
-
secretary = Secretary.new stub_everything, {}, gopher_class
|
34
|
-
secretary.defaults.should == {}
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should create a new gopher, which expects a Hash, from the given gopher class' do
|
38
|
-
gopher = stub 'Gopher', :load_from_path => {}
|
39
|
-
gopher_class = mock 'Gopher Class'
|
40
|
-
gopher_class.should_receive(:new).with(Hash).and_return(gopher)
|
41
|
-
secretary = Secretary.new stub_everything, stub_everything, gopher_class
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should create a new YAML gopher by default' do
|
45
|
-
secretary = Secretary.new 'file_path'
|
46
|
-
secretary.gopher.should be_a_kind_of(Secretary::Gopher::YAML)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should know its gopher' do
|
50
|
-
defaults = stub_everything
|
51
|
-
gopher = stub 'Gopher', :load_from_path => {}
|
52
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
53
|
-
secretary = Secretary.new stub_everything, defaults, gopher_class
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should be able to set its values' do
|
57
|
-
data = {'name' => 'Billy Bob'}
|
58
|
-
gopher = stub 'Gopher', :load_from_path => data
|
59
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
60
|
-
secretary = Secretary.new stub_everything, {}, gopher_class
|
61
|
-
secretary['name'] = 'Joe'
|
62
|
-
secretary['name'].should == 'Joe'
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should be able to delete its values' do
|
66
|
-
data = {'name' => 'Billy Bob'}
|
67
|
-
gopher = stub 'Gopher', :load_from_path => data
|
68
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
69
|
-
secretary = Secretary.new stub_everything, {}, gopher_class
|
70
|
-
secretary.delete 'name'
|
71
|
-
secretary.should_not include('name')
|
72
|
-
end
|
73
|
-
|
74
|
-
describe 'when accessing a key' do
|
75
|
-
|
76
|
-
it 'should know the key\'s value' do
|
77
|
-
data = {'name' => 'Billy Bob'}
|
78
|
-
gopher = stub 'Gopher', :load_from_path => data
|
79
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
80
|
-
secretary = Secretary.new stub_everything, {}, gopher_class
|
81
|
-
secretary['name'].should == 'Billy Bob'
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'should give the key\'s corresponding default value if the key\'s does not otherwise exist in its contents' do
|
85
|
-
defaults = {'name' => 'Billy Bob'}
|
86
|
-
data = {}
|
87
|
-
gopher = stub 'Gopher', :load_from_path => data
|
88
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
89
|
-
secretary = Secretary.new stub_everything, defaults, gopher_class
|
90
|
-
secretary['name'].should == 'Billy Bob'
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'should give the key\'s corresponding default value after the key is deleted' do
|
94
|
-
defaults = {'name' => 'Joe'}
|
95
|
-
data = {'name' => 'Billy Bob'}
|
96
|
-
gopher = stub 'Gopher', :load_from_path => data
|
97
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
98
|
-
secretary = Secretary.new stub_everything, defaults, gopher_class
|
99
|
-
secretary.delete 'name'
|
100
|
-
secretary['name'].should == 'Joe'
|
101
|
-
end
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
describe 'using a custom gopher' do
|
106
|
-
|
107
|
-
it 'should raise an error when its given gopher class cannot make new gophers' do
|
108
|
-
gopher_class = stub 'Gopher Class'
|
109
|
-
lambda { Secretary.new stub_everything, {}, gopher_class } \
|
110
|
-
.should raise_error(ArgumentError)
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'should raise an error when its given gopher class\'s objects cannot act like gophers' do
|
114
|
-
gopher = stub 'Gopher'
|
115
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
116
|
-
lambda { Secretary.new stub_everything, {}, gopher_class } \
|
117
|
-
.should raise_error(ArgumentError)
|
118
|
-
end
|
119
|
-
|
120
|
-
describe 'updating itself based on what the gopher brings from its file path' do
|
121
|
-
|
122
|
-
it 'have contents of its defaults merged with the file\'s data, when initialized' do
|
123
|
-
defaults = {:bash => 'bang', :bar => 'bing'}
|
124
|
-
data = {:bar => 'foo', :bam => 'fiz'}
|
125
|
-
gopher = stub 'Gopher', :load_from_path => data
|
126
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
127
|
-
secretary = Secretary.new stub_everything, defaults, gopher_class
|
128
|
-
secretary.to_hash.should == defaults.merge(data)
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'have contents of its defaults only if its file does not yet exist, when initialized' do
|
132
|
-
defaults = {:bash => 'bang', :bar => 'bing'}
|
133
|
-
gopher = stub 'Gopher'
|
134
|
-
gopher.stub!(:load_from_path).and_raise(
|
135
|
-
Secretary::Error::MissingFile.new(stub_everything)
|
136
|
-
)
|
137
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
138
|
-
secretary = Secretary.new stub_everything, defaults, gopher_class
|
139
|
-
secretary.to_hash.should == defaults
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'should update its contents with its defaults, based on what the gopher brings from its file path, when reloaded' do
|
143
|
-
defaults = {:bash => 'bang', :bar => 'bing'}
|
144
|
-
data = {:bar => 'foo', :bam => 'fiz'}
|
145
|
-
gopher = stub 'Gopher'
|
146
|
-
gopher.stub!(:load_from_path).and_return({}, data)
|
147
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
148
|
-
secretary = Secretary.new stub_everything, defaults, gopher_class
|
149
|
-
secretary.reload
|
150
|
-
secretary.to_hash.should == defaults.merge(data)
|
151
|
-
end
|
152
|
-
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'should send its contents to the gopher when saving' do
|
156
|
-
contents = {:bar => 'foo', :bam => 'fiz'}
|
157
|
-
file_path = stub_everything
|
158
|
-
gopher = stub 'Gopher', :load_from_path => contents
|
159
|
-
gopher.should_receive(:save).with(contents, file_path).once
|
160
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
161
|
-
secretary = Secretary.new file_path, {}, gopher_class
|
162
|
-
secretary.save
|
163
|
-
end
|
164
|
-
|
165
|
-
end
|
166
|
-
|
167
|
-
describe 'using a default YAML gopher' do
|
168
|
-
|
169
|
-
describe 'updating itself based on what the gopher brings from its file path' do
|
170
|
-
|
171
|
-
it 'have contents of its defaults merged with the file\'s data, when initialized' do
|
172
|
-
defaults = {'name' => '', 'port' => 80}
|
173
|
-
data = {'name' => 'Billy Bob', 'email' => 'xxx@yyy.zzz'}
|
174
|
-
file_path = File.dirname(__FILE__) + '/hash.yaml'
|
175
|
-
secretary = Secretary.new file_path, defaults
|
176
|
-
secretary.to_hash.should == defaults.merge(data)
|
177
|
-
end
|
178
|
-
|
179
|
-
it 'have contents of its defaults only if its file does not yet exist, when initialized' do
|
180
|
-
defaults = {'name' => '', 'port' => 80}
|
181
|
-
file_path = File.dirname(__FILE__) + '/missing_file.yaml'
|
182
|
-
secretary = Secretary.new file_path, defaults
|
183
|
-
secretary.to_hash.should == defaults
|
184
|
-
end
|
185
|
-
|
186
|
-
end
|
187
|
-
|
188
|
-
describe 'when saving data' do
|
189
|
-
|
190
|
-
it 'should create a new data file if it does not exist' do
|
191
|
-
defaults = {'name' => '', 'port' => 80}
|
192
|
-
data = {'name' => 'Billy Bob', 'email' => 'xxx@yyy.zzz'}
|
193
|
-
file_path = File.dirname(__FILE__) + '/temporary.yaml'
|
194
|
-
secretary = Secretary.new file_path, defaults
|
195
|
-
secretary.save
|
196
|
-
File.exists?(file_path).should be_true
|
197
|
-
File.delete file_path
|
198
|
-
end
|
199
|
-
|
200
|
-
end
|
201
|
-
|
202
|
-
end
|
203
|
-
|
204
|
-
describe 'when comparing with another object' do
|
205
|
-
|
206
|
-
it 'should be equal if their file paths, defaults, and contents are equal' do
|
207
|
-
file_path = stub_everything
|
208
|
-
defaults = {:boo => 'bash'}
|
209
|
-
contents = {:boo => 'bam', :foo => 'bar'}
|
210
|
-
gopher = stub 'Gopher', :load_from_path => contents
|
211
|
-
gopher_class = stub 'Gopher Class', :new => gopher
|
212
|
-
secretary = Secretary.new file_path, defaults, gopher_class
|
213
|
-
other = stub 'Other', :file_path => file_path, :defaults => defaults,
|
214
|
-
:gopher => gopher, :to_hash => contents
|
215
|
-
secretary.to_hash.should == other.to_hash
|
216
|
-
secretary.should == other
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'should be unequal if their file paths are unequal' do
|
220
|
-
defaults = {:bash => 'bang', :bar => 'bing'}
|
221
|
-
gopher_class = stub 'Gopher Class', :new => stub('Gopher', :load_from_path => {})
|
222
|
-
secretary0 = Secretary.new stub_everything, defaults, gopher_class
|
223
|
-
secretary1 = Secretary.new stub_everything, defaults, gopher_class
|
224
|
-
secretary0.should_not == secretary1
|
225
|
-
end
|
226
|
-
|
227
|
-
it 'should be unequal if their defaults are unequal' do
|
228
|
-
gopher_class = stub 'Gopher Class', :new => stub('Gopher', :load_from_path => {})
|
229
|
-
defaults0 = {:bash => 'bang', :bar => 'bing'}
|
230
|
-
defaults1 = {:bash => 'foo', :bar => 'bing'}
|
231
|
-
secretary0 = Secretary.new stub_everything, defaults0, gopher_class
|
232
|
-
secretary1 = Secretary.new stub_everything, defaults1, gopher_class
|
233
|
-
secretary0.should_not == secretary1
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'should be unequal if the other does not respond to :file_path' do
|
237
|
-
gopher_class = stub 'Gopher Class', :new => stub('Gopher', :load_from_path => {})
|
238
|
-
secretary = Secretary.new stub_everything, {}, gopher_class
|
239
|
-
other = stub 'Other'
|
240
|
-
secretary.should_not == other
|
241
|
-
end
|
242
|
-
|
243
|
-
it 'should be unequal if the other does not respond to :gopher' do
|
244
|
-
gopher_class = stub 'Gopher Class', :new => stub('Gopher', :load_from_path => {})
|
245
|
-
secretary = Secretary.new stub_everything, {}, gopher_class
|
246
|
-
other = stub 'Other'
|
247
|
-
secretary.should_not == other
|
248
|
-
end
|
249
|
-
|
250
|
-
it 'should be unequal if the other does not respond to :file_path' do
|
251
|
-
gopher_class = stub 'Gopher Class', :new => stub('Gopher', :load_from_path => {})
|
252
|
-
secretary = Secretary.new stub_everything, {}, gopher_class
|
253
|
-
other = stub 'Other'
|
254
|
-
secretary.should_not == other
|
255
|
-
end
|
256
|
-
|
257
|
-
end
|
258
|
-
|
259
|
-
end
|