t 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/spec/rcfile_spec.rb CHANGED
@@ -8,23 +8,23 @@ describe T::RCFile do
8
8
  File.delete(project_path + "/tmp/trc") if File.exist?(project_path + "/tmp/trc")
9
9
  end
10
10
 
11
- it 'is a singleton' do
12
- T::RCFile.should be_a Class
13
- lambda do
11
+ it "is a singleton" do
12
+ expect(T::RCFile).to be_a Class
13
+ expect do
14
14
  T::RCFile.new
15
- end.should raise_error(NoMethodError, /private method `new' called/)
15
+ end.to raise_error(NoMethodError, /private method `new' called/)
16
16
  end
17
17
 
18
- describe '#[]' do
19
- it 'should return the profiles for a user' do
18
+ describe "#[]" do
19
+ it "should return the profiles for a user" do
20
20
  rcfile = T::RCFile.instance
21
21
  rcfile.path = fixture_path + "/.trc"
22
- rcfile['testcli'].keys.should == ['abc123']
22
+ expect(rcfile['testcli'].keys).to eq ['abc123']
23
23
  end
24
24
  end
25
25
 
26
- describe '#[]=' do
27
- it 'should add a profile for a user' do
26
+ describe "#[]=" do
27
+ it "should add a profile for a user" do
28
28
  rcfile = T::RCFile.instance
29
29
  rcfile.path = project_path + "/tmp/trc"
30
30
  rcfile['testcli'] = {
@@ -36,9 +36,9 @@ describe T::RCFile do
36
36
  :secret => 'jkl012',
37
37
  }
38
38
  }
39
- rcfile['testcli'].keys.should == ['abc123']
39
+ expect(rcfile['testcli'].keys).to eq ['abc123']
40
40
  end
41
- it 'should write the data to disk' do
41
+ it "should write the data to disk" do
42
42
  rcfile = T::RCFile.instance
43
43
  rcfile.path = project_path + "/tmp/trc"
44
44
  rcfile['testcli'] = {
@@ -50,9 +50,9 @@ describe T::RCFile do
50
50
  :secret => 'jkl012',
51
51
  }
52
52
  }
53
- rcfile['testcli'].keys.should == ['abc123']
53
+ expect(rcfile['testcli'].keys).to eq ['abc123']
54
54
  end
55
- it 'should not be world readable or writable' do
55
+ it "should not be world readable or writable" do
56
56
  rcfile = T::RCFile.instance
57
57
  rcfile.path = project_path + "/tmp/trc"
58
58
  rcfile['testcli'] = {
@@ -64,143 +64,143 @@ describe T::RCFile do
64
64
  :secret => 'jkl012',
65
65
  }
66
66
  }
67
- File.stat(rcfile.path).mode.should == 33152
67
+ expect(File.stat(rcfile.path).mode).to eq 33152
68
68
  end
69
69
  end
70
70
 
71
- describe '#configuration' do
72
- it 'should return configuration' do
71
+ describe "#configuration" do
72
+ it "should return configuration" do
73
73
  rcfile = T::RCFile.instance
74
74
  rcfile.path = fixture_path + "/.trc"
75
- rcfile.configuration.keys.should == ['default_profile']
75
+ expect(rcfile.configuration.keys).to eq ['default_profile']
76
76
  end
77
77
  end
78
78
 
79
- describe '#active_consumer_key' do
80
- it 'should return default consumer key' do
79
+ describe "#active_consumer_key" do
80
+ it "should return default consumer key" do
81
81
  rcfile = T::RCFile.instance
82
82
  rcfile.path = fixture_path + "/.trc"
83
- rcfile.active_consumer_key.should == 'abc123'
83
+ expect(rcfile.active_consumer_key).to eq 'abc123'
84
84
  end
85
85
  end
86
86
 
87
- describe '#active_consumer_secret' do
88
- it 'should return default consumer secret' do
87
+ describe "#active_consumer_secret" do
88
+ it "should return default consumer secret" do
89
89
  rcfile = T::RCFile.instance
90
90
  rcfile.path = fixture_path + "/.trc"
91
- rcfile.active_consumer_secret.should == 'asdfasd223sd2'
91
+ expect(rcfile.active_consumer_secret).to eq 'asdfasd223sd2'
92
92
  end
93
93
  end
94
94
 
95
- describe '#active_profile' do
96
- it 'should return default profile' do
95
+ describe "#active_profile" do
96
+ it "should return default profile" do
97
97
  rcfile = T::RCFile.instance
98
98
  rcfile.path = fixture_path + "/.trc"
99
- rcfile.active_profile.should == ['testcli', 'abc123']
99
+ expect(rcfile.active_profile).to eq ['testcli', 'abc123']
100
100
  end
101
101
  end
102
102
 
103
- describe '#active_profile=' do
104
- it 'should set default profile' do
103
+ describe "#active_profile=" do
104
+ it "should set default profile" do
105
105
  rcfile = T::RCFile.instance
106
106
  rcfile.path = project_path + "/tmp/trc"
107
107
  rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
108
- rcfile.active_profile.should == ['testcli', 'abc123']
108
+ expect(rcfile.active_profile).to eq ['testcli', 'abc123']
109
109
  end
110
- it 'should write the data to disk' do
110
+ it "should write the data to disk" do
111
111
  rcfile = T::RCFile.instance
112
112
  rcfile.path = project_path + "/tmp/trc"
113
113
  rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
114
- rcfile.active_profile.should == ['testcli', 'abc123']
114
+ expect(rcfile.active_profile).to eq ['testcli', 'abc123']
115
115
  end
116
116
  end
117
117
 
118
- describe '#active_token' do
119
- it 'should return default token' do
118
+ describe "#active_token" do
119
+ it "should return default token" do
120
120
  rcfile = T::RCFile.instance
121
121
  rcfile.path = fixture_path + "/.trc"
122
- rcfile.active_token.should == '428004849-cebdct6bwobn'
122
+ expect(rcfile.active_token).to eq '428004849-cebdct6bwobn'
123
123
  end
124
124
  end
125
125
 
126
- describe '#active_secret' do
127
- it 'should return default secret' do
126
+ describe "#active_secret" do
127
+ it "should return default secret" do
128
128
  rcfile = T::RCFile.instance
129
129
  rcfile.path = fixture_path + "/.trc"
130
- rcfile.active_secret.should == 'epzrjvxtumoc'
130
+ expect(rcfile.active_secret).to eq 'epzrjvxtumoc'
131
131
  end
132
132
  end
133
133
 
134
- describe '#delete' do
135
- it 'should delete the rcfile' do
134
+ describe "#delete" do
135
+ it "should delete the rcfile" do
136
136
  path = project_path + "/tmp/trc"
137
137
  File.open(path, 'w'){|file| file.write(YAML.dump({}))}
138
- File.exist?(path).should be_true
138
+ expect(File.exist?(path)).to be_true
139
139
  rcfile = T::RCFile.instance
140
140
  rcfile.path = path
141
141
  rcfile.delete
142
- File.exist?(path).should be_false
142
+ expect(File.exist?(path)).to be_false
143
143
  end
144
144
  end
145
145
 
146
- describe '#empty?' do
147
- context 'when a non-empty file exists' do
148
- it 'should return false' do
146
+ describe "#empty?" do
147
+ context "when a non-empty file exists" do
148
+ it "should return false" do
149
149
  rcfile = T::RCFile.instance
150
150
  rcfile.path = fixture_path + "/.trc"
151
- rcfile.empty?.should be_false
151
+ expect(rcfile.empty?).to be_false
152
152
  end
153
153
  end
154
- context 'when file does not exist at path' do
155
- it 'should return true' do
154
+ context "when file does not exist at path" do
155
+ it "should return true" do
156
156
  rcfile = T::RCFile.instance
157
157
  rcfile.path = File.expand_path('../fixtures/foo', __FILE__)
158
- rcfile.empty?.should be_true
158
+ expect(rcfile.empty?).to be_true
159
159
  end
160
160
  end
161
161
  end
162
162
 
163
- describe '#load_file' do
164
- context 'when file exists at path' do
165
- it 'should load data from file' do
163
+ describe "#load_file" do
164
+ context "when file exists at path" do
165
+ it "should load data from file" do
166
166
  rcfile = T::RCFile.instance
167
167
  rcfile.path = fixture_path + "/.trc"
168
- rcfile.load_file['profiles']['testcli']['abc123']['username'].should == 'testcli'
168
+ expect(rcfile.load_file['profiles']['testcli']['abc123']['username']).to eq 'testcli'
169
169
  end
170
170
  end
171
- context 'when file does not exist at path' do
172
- it 'should load default structure' do
171
+ context "when file does not exist at path" do
172
+ it "should load default structure" do
173
173
  rcfile = T::RCFile.instance
174
174
  rcfile.path = File.expand_path('../fixtures/foo', __FILE__)
175
- rcfile.load_file.keys.sort.should == ['configuration', 'profiles']
175
+ expect(rcfile.load_file.keys.sort).to eq ['configuration', 'profiles']
176
176
  end
177
177
  end
178
178
  end
179
179
 
180
- describe '#path' do
181
- it 'should default to ~/.trc' do
182
- T::RCFile.instance.path.should == File.join(File.expand_path('~'), '.trc')
180
+ describe "#path" do
181
+ it "should default to ~/.trc" do
182
+ expect(T::RCFile.instance.path).to eq File.join(File.expand_path('~'), '.trc')
183
183
  end
184
184
  end
185
185
 
186
- describe '#path=' do
187
- it 'should override path' do
186
+ describe "#path=" do
187
+ it "should override path" do
188
188
  rcfile = T::RCFile.instance
189
189
  rcfile.path = project_path + "/tmp/trc"
190
- rcfile.path.should == project_path + "/tmp/trc"
190
+ expect(rcfile.path).to eq project_path + "/tmp/trc"
191
191
  end
192
- it 'should reload data' do
192
+ it "should reload data" do
193
193
  rcfile = T::RCFile.instance
194
194
  rcfile.path = fixture_path + "/.trc"
195
- rcfile['testcli']['abc123']['username'].should == 'testcli'
195
+ expect(rcfile['testcli']['abc123']['username']).to eq 'testcli'
196
196
  end
197
197
  end
198
198
 
199
- describe '#profiles' do
200
- it 'should return profiles' do
199
+ describe "#profiles" do
200
+ it "should return profiles" do
201
201
  rcfile = T::RCFile.instance
202
202
  rcfile.path = fixture_path + "/.trc"
203
- rcfile.profiles.keys.should == ['testcli']
203
+ expect(rcfile.profiles.keys).to eq ['testcli']
204
204
  end
205
205
  end
206
206