Skip to content

Commit b76a86c

Browse files
committed
require dsl with default require, but make include optional
1 parent 6de1e10 commit b76a86c

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

lib/sshkit/all.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
require_relative 'coordinator'
1111

1212
require_relative 'deprecation_logger'
13+
require_relative 'dsl'
1314

1415
require_relative 'exception'
1516

@@ -35,4 +36,4 @@
3536
require_relative 'backends/printer'
3637
require_relative 'backends/netssh'
3738
require_relative 'backends/local'
38-
require_relative 'backends/skipper'
39+
require_relative 'backends/skipper'

lib/sshkit/dsl.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ def run_locally(&block)
1313
end
1414

1515
end
16-
17-
include SSHKit::DSL

test/unit/test_dsl.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
require 'helper'
2+
3+
module SSHKit
4+
5+
class TestDSL < UnitTest
6+
include SSHKit::DSL
7+
8+
def test_dsl_on
9+
coordinator = mock
10+
Coordinator.stubs(:new).returns coordinator
11+
coordinator.expects(:each).at_least_once
12+
13+
on('1.2.3.4')
14+
end
15+
16+
def test_dsl_run_locally
17+
local_backend = mock
18+
Backend::Local.stubs(:new).returns local_backend
19+
local_backend.expects(:run).at_least_once
20+
21+
run_locally
22+
end
23+
24+
end
25+
26+
end

0 commit comments

Comments
 (0)