Created
August 29, 2016 08:56
-
-
Save marzzz21/45de66641c0fbf42053356ce4532c919 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 require 'spec_helper' | |
2 require 'mirrorsyncdaemon' | |
3 require 'fakefs/spec_helpers' | |
4 | |
5 | |
6 RSpec.describe MirrorSyncDaemon do | |
7 include FakeFS::SpecHelpers | |
8 FakeFS.activate! | |
9 it 'deletes the PID_FILE if it exists but contains invalid PID' do | |
10 stub_const("MirrorSyncDaemon::PID_FILE", FakeFS::File.new("testfile", RealFile::CREA T|RealFile::TRUNC|RealFile::RDWR, 0644).path) | |
11 @mirrorsyncdaemon = MirrorSyncDaemon.new | |
12 @mirrorsyncdaemon.stub(:check_pid_status).with(Integer) { raise Errno::ESERCH } | |
13 @mirrorsyncdaemon.check_status | |
14 #File.exist?(MirrorSyncDaemon::PID_FILE) #== false | |
15 expect(MirrorSyncDaemon::PID_FILE).to be_an_existing_file | |
16 FakeFS.deactivate! | |
17 end | |
18 end | |
> rspec results: | |
Failures: | |
1) MirrorSyncDaemon deletes the PID_FILE if it exists but contains invalid PID | |
Failure/Error: expect(MirrorSyncDaemon::PID_FILE).to be_an_existing_file | |
TypeError: | |
superclass mismatch for class File | |
# ./spec/test_mirrorsyncdaemon.rb:15:in `block (2 levels) in <top (required)>' | |
Deprecation Warnings: | |
Using `stub` from rspec-mocks' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` instead. Called from /home/mihaelkeehl/rise-chef-repo/cookbooks/mirror/files/default/scripts/spec/test_mirrorsyncdaemon.rb:12:in `block (2 levels) in <top (required)>'. | |
If you need more of the backtrace for any of these deprecations to | |
identify where to make the necessary changes, you can configure | |
`config.raise_errors_for_deprecations!`, and it will turn the | |
deprecation warnings into errors, giving you the full backtrace. | |
1 deprecation warning total | |
Finished in 0.01432 seconds (files took 0.13867 seconds to load) | |
1 example, 1 failure | |
Failed examples: | |
rspec ./spec/test_mirrorsyncdaemon.rb:6 # MirrorSyncDaemon deletes the PID_FILE if it exists but contains invalid PID | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment