Created
August 29, 2016 10:32
-
-
Save marzzz21/da60a5b20e803e01051d993a39eabbf9 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 'memfs' | |
4 | |
5 RSpec.describe MirrorSyncDaemon do | |
6 it 'deletes the PID_FILE if it exists but contains invalid PID' do | |
7 MemFs.activate do | |
8 FileUtils.mkdir_p(File.dirname(MirrorSyncDaemon::PID_FILE)) | |
9 File.new(MirrorSyncDaemon::PID_FILE, File::CREAT|File::TRUNC|File::RDWR) | |
10 #stub_const("MirrorSyncDaemon::PID_FILE", MemFs.touch('testfile')) | |
11 @mirrorsyncdaemon = MirrorSyncDaemon.new | |
12 @mirrorsyncdaemon.stub(:check_pid_status).with(Integer) { raise Errno::ESERCH } | |
13 @mirrorsyncdaemon.check_status | |
14 expect(File.exist?(MirrorSyncDaemon::PID_FILE)).to be true | |
15 end | |
16 end | |
17 end | |
#rspec | |
Failures: | |
1) MirrorSyncDaemon deletes the PID_FILE if it exists but contains invalid PID | |
Failure/Error: expect(File.exist?(MirrorSyncDaemon::PID_FILE)).to be true | |
TypeError: | |
superclass mismatch for class File | |
# ./spec/test_mirrorsyncdaemon.rb:14:in `block (3 levels) in <top (required)>' | |
# ./bundle/ruby/2.3.0/gems/memfs-0.5.0/lib/memfs.rb:53:in `activate' | |
# ./spec/test_mirrorsyncdaemon.rb:7: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 (3 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.01344 seconds (files took 0.13533 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