devdnsd 2.3.0 → 2.3.1

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/.travis-gemfile CHANGED
@@ -8,7 +8,7 @@ source "http://rubygems.org"
8
8
 
9
9
  gemspec
10
10
 
11
- # Testing gems
11
+ # Testing
12
12
  gem "rspec", "~> 2.14.1"
13
13
  gem "rake", "~> 10.1.0"
14
14
  gem "net-dns", "~> 0.8.0"
data/Rakefile CHANGED
@@ -9,3 +9,21 @@ require "rspec/core/rake_task"
9
9
 
10
10
  RSpec::Core::RakeTask.new("spec")
11
11
  RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }
12
+
13
+ desc "Generate the documentation"
14
+ task :docs do
15
+ system("yardoc") || raise("Failed Execution of: yardoc")
16
+ end
17
+
18
+ desc "Get the current release version"
19
+ task :version, :with_name do |_, args|
20
+ gem = Bundler::GemHelper.instance.gemspec
21
+ puts [args[:with_name] == "true" ? gem.name : nil, gem.version].compact.join("-")
22
+ end
23
+
24
+ desc "Prepare the release"
25
+ task :prerelease => ["spec:coverage", "docs"] do
26
+ ["git add -A", "git commit -am \"Version #{Bundler::GemHelper.instance.gemspec.version}\""].each do |cmd|
27
+ system(cmd) || raise("Failed Execution of: #{cmd}")
28
+ end
29
+ end
data/devdnsd.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
 
24
24
  gem.required_ruby_version = ">= 1.9.3"
25
25
 
26
- gem.add_dependency("mamertes", "~> 2.2.0")
26
+ gem.add_dependency("mamertes", "~> 2.2.1")
27
27
  gem.add_dependency("rubydns", "~> 0.6.3")
28
28
  gem.add_dependency("rexec", "~> 1.5.1")
29
29
  end
data/doc/DevDNSd.html CHANGED
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Sun Jul 14 18:03:53 2013 by
124
+ Generated on Sat Jul 20 12:04:58 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.6.2 (ruby-1.9.3).
127
127
  </div>
@@ -2093,7 +2093,7 @@
2093
2093
  </div>
2094
2094
 
2095
2095
  <div id="footer">
2096
- Generated on Sun Jul 14 18:03:55 2013 by
2096
+ Generated on Sat Jul 20 12:04:59 2013 by
2097
2097
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2098
2098
  0.8.6.2 (ruby-1.9.3).
2099
2099
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 18:03:53 2013 by
119
+ Generated on Sat Jul 20 12:04:58 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -508,7 +508,7 @@
508
508
  </div>
509
509
 
510
510
  <div id="footer">
511
- Generated on Sun Jul 14 18:03:54 2013 by
511
+ Generated on Sat Jul 20 12:04:58 2013 by
512
512
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
513
513
  0.8.6.2 (ruby-1.9.3).
514
514
  </div>
@@ -947,7 +947,7 @@
947
947
  </div>
948
948
 
949
949
  <div id="footer">
950
- Generated on Sun Jul 14 18:03:54 2013 by
950
+ Generated on Sat Jul 20 12:04:58 2013 by
951
951
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
952
952
  0.8.6.2 (ruby-1.9.3).
953
953
  </div>
@@ -363,7 +363,7 @@
363
363
  </div>
364
364
 
365
365
  <div id="footer">
366
- Generated on Sun Jul 14 18:03:54 2013 by
366
+ Generated on Sat Jul 20 12:04:58 2013 by
367
367
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
368
368
  0.8.6.2 (ruby-1.9.3).
369
369
  </div>
@@ -411,7 +411,7 @@ config.add_rule("match.dev", "10.0.0.1")
411
411
  </div>
412
412
 
413
413
  <div id="footer">
414
- Generated on Sun Jul 14 18:03:55 2013 by
414
+ Generated on Sat Jul 20 12:04:59 2013 by
415
415
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
416
416
  0.8.6.2 (ruby-1.9.3).
417
417
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sun Jul 14 18:03:53 2013 by
119
+ Generated on Sat Jul 20 12:04:58 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.6.2 (ruby-1.9.3).
122
122
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Sun Jul 14 18:03:54 2013 by
127
+ Generated on Sat Jul 20 12:04:59 2013 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.6.2 (ruby-1.9.3).
130
130
  </div>
@@ -2927,7 +2927,7 @@
2927
2927
  </div>
2928
2928
 
2929
2929
  <div id="footer">
2930
- Generated on Sun Jul 14 18:03:54 2013 by
2930
+ Generated on Sat Jul 20 12:04:59 2013 by
2931
2931
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2932
2932
  0.8.6.2 (ruby-1.9.3).
2933
2933
  </div>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
153
153
 
154
154
  <dt id="STRING-constant" class="">STRING =
155
155
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Sun Jul 14 18:03:53 2013 by
183
+ Generated on Sat Jul 20 12:04:58 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.6.2 (ruby-1.9.3).
186
186
  </div>
data/doc/_index.html CHANGED
@@ -230,7 +230,7 @@
230
230
  </div>
231
231
 
232
232
  <div id="footer">
233
- Generated on Sun Jul 14 18:03:53 2013 by
233
+ Generated on Sat Jul 20 12:04:58 2013 by
234
234
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
235
235
  0.8.6.2 (ruby-1.9.3).
236
236
  </div>
data/doc/file.README.html CHANGED
@@ -163,7 +163,7 @@ This argument is ignored if you pass the block, as it assumes that the second ar
163
163
  </div></div>
164
164
 
165
165
  <div id="footer">
166
- Generated on Sun Jul 14 18:03:53 2013 by
166
+ Generated on Sat Jul 20 12:04:58 2013 by
167
167
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
168
168
  0.8.6.2 (ruby-1.9.3).
169
169
  </div>
data/doc/index.html CHANGED
@@ -163,7 +163,7 @@ This argument is ignored if you pass the block, as it assumes that the second ar
163
163
  </div></div>
164
164
 
165
165
  <div id="footer">
166
- Generated on Sun Jul 14 18:03:53 2013 by
166
+ Generated on Sat Jul 20 12:04:58 2013 by
167
167
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
168
168
  0.8.6.2 (ruby-1.9.3).
169
169
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sun Jul 14 18:03:53 2013 by
106
+ Generated on Sat Jul 20 12:04:58 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.6.2 (ruby-1.9.3).
109
109
  </div>
@@ -16,7 +16,7 @@ module DevDNSd
16
16
  MINOR = 3
17
17
 
18
18
  # The patch version.
19
- PATCH = 0
19
+ PATCH = 1
20
20
 
21
21
  # The current version number of DevDNSd.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -8,8 +8,8 @@ require "spec_helper"
8
8
 
9
9
  describe DevDNSd::Application do
10
10
  before(:each) do
11
- Bovem::Logger.stub(:default_file).and_return("/dev/null")
12
- DevDNSd::Application.stub(:instance).and_return(application)
11
+ allow(Bovem::Logger).to receive(:default_file).and_return("/dev/null")
12
+ allow(DevDNSd::Application).to receive(:instance).and_return(application)
13
13
  end
14
14
 
15
15
  def create_application(overrides = {})
@@ -33,15 +33,15 @@ describe DevDNSd::Application do
33
33
  let(:launch_agent_path) { "/tmp/devdnsd-test-agent-#{Time.now.strftime("%Y%m%d-%H%M%S")}" }
34
34
 
35
35
  describe "#initialize" do
36
- it("should setup the logger") do
36
+ it "should setup the logger" do
37
37
  expect(application.logger).not_to be_nil
38
38
  end
39
39
 
40
- it("should setup the configuration") do
40
+ it "should setup the configuration" do
41
41
  expect(application.config).not_to be_nil
42
42
  end
43
43
 
44
- it("should abort with an invalid configuration") do
44
+ it "should abort with an invalid configuration" do
45
45
  path = "/tmp/devdnsd-test-#{Time.now.strftime("%Y%m%d-%H:%M:%S")}"
46
46
  file = ::File.new(path, "w")
47
47
  file.write("config.port = ")
@@ -54,14 +54,14 @@ describe DevDNSd::Application do
54
54
 
55
55
  describe ".run" do
56
56
  it "should run the server" do
57
- application.should_receive(:perform_server)
57
+ expect(application).to receive(:perform_server)
58
58
  DevDNSd::Application.run
59
59
  end
60
60
  end
61
61
 
62
62
  describe ".quit" do
63
63
  it "should quit the application" do
64
- ::EventMachine.should_receive(:stop)
64
+ expect(::EventMachine).to receive(:stop)
65
65
  DevDNSd::Application.quit
66
66
  end
67
67
  end
@@ -69,22 +69,22 @@ describe DevDNSd::Application do
69
69
  describe ".check_ruby_implementation" do
70
70
  it "won't run on Rubinius" do
71
71
  stub_const("Rubinius", true)
72
- Kernel.should_receive(:exit).with(0)
73
- Kernel.should_receive(:puts)
72
+ expect(Kernel).to receive(:exit).with(0)
73
+ expect(Kernel).to receive(:puts)
74
74
  DevDNSd::Application.check_ruby_implementation
75
75
  end
76
76
 
77
77
  it "won't run on JRuby" do
78
78
  stub_const("JRuby", true)
79
- Kernel.should_receive(:exit).with(0)
80
- Kernel.should_receive(:puts)
79
+ expect(Kernel).to receive(:exit).with(0)
80
+ expect(Kernel).to receive(:puts)
81
81
  DevDNSd::Application.check_ruby_implementation
82
82
  end
83
83
  end
84
84
 
85
85
  describe ".instance" do
86
86
  before(:each) do
87
- DevDNSd::Application.unstub(:instance)
87
+ allow(DevDNSd::Application).to receive(:instance).and_call_original
88
88
  end
89
89
 
90
90
  let(:mamertes) {
@@ -104,14 +104,14 @@ describe DevDNSd::Application do
104
104
 
105
105
  it "should always return the same instance" do
106
106
  other = DevDNSd::Application.instance(mamertes)
107
- DevDNSd::Application.should_not_receive(:new)
107
+ expect(DevDNSd::Application).not_to receive(:new)
108
108
  expect(DevDNSd::Application.instance(mamertes)).to eq(other)
109
109
  expect(DevDNSd::Application.instance).to eq(other)
110
110
  end
111
111
 
112
112
  it "should recreate an instance" do
113
113
  other = DevDNSd::Application.instance(mamertes)
114
- expect(DevDNSd::Application.instance(mamertes, :en, true)).not_to eq(other)
114
+ expect(DevDNSd::Application.instance(mamertes, :en, true)).not_to be(other)
115
115
  end
116
116
  end
117
117
 
@@ -158,7 +158,7 @@ describe DevDNSd::Application do
158
158
  let(:application){ create_application({"log_file" => log_file, "configuration" => sample_config}) }
159
159
 
160
160
  def test_resolve(host = "match_1.dev", type = "ANY", nameserver = "127.0.0.1", port = 7771, logger = nil)
161
- application.stub(:on_start) do Thread.main[:resolver].run if Thread.main[:resolver].try(:alive?) end
161
+ allow(application).to receive(:on_start) do Thread.main[:resolver].run if Thread.main[:resolver].try(:alive?) end
162
162
 
163
163
  Thread.current[:resolver] = Thread.start {
164
164
  Thread.stop
@@ -181,13 +181,13 @@ describe DevDNSd::Application do
181
181
  end
182
182
 
183
183
  it "should run the server" do
184
- RubyDNS.should_receive(:run_server)
184
+ expect(RubyDNS).to receive(:run_server)
185
185
  application.perform_server
186
186
  end
187
187
 
188
188
  it "should setup callbacks" do
189
- RubyDNS::Server.any_instance.should_receive(:on).with(:start)
190
- RubyDNS::Server.any_instance.should_receive(:on).with(:stop)
189
+ expect_any_instance_of(RubyDNS::Server).to receive(:on).with(:start)
190
+ expect_any_instance_of(RubyDNS::Server).to receive(:on).with(:stop)
191
191
 
192
192
  Thread.new {
193
193
  sleep(0.1)
@@ -199,21 +199,21 @@ describe DevDNSd::Application do
199
199
 
200
200
  it "should iterate the rules" do
201
201
  test_resolve do
202
- application.config.rules.should_receive(:each).at_least(1)
202
+ expect(application.config.rules).to receive(:each).at_least(1)
203
203
  application.perform_server
204
204
  end
205
205
  end
206
206
 
207
207
  it "should call process_rule" do
208
208
  test_resolve do
209
- application.should_receive(:process_rule).at_least(1)
209
+ expect(application).to receive(:process_rule).at_least(1)
210
210
  application.perform_server
211
211
  end
212
212
  end
213
213
 
214
214
  it "should complain about wrong rules" do
215
215
  test_resolve do
216
- application.stub(:process_rule).and_raise(::Exception)
216
+ allow(application).to receive(:process_rule).and_raise(::Exception)
217
217
  expect { application.perform_server }.to raise_exception
218
218
  end
219
219
  end
@@ -323,7 +323,7 @@ describe DevDNSd::Application do
323
323
 
324
324
  describe "#dns_update" do
325
325
  it "should update the DNS cache" do
326
- application.stub(:execute_command).and_return("EXECUTED")
326
+ allow(application).to receive(:execute_command).and_return("EXECUTED")
327
327
  expect(application.dns_update).to eq("EXECUTED")
328
328
  end
329
329
  end
@@ -361,22 +361,22 @@ describe DevDNSd::Application do
361
361
  it "should call perform_server in foreground" do
362
362
  application = create_application({"log_file" => log_file})
363
363
  application.config.foreground = true
364
- application.should_receive(:perform_server)
364
+ expect(application).to receive(:perform_server)
365
365
  application.action_start
366
366
  end
367
367
 
368
368
  it "should start the daemon" do
369
369
  application = create_application({"log_file" => log_file})
370
- ::RExec::Daemon::Controller.should_receive(:start)
370
+ expect(::RExec::Daemon::Controller).to receive(:start)
371
371
  application.action_start
372
372
  end
373
373
 
374
374
  it "should check for availability of fork" do
375
375
  application.config.foreground = false
376
376
 
377
- Process.stub(:respond_to?).and_return(false)
378
- application.should_receive(:perform_server)
379
- application.logger.should_receive(:warn)
377
+ allow(Process).to receive(:respond_to?).and_return(false)
378
+ expect(application).to receive(:perform_server)
379
+ expect(application.logger).to receive(:warn)
380
380
 
381
381
  application.action_start
382
382
  expect(application.config.foreground).to be_true
@@ -385,20 +385,20 @@ describe DevDNSd::Application do
385
385
 
386
386
  describe "#action_stop" do
387
387
  it "should stop the daemon" do
388
- ::RExec::Daemon::Controller.should_receive(:stop)
388
+ expect(::RExec::Daemon::Controller).to receive(:stop)
389
389
  application.action_stop
390
390
  end
391
391
  end
392
392
 
393
393
  describe "#action_install" do
394
394
  before(:each) do
395
- application.stub(:is_osx?).and_return(true)
396
- application.stub(:execute_command)
395
+ allow(application).to receive(:is_osx?).and_return(true)
396
+ allow(application).to receive(:execute_command)
397
397
  end
398
398
 
399
399
  it "should create the resolver" do
400
- application.stub(:resolver_path).and_return(resolver_path)
401
- application.stub(:launch_agent_path).and_return(launch_agent_path)
400
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
401
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
402
402
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
403
403
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
404
404
 
@@ -410,12 +410,12 @@ describe DevDNSd::Application do
410
410
  end
411
411
 
412
412
  it "should create the agent" do
413
- application.stub(:resolver_path).and_return(resolver_path)
414
- application.stub(:launch_agent_path).and_return(launch_agent_path)
413
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
414
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
415
415
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
416
416
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
417
417
 
418
- application.stub(:resolver_path).and_return(resolver_path)
418
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
419
419
  application.action_install
420
420
  expect(::File.exists?(application.launch_agent_path)).to be_true
421
421
 
@@ -424,12 +424,12 @@ describe DevDNSd::Application do
424
424
  end
425
425
 
426
426
  it "should update the DNS cache" do
427
- application.stub(:resolver_path).and_return(resolver_path)
428
- application.stub(:launch_agent_path).and_return(launch_agent_path)
427
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
428
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
429
429
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
430
430
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
431
431
 
432
- application.should_receive(:dns_update)
432
+ expect(application).to receive(:dns_update)
433
433
  application.action_install
434
434
 
435
435
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -437,12 +437,12 @@ describe DevDNSd::Application do
437
437
  end
438
438
 
439
439
  it "should not create an invalid resolver" do
440
- application.stub(:resolver_path).and_return("/invalid/resolver")
441
- application.stub(:launch_agent_path).and_return("/invalid/agent")
440
+ allow(application).to receive(:resolver_path).and_return("/invalid/resolver")
441
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
442
442
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
443
443
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
444
444
 
445
- application.logger.should_receive(:error).with("Cannot create the resolver file.")
445
+ expect(application.logger).to receive(:error).with("Cannot create the resolver file.")
446
446
  application.action_install
447
447
 
448
448
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -450,12 +450,12 @@ describe DevDNSd::Application do
450
450
  end
451
451
 
452
452
  it "should not create an invalid agent" do
453
- application.stub(:resolver_path).and_return(resolver_path)
454
- application.stub(:launch_agent_path).and_return("/invalid/agent")
453
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
454
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
455
455
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
456
456
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
457
457
 
458
- application.logger.should_receive(:error).with("Cannot create the launch agent.")
458
+ expect(application.logger).to receive(:error).with("Cannot create the launch agent.")
459
459
  application.action_install
460
460
 
461
461
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -463,16 +463,16 @@ describe DevDNSd::Application do
463
463
  end
464
464
 
465
465
  it "should not load an invalid agent" do
466
- application.stub(:execute_command) do |command|
466
+ allow(application).to receive(:execute_command) do |command|
467
467
  command =~ /^launchctl/ ? raise(StandardError) : true
468
468
  end
469
469
 
470
- application.stub(:resolver_path).and_return(resolver_path)
471
- application.stub(:launch_agent_path).and_return(launch_agent_path)
470
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
471
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
472
472
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
473
473
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
474
474
 
475
- application.logger.should_receive(:error).with("Cannot load the launch agent.")
475
+ expect(application.logger).to receive(:error).with("Cannot load the launch agent.")
476
476
  application.action_install
477
477
 
478
478
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -480,21 +480,21 @@ describe DevDNSd::Application do
480
480
  end
481
481
 
482
482
  it "should raise an exception if not running on OSX" do
483
- application.stub(:is_osx?).and_return(false)
484
- application.logger.should_receive(:fatal).with("Install DevDNSd as a local resolver is only available on MacOSX.")
483
+ allow(application).to receive(:is_osx?).and_return(false)
484
+ expect(application.logger).to receive(:fatal).with("Install DevDNSd as a local resolver is only available on MacOSX.")
485
485
  expect(application.action_install).to be_false
486
486
  end
487
487
  end
488
488
 
489
489
  describe "#action_uninstall" do
490
490
  before(:each) do
491
- application.stub(:is_osx?).and_return(true)
492
- application.stub(:execute_command)
491
+ allow(application).to receive(:is_osx?).and_return(true)
492
+ allow(application).to receive(:execute_command)
493
493
  end
494
494
 
495
495
  it "should remove the resolver" do
496
- application.stub(:resolver_path).and_return(resolver_path)
497
- application.stub(:launch_agent_path).and_return(launch_agent_path)
496
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
497
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
498
498
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
499
499
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
500
500
 
@@ -507,12 +507,12 @@ describe DevDNSd::Application do
507
507
  end
508
508
 
509
509
  it "should remove the agent" do
510
- application.stub(:resolver_path).and_return(resolver_path)
511
- application.stub(:launch_agent_path).and_return(launch_agent_path)
510
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
511
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
512
512
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
513
513
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
514
514
 
515
- Bovem::Logger.stub(:default_file).and_return($stdout)
515
+ allow(Bovem::Logger).to receive(:default_file).and_return($stdout)
516
516
  application.action_install
517
517
  application.action_uninstall
518
518
  expect(::File.exists?(application.launch_agent_path)).to be_false
@@ -522,11 +522,11 @@ describe DevDNSd::Application do
522
522
  end
523
523
 
524
524
  it "should not delete an invalid resolver" do
525
- application.stub(:resolver_path).and_return("/invalid/resolver")
526
- application.stub(:launch_agent_path).and_return("/invalid/agent")
525
+ allow(application).to receive(:resolver_path).and_return("/invalid/resolver")
526
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
527
527
 
528
528
  application.action_install
529
- application.logger.should_receive(:warn).at_least(1)
529
+ expect(application.logger).to receive(:warn).at_least(1)
530
530
  application.action_uninstall
531
531
 
532
532
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -534,11 +534,11 @@ describe DevDNSd::Application do
534
534
  end
535
535
 
536
536
  it "should not delete an invalid agent" do
537
- application.stub(:resolver_path).and_return(resolver_path)
538
- application.stub(:launch_agent_path).and_return("/invalid/agent")
537
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
538
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
539
539
 
540
540
  application.action_install
541
- application.logger.should_receive(:warn).at_least(1)
541
+ expect(application.logger).to receive(:warn).at_least(1)
542
542
  application.action_uninstall
543
543
 
544
544
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -546,13 +546,13 @@ describe DevDNSd::Application do
546
546
  end
547
547
 
548
548
  it "should not unload invalid agent" do
549
- application.stub(:resolver_path).and_return(resolver_path)
550
- application.stub(:launch_agent_path).and_return("/invalid/agent")
549
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
550
+ allow(application).to receive(:launch_agent_path).and_return("/invalid/agent")
551
551
 
552
552
  application.action_install
553
- application.stub(:execute_command).and_raise(StandardError)
554
- application.stub(:dns_update)
555
- application.logger.should_receive(:warn).at_least(1)
553
+ allow(application).to receive(:execute_command).and_raise(StandardError)
554
+ allow(application).to receive(:dns_update)
555
+ expect(application.logger).to receive(:warn).at_least(1)
556
556
  application.action_uninstall
557
557
 
558
558
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -560,13 +560,13 @@ describe DevDNSd::Application do
560
560
  end
561
561
 
562
562
  it "should update the DNS cache" do
563
- application.stub(:resolver_path).and_return(resolver_path)
564
- application.stub(:launch_agent_path).and_return(launch_agent_path)
563
+ allow(application).to receive(:resolver_path).and_return(resolver_path)
564
+ allow(application).to receive(:launch_agent_path).and_return(launch_agent_path)
565
565
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
566
566
  ::File.unlink(application.launch_agent_path) if ::File.exists?(application.launch_agent_path)
567
567
 
568
568
  application.action_install
569
- application.should_receive(:dns_update)
569
+ expect(application).to receive(:dns_update)
570
570
  application.action_uninstall
571
571
 
572
572
  ::File.unlink(application.resolver_path) if ::File.exists?(application.resolver_path)
@@ -574,8 +574,8 @@ describe DevDNSd::Application do
574
574
  end
575
575
 
576
576
  it "should raise an exception if not running on OSX" do
577
- application.stub(:is_osx?).and_return(false)
578
- application.logger.should_receive(:fatal).with("Install DevDNSd as a local resolver is only available on MacOSX.")
577
+ allow(application).to receive(:is_osx?).and_return(false)
578
+ expect(application.logger).to receive(:fatal).with("Install DevDNSd as a local resolver is only available on MacOSX.")
579
579
  expect(application.action_uninstall).to be_false
580
580
  end
581
581
  end
@@ -8,7 +8,7 @@ require "spec_helper"
8
8
 
9
9
  describe DevDNSd::Rule do
10
10
  describe "#new" do
11
- it("should create a default rule") do
11
+ it "should create a default rule" do
12
12
  rule = DevDNSd::Rule.new
13
13
  expect(rule.match).to eq(/.+/)
14
14
  expect(rule.reply).to eq("127.0.0.1")
@@ -17,7 +17,7 @@ describe DevDNSd::Rule do
17
17
  expect(rule.block).to be_nil
18
18
  end
19
19
 
20
- it("should create a rule with arguments and no block") do
20
+ it "should create a rule with arguments and no block" do
21
21
  rule = DevDNSd::Rule.new("MATCH", "REPLY", "TYPE", {a: :b})
22
22
  expect(rule.match).to eq("MATCH")
23
23
  expect(rule.reply).to eq("REPLY")
@@ -26,7 +26,7 @@ describe DevDNSd::Rule do
26
26
  expect(rule.block).to be_nil
27
27
  end
28
28
 
29
- it("should create a rule with arguments and a block") do
29
+ it "should create a rule with arguments and a block" do
30
30
  rule = DevDNSd::Rule.new("MATCH", "REPLY", "TYPE") do end
31
31
  expect(rule.match).to eq("MATCH")
32
32
  expect(rule.reply).to be_nil
@@ -37,54 +37,54 @@ describe DevDNSd::Rule do
37
37
  end
38
38
 
39
39
  describe "#is_regexp?" do
40
- it("should return true for a regexp pattern") do
40
+ it "should return true for a regexp pattern" do
41
41
  expect(DevDNSd::Rule.create(/.+/, "127.0.0.1").is_regexp?).to be_true
42
42
  end
43
43
 
44
- it("should return false otherwise") do
44
+ it "should return false otherwise" do
45
45
  expect(DevDNSd::Rule.create("RULE", "127.0.0.1").is_regexp?).to be_false
46
46
  end
47
47
  end
48
48
 
49
49
  describe "#has_block?" do
50
- it("should return true when a block is present") do
50
+ it "should return true when a block is present" do
51
51
  expect(DevDNSd::Rule.create("RULE"){}.has_block?).to be_true
52
52
  end
53
53
 
54
- it("should return false otherwise") do
54
+ it "should return false otherwise" do
55
55
  expect(DevDNSd::Rule.create("RULE", "127.0.0.1").has_block?).to be_false
56
56
  end
57
57
  end
58
58
 
59
59
  describe "#match_host" do
60
60
  describe "with a string pattern" do
61
- it("should return true when hostname matches") do
61
+ it "should return true when hostname matches" do
62
62
  expect(DevDNSd::Rule.create("match.dev", "127.0.0.1").match_host("match.dev")).to be_true
63
63
  end
64
64
 
65
- it("should return false when hostname doesn't match") do
65
+ it "should return false when hostname doesn't match" do
66
66
  expect(DevDNSd::Rule.create("match.dev", "127.0.0.1").match_host("unmatch.dev")).to be_false
67
67
  end
68
68
  end
69
69
 
70
70
  describe "with a regexp pattern" do
71
- it("should return a MatchData when hostname matches") do
71
+ it "should return a MatchData when hostname matches" do
72
72
  expect(DevDNSd::Rule.create(/^match/, "127.0.0.1").match_host("match.dev")).to be_a(MatchData)
73
73
  end
74
74
 
75
- it("should return nil when hostname doesn't match") do
75
+ it "should return nil when hostname doesn't match" do
76
76
  expect(DevDNSd::Rule.create(/^match/, "127.0.0.1").match_host("unmatch.dev")).to be_nil
77
77
  end
78
78
  end
79
79
  end
80
80
 
81
81
  describe "::create" do
82
- it("should not allow rules without sufficient arguments") do
82
+ it "should not allow rules without sufficient arguments" do
83
83
  expect{ DevDNSd::Rule.create("RULE") }.to raise_error(DevDNSd::Errors::InvalidRule)
84
84
  expect{ DevDNSd::Rule.create("RULE", "REPLY", "TYPE", "ARG") }.to raise_error(DevDNSd::Errors::InvalidRule)
85
85
  end
86
86
 
87
- it("should create a rule with host and reply") do
87
+ it "should create a rule with host and reply" do
88
88
  rule = DevDNSd::Rule.create("MATCH", "REPLY")
89
89
  expect(rule.match).to eq("MATCH")
90
90
  expect(rule.reply).to eq("REPLY")
@@ -92,7 +92,7 @@ describe DevDNSd::Rule do
92
92
  expect(rule.block).to be_nil
93
93
  end
94
94
 
95
- it("should create a rule with host, reply and type") do
95
+ it "should create a rule with host, reply and type" do
96
96
  rule = DevDNSd::Rule.create("MATCH", "REPLY", "TYPE", {a: :b})
97
97
  expect(rule.match).to eq("MATCH")
98
98
  expect(rule.reply).to eq("REPLY")
@@ -101,7 +101,7 @@ describe DevDNSd::Rule do
101
101
  expect(rule.block).to be_nil
102
102
  end
103
103
 
104
- it("should create a rule with host, type and a reply block") do
104
+ it "should create a rule with host, type and a reply block" do
105
105
  rule = DevDNSd::Rule.create("MATCH", "TYPE", "UNUSED") do end
106
106
  expect(rule.match).to eq("MATCH")
107
107
  expect(rule.reply).to be_nil
@@ -112,32 +112,32 @@ describe DevDNSd::Rule do
112
112
  end
113
113
 
114
114
  describe "#resource_class" do
115
- it("should return a single class") do
115
+ it "should return a single class" do
116
116
  expect(DevDNSd::Rule.create("MATCH", "REPLY", :A).resource_class).to eq(Resolv::DNS::Resource::IN::A)
117
117
  end
118
118
 
119
- it("should return an array of classes") do
119
+ it "should return an array of classes" do
120
120
  expect(DevDNSd::Rule.create("MATCH", "REPLY", [:A, :MX]).resource_class).to eq([Resolv::DNS::Resource::IN::A, Resolv::DNS::Resource::IN::MX])
121
121
  end
122
122
 
123
- it("should fail for a invalid class") do
123
+ it "should fail for a invalid class" do
124
124
  expect { DevDNSd::Rule.create("MATCH", "REPLY", :INVALID).resource_class }.to raise_error(DevDNSd::Errors::InvalidRule)
125
125
  end
126
126
  end
127
127
 
128
128
  describe "::resource_class_to_symbol" do
129
- it("should convert a class a symbol") do
129
+ it "should convert a class a symbol" do
130
130
  expect(DevDNSd::Rule.resource_class_to_symbol(Resolv::DNS::Resource::IN::A)).to eq(:A)
131
131
  expect(DevDNSd::Rule.resource_class_to_symbol(Resolv)).to eq(:Resolv)
132
132
  end
133
133
  end
134
134
 
135
135
  describe "::symbol_to_resource_class" do
136
- it("should convert a symbol to a resource class") do
136
+ it "should convert a symbol to a resource class" do
137
137
  expect(DevDNSd::Rule.symbol_to_resource_class(:A, :en)).to eq(Resolv::DNS::Resource::IN::A)
138
138
  end
139
139
 
140
- it("should fail for a invalid class") do
140
+ it "should fail for a invalid class" do
141
141
  expect { DevDNSd::Rule.symbol_to_resource_class(:Invalid, :en) }.to raise_error(DevDNSd::Errors::InvalidRule)
142
142
  end
143
143
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devdnsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-15 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mamertes
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 2.2.0
21
+ version: 2.2.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 2.2.0
29
+ version: 2.2.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rubydns
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  segments:
139
139
  - 0
140
- hash: 1433778156204366420
140
+ hash: 2120411428097888079
141
141
  requirements: []
142
142
  rubyforge_project: devdnsd
143
143
  rubygems_version: 1.8.25