bash-session 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +22 -0
- data/README.md +2 -0
- data/Rakefile +6 -0
- data/bash-session.gemspec +5 -3
- data/lib/bash/session.rb +2 -0
- data/lib/bash/session/version.rb +1 -1
- data/test/session_test.rb +125 -0
- data/test/test_helper.rb +5 -0
- metadata +23 -20
- data/spec/session_spec.rb +0 -113
- data/spec/spec_helper.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa2364a00285d79e09083b0f1dac3ff31bb2d195
|
4
|
+
data.tar.gz: fa13408e14f1c502792884de0a6b2b8711f0fc27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d9639235772066fb33d0ea237f56df7a174a177d448cff9393b2f5a215b38f03e4c64cb02920df9b05a27c5f33d373f58dcf061bd04ca512d47d9f2784047fa
|
7
|
+
data.tar.gz: 6030eb8fce3b6e47785866ad0be353aefc9cbd83b172a20cb965f8b3d454e7920bde43cd19ea4ab1eef61e4e9610487d4427ef97554f91eaf6c7230fbc767b3f
|
data/.gitignore
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bash-session
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.4
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bash-session (0.0.3)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
minitest (5.10.1)
|
10
|
+
rake (10.5.0)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
bash-session!
|
17
|
+
bundler
|
18
|
+
minitest
|
19
|
+
rake (~> 10.0)
|
20
|
+
|
21
|
+
BUNDLED WITH
|
22
|
+
1.13.7
|
data/README.md
CHANGED
@@ -31,3 +31,5 @@ TODO: Write usage instructions here
|
|
31
31
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
32
|
4. Push to the branch (`git push origin my-new-feature`)
|
33
33
|
5. Create a new Pull Request
|
34
|
+
|
35
|
+
To report an issue, [please contact the Snap.ci support team.](https://snap-ci.com/contact-us)
|
data/Rakefile
CHANGED
data/bash-session.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'bash/session/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "bash-session"
|
8
8
|
spec.version = Bash::Session::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Snap CI"]
|
10
|
+
spec.email = ["support@snap-ci.com"]
|
11
11
|
spec.summary = %q{A minimalistic gem for a persistent bash session.}
|
12
12
|
spec.description = ""
|
13
13
|
spec.homepage = ""
|
@@ -18,8 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = '~> 2.2'
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
25
|
|
24
|
-
spec.add_development_dependency "
|
26
|
+
spec.add_development_dependency "minitest"
|
25
27
|
end
|
data/lib/bash/session.rb
CHANGED
data/lib/bash/session/version.rb
CHANGED
@@ -0,0 +1,125 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class BashSessionTest < Minitest::Test
|
4
|
+
parallelize_me! unless ENV["SNAP_CI"]
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@session = Bash::Session.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
@session.close
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_run_commands_and_show_out_put_when_it_does_not_end_in_a_new_line
|
15
|
+
@session.execute("echo -n hello") { |output| assert_equal "hello", output }
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_return_the_exit_status_of_the_command
|
19
|
+
exit_status = @session.execute("true")
|
20
|
+
assert_equal 0, exit_status
|
21
|
+
|
22
|
+
exit_status = @session.execute("false")
|
23
|
+
assert_equal 1, exit_status
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_run_commands_ending_with_comments
|
27
|
+
exit_status = @session.execute("true # this is a comment") { |output| assert_equal "", output }
|
28
|
+
assert_equal 0, exit_status
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_uses_same_session_and_preserves_state_through_sequential_commands
|
32
|
+
assert_success_with_output("cd #{Dir.pwd}/test")
|
33
|
+
assert_success_with_output("pwd") { |output| assert_match("#{Dir.pwd}/test", output) }
|
34
|
+
assert_success_with_output("cd ~")
|
35
|
+
assert_success_with_output("pwd") { |output| assert_match(Dir.home, output) }
|
36
|
+
assert_success_with_output("echo $FOO") { |output| refute_match("bar", output) }
|
37
|
+
assert_success_with_output("export FOO=bar")
|
38
|
+
assert_success_with_output("echo $FOO") { |output| assert_match("bar", output) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_run_multiple_commands_separated_by_a_newline
|
42
|
+
reader, writer = IO.pipe(Encoding::ASCII_8BIT)
|
43
|
+
@session.execute("echo hi\necho bye", out: writer)
|
44
|
+
writer.close
|
45
|
+
assert_equal "hi\nbye\n", reader.read
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_wait_for_long_running_commands_to_complete_and_then_exit
|
49
|
+
reader, writer = IO.pipe(Encoding::ASCII_8BIT)
|
50
|
+
exit_status = @session.execute("for i in {1..5}; do echo -n 'hello world '; sleep 1; done", out: writer)
|
51
|
+
assert_equal 0, exit_status
|
52
|
+
writer.close
|
53
|
+
assert_equal "hello world "*5, reader.read
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_raise_error_when_command_does_not_generate_any_output_within_a_default_timeout_period
|
57
|
+
@session = Bash::Session.new(3)
|
58
|
+
reader, writer = IO.pipe(Encoding::ASCII_8BIT)
|
59
|
+
|
60
|
+
begin_time = Time.now
|
61
|
+
e = assert_raises(Bash::Session::TimeoutError) do
|
62
|
+
@session.execute("echo hi; sleep 300; echo bye", out: writer)
|
63
|
+
end
|
64
|
+
end_time = Time.now
|
65
|
+
|
66
|
+
writer.close
|
67
|
+
|
68
|
+
assert_in_delta(3, end_time - begin_time, 2.0)
|
69
|
+
assert_equal 'No output received for the last 3 seconds. Timing out...', e.message
|
70
|
+
assert_equal "hi\n", reader.read
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_raise_error_when_command_does_not_generate_any_output_command_specific_timeout_period
|
74
|
+
@session = Bash::Session.new(1)
|
75
|
+
reader, writer = IO.pipe(Encoding::ASCII_8BIT)
|
76
|
+
|
77
|
+
begin_time = Time.now
|
78
|
+
e = assert_raises(Bash::Session::TimeoutError) do
|
79
|
+
@session.execute("echo hi; sleep 300; echo bye", out: writer, timeout: 3)
|
80
|
+
end
|
81
|
+
end_time = Time.now
|
82
|
+
|
83
|
+
writer.close
|
84
|
+
|
85
|
+
assert_in_delta(3, end_time - begin_time, 2.0)
|
86
|
+
assert_equal 'No output received for the last 3 seconds. Timing out...', e.message
|
87
|
+
assert_equal "hi\n", reader.read
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_not_raise_error_when_long_running_command_is_constantly_generating_output_with_default_timeout
|
91
|
+
@session = Bash::Session.new(3)
|
92
|
+
reader, writer = IO.pipe(Encoding::ASCII_8BIT)
|
93
|
+
|
94
|
+
exit_status = @session.execute("echo -n hi; for i in {1..6}; do sleep 1; echo -n .; done; echo bye", out: writer)
|
95
|
+
writer.close
|
96
|
+
|
97
|
+
assert_equal 0, exit_status
|
98
|
+
assert_equal "hi......bye\n", reader.read
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_not_raise_error_when_long_running_command_is_constantly_generating_output_with_a_command_specific_timeout
|
102
|
+
@session = Bash::Session.new(3)
|
103
|
+
reader, writer = IO.pipe(Encoding::ASCII_8BIT)
|
104
|
+
|
105
|
+
exit_status = @session.execute("echo -n hi; for i in {1..6}; do sleep 4; echo -n .; done; echo bye", out: writer, timeout: 5)
|
106
|
+
writer.close
|
107
|
+
|
108
|
+
assert_equal "hi......bye\n", reader.read
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_start_a_non_interactive_login_shell_session
|
112
|
+
exit_status = @session.execute("[[ $- != *i* ]]")
|
113
|
+
assert_equal 0, exit_status
|
114
|
+
|
115
|
+
exit_status = @session.execute("shopt -q login_shell")
|
116
|
+
assert_equal 0, exit_status
|
117
|
+
end
|
118
|
+
|
119
|
+
def assert_success_with_output(command, &block)
|
120
|
+
output = ""
|
121
|
+
status = @session.execute(command) { |out| output = out }
|
122
|
+
assert_equal 0, status, "command #{command} failed with status #{status}"
|
123
|
+
yield output if block_given?
|
124
|
+
end
|
125
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,74 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bash-session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Snap CI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: ''
|
56
56
|
email:
|
57
|
-
-
|
57
|
+
- support@snap-ci.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
|
+
- ".ruby-gemset"
|
64
|
+
- ".ruby-version"
|
63
65
|
- Gemfile
|
66
|
+
- Gemfile.lock
|
64
67
|
- LICENSE.txt
|
65
68
|
- README.md
|
66
69
|
- Rakefile
|
67
70
|
- bash-session.gemspec
|
68
71
|
- lib/bash/session.rb
|
69
72
|
- lib/bash/session/version.rb
|
70
|
-
-
|
71
|
-
-
|
73
|
+
- test/session_test.rb
|
74
|
+
- test/test_helper.rb
|
72
75
|
homepage: ''
|
73
76
|
licenses:
|
74
77
|
- MIT
|
@@ -79,20 +82,20 @@ require_paths:
|
|
79
82
|
- lib
|
80
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
84
|
requirements:
|
82
|
-
- -
|
85
|
+
- - "~>"
|
83
86
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
87
|
+
version: '2.2'
|
85
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
89
|
requirements:
|
87
|
-
- -
|
90
|
+
- - ">="
|
88
91
|
- !ruby/object:Gem::Version
|
89
92
|
version: '0'
|
90
93
|
requirements: []
|
91
94
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.4.5.1
|
93
96
|
signing_key:
|
94
97
|
specification_version: 4
|
95
98
|
summary: A minimalistic gem for a persistent bash session.
|
96
99
|
test_files:
|
97
|
-
-
|
98
|
-
-
|
100
|
+
- test/session_test.rb
|
101
|
+
- test/test_helper.rb
|
data/spec/session_spec.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Bash::Session do
|
4
|
-
before(:each) do
|
5
|
-
@session = Bash::Session.new
|
6
|
-
end
|
7
|
-
|
8
|
-
after(:each) do
|
9
|
-
@session.close
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should run commands and show out put when it does not end in a new line' do
|
13
|
-
@session.execute("echo -n hello") { |output| expect(output).to eq("hello") }
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should return the exit status of the command' do
|
17
|
-
exit_status = @session.execute("true")
|
18
|
-
expect(exit_status).to eq(0)
|
19
|
-
|
20
|
-
exit_status = @session.execute("false")
|
21
|
-
expect(exit_status).to eq(1)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should run commands ending with comments' do
|
25
|
-
exit_status = @session.execute("true # this is a comment") { |output| expect(output).to eq("") }
|
26
|
-
expect(exit_status).to eq(0)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should preserve the state of bash internal commands' do
|
30
|
-
@session.execute("cd #{Dir.pwd}/spec")
|
31
|
-
@session.execute("pwd") { |output| expect(output).to include("#{Dir.pwd}/spec") }
|
32
|
-
@session.execute("cd ~")
|
33
|
-
@session.execute("pwd") { |output| expect(output).to include(Dir.home) }
|
34
|
-
@session.execute("echo $FOO") { |output| expect(output).to_not include("bar") }
|
35
|
-
@session.execute("export FOO=bar")
|
36
|
-
@session.execute("echo $FOO") { |output| expect(output).to include("bar") }
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should run multiple commands separated by a newline' do
|
40
|
-
reader, writer = IO.pipe
|
41
|
-
@session.execute("echo hi\necho bye", out: writer)
|
42
|
-
writer.close
|
43
|
-
expect(reader.read).to eq("hi\nbye\n")
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should wait for long running commands to complete and then exit' do
|
47
|
-
reader, writer = IO.pipe
|
48
|
-
exit_status = @session.execute("for i in {1..5}; do echo -n 'hello world '; sleep 1; done", out: writer)
|
49
|
-
expect(exit_status).to eq(0)
|
50
|
-
writer.close
|
51
|
-
expect(reader.read).to eq("hello world "*5)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should raise error when command does not generate any output within a default timeout period' do
|
55
|
-
@session = Bash::Session.new(3)
|
56
|
-
reader, writer = IO.pipe
|
57
|
-
|
58
|
-
begin_time = Time.now
|
59
|
-
expect do
|
60
|
-
exit_status = @session.execute("echo hi; sleep 300; echo bye", out: writer)
|
61
|
-
end.to raise_error(Bash::Session::TimeoutError, 'No output received for the last 3 seconds. Timing out...')
|
62
|
-
writer.close
|
63
|
-
end_time = Time.now
|
64
|
-
|
65
|
-
expect(end_time - begin_time).to be_within(0.1).of(3)
|
66
|
-
expect(reader.read_nonblock(1000)).to eq("hi\n")
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'should raise error when command does not generate any output command specific timeout period' do
|
70
|
-
@session = Bash::Session.new(1)
|
71
|
-
reader, writer = IO.pipe
|
72
|
-
|
73
|
-
begin_time = Time.now
|
74
|
-
|
75
|
-
expect do
|
76
|
-
exit_status = @session.execute("echo hi; sleep 300; echo bye", out: writer, timeout: 3)
|
77
|
-
end.to raise_error(Bash::Session::TimeoutError, 'No output received for the last 3 seconds. Timing out...')
|
78
|
-
end_time = Time.now
|
79
|
-
|
80
|
-
writer.close
|
81
|
-
|
82
|
-
expect(end_time - begin_time).to be_within(0.1).of(3)
|
83
|
-
expect(reader.read_nonblock(1000)).to eq("hi\n")
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'should not raise error when long running command is constantly generating output with default timeout' do
|
87
|
-
@session = Bash::Session.new(3)
|
88
|
-
reader, writer = IO.pipe
|
89
|
-
|
90
|
-
exit_status = @session.execute("echo -n hi; for i in {1..6}; do sleep 1; echo -n .; done; echo bye", out: writer)
|
91
|
-
writer.close
|
92
|
-
|
93
|
-
expect(reader.read_nonblock(1000)).to eq("hi......bye\n")
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'should not raise error when long running command is constantly generating output with a command specific timeout' do
|
97
|
-
@session = Bash::Session.new(3)
|
98
|
-
reader, writer = IO.pipe
|
99
|
-
|
100
|
-
exit_status = @session.execute("echo -n hi; for i in {1..6}; do sleep 4; echo -n .; done; echo bye", out: writer, timeout: 5)
|
101
|
-
writer.close
|
102
|
-
|
103
|
-
expect(reader.read_nonblock(1000)).to eq("hi......bye\n")
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'should start a non-interactive login shell session' do
|
107
|
-
exit_status = @session.execute("[[ $- != *i* ]]")
|
108
|
-
expect(exit_status).to eq(0)
|
109
|
-
|
110
|
-
exit_status = @session.execute("shopt -q login_shell")
|
111
|
-
expect(exit_status).to eq(0)
|
112
|
-
end
|
113
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'bash/session'
|
2
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
3
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
4
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
5
|
-
# file to always be loaded, without a need to explicitly require it in any files.
|
6
|
-
#
|
7
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
-
# a separate helper file that requires the additional dependencies and performs
|
12
|
-
# the additional setup, and require it from the spec files that actually need it.
|
13
|
-
#
|
14
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
15
|
-
# users commonly want.
|
16
|
-
#
|
17
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
-
RSpec.configure do |config|
|
19
|
-
# rspec-expectations config goes here. You can use an alternate
|
20
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
-
# assertions if you prefer.
|
22
|
-
config.expect_with :rspec do |expectations|
|
23
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
-
# and `failure_message` of custom matchers include text for helper methods
|
25
|
-
# defined using `chain`, e.g.:
|
26
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
-
# # => "be bigger than 2 and smaller than 4"
|
28
|
-
# ...rather than:
|
29
|
-
# # => "be bigger than 2"
|
30
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
-
end
|
32
|
-
|
33
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
-
config.mock_with :rspec do |mocks|
|
36
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
-
# a real object. This is generally recommended, and will default to
|
38
|
-
# `true` in RSpec 4.
|
39
|
-
mocks.verify_partial_doubles = true
|
40
|
-
end
|
41
|
-
|
42
|
-
# The settings below are suggested to provide a good initial experience
|
43
|
-
# with RSpec, but feel free to customize to your heart's content.
|
44
|
-
=begin
|
45
|
-
# These two settings work together to allow you to limit a spec run
|
46
|
-
# to individual examples or groups you care about by tagging them with
|
47
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
48
|
-
# get run.
|
49
|
-
config.filter_run :focus
|
50
|
-
config.run_all_when_everything_filtered = true
|
51
|
-
|
52
|
-
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
53
|
-
# For more details, see:
|
54
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
55
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
56
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
57
|
-
config.disable_monkey_patching!
|
58
|
-
|
59
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
60
|
-
# be too noisy due to issues in dependencies.
|
61
|
-
config.warnings = true
|
62
|
-
|
63
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
64
|
-
# file, and it's useful to allow more verbose output when running an
|
65
|
-
# individual spec file.
|
66
|
-
if config.files_to_run.one?
|
67
|
-
# Use the documentation formatter for detailed output,
|
68
|
-
# unless a formatter has already been configured
|
69
|
-
# (e.g. via a command-line flag).
|
70
|
-
config.default_formatter = 'doc'
|
71
|
-
end
|
72
|
-
|
73
|
-
# Print the 10 slowest examples and example groups at the
|
74
|
-
# end of the spec run, to help surface which specs are running
|
75
|
-
# particularly slow.
|
76
|
-
config.profile_examples = 10
|
77
|
-
|
78
|
-
# Run specs in random order to surface order dependencies. If you find an
|
79
|
-
# order dependency and want to debug it, you can fix the order by providing
|
80
|
-
# the seed, which is printed after each run.
|
81
|
-
# --seed 1234
|
82
|
-
config.order = :random
|
83
|
-
|
84
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
85
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
86
|
-
# test failures related to randomization by passing the same `--seed` value
|
87
|
-
# as the one that triggered the failure.
|
88
|
-
Kernel.srand config.seed
|
89
|
-
=end
|
90
|
-
end
|