-
-
Save universal/e7ea2cf10d1932895c4d55ae767fe19f 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) MirrorSync#execute_custom_script when the custom script succesfully runs should not raise any errors | |
Failure/Error: expect { mirror_sync.execute_custom_script('false') }.to_not raise_error | |
expected no Exception, got #<NameError: undefined local variable or method `e' for #<MirrorSync:0x00005601c08bce60>> with backtrace: | |
# ./spec/models/mirror_sync_spec.rb:9:in `execute_custom_script' | |
# ./spec/models/mirror_sync_spec.rb:20:in `block (5 levels) in <top (required)>' | |
# ./spec/models/mirror_sync_spec.rb:20:in `block (4 levels) in <top (required)>' |
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
class MirrorSync | |
def execute_custom_script(cmd) | |
begin | |
output = %x(#{cmd}) | |
unless $?.exitstatus == 0 | |
raise Exception.new(e.message) | |
end | |
end | |
end | |
end | |
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
require 'rails_helper' | |
RSpec.describe MirrorSync, type: :model do | |
describe '#execute_custom_script' do | |
context 'when the custom script succesfully runs' do | |
it 'should not raise any errors' do | |
mirror_sync = MirrorSync.new | |
expect { mirror_sync.execute_custom_script('false') }.to_not raise_error | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment