rspec-shell-expectations 1.2.0 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21c937d11afe4208b5dcc9f5a50ede733e65bbf5
4
- data.tar.gz: 42d77825f030757dae04172a2fa6c7e561d78c74
3
+ metadata.gz: 18a7806669b0fcc1293550fff6d714531aaf42a9
4
+ data.tar.gz: fb7927391372304271df2643126562a5e55c12d7
5
5
  SHA512:
6
- metadata.gz: 8753dc31edea97051a92de8cda82189bd8098742cb1f60f39ac3da352d9ba082e62c33bfd694bb684fee3014fdb288e51eda72f391356f0bed5aacbda93db6d1
7
- data.tar.gz: 99861b40a7daefa40221c32d412edc90c4bd21494815193731758813221e0942ff2d24524d1063fc3a83bbc0d7180068dd6e8ddb01491f5c17c2edf79faf14f7
6
+ metadata.gz: 5a3b7816d7a00ce952222c6e3c9b28f3b6bd1e0fb00e3664bf6c55cc20e81807e4fcdbca912082ef6417fdd5778c0f43ebbf563911d93322e1bcd70906cc1f27
7
+ data.tar.gz: 4524a3f60e408ffd8039ca110bc187cf6d9a9b5f065f7ae826ed292a0b71426bac775f5a3f2cf0543e14421a1312a26be63113bd57de75a0c40465268249bd50
@@ -1,3 +1,14 @@
1
+ # 1.3.0
2
+
3
+ * Improved assertion message
4
+
5
+ # 1.2.0
6
+
7
+ * Support for output filenames based on input arguments
8
+ (`.outputs('something', to: [:arg2, '.png'])`
9
+ * Updates local `ENV['PATH']` to easy test execution from private code
10
+ * Add `stubbed_env.cleanup` to cleanup `ENV['PATH']` manually
11
+
1
12
  # 1.1.0
2
13
 
3
14
  * Support chaining of arguments in multiple steps
@@ -5,9 +5,12 @@ module Rspec
5
5
  module Expectations
6
6
  # Configuration of a stubbed command
7
7
  class CallConfiguration
8
- def initialize(config_path)
8
+ attr_reader :command
9
+
10
+ def initialize(config_path, command)
9
11
  @config_path = config_path
10
12
  @configuration = {}
13
+ @command = command
11
14
  end
12
15
 
13
16
  def set_exitcode(statuscode, args = [])
@@ -32,6 +32,15 @@ module Rspec
32
32
  return false unless @call_log.exist?
33
33
  @call_log.called_with_args?(*@args)
34
34
  end
35
+
36
+ def inspect
37
+ if @args.any?
38
+ "<Stubbed #{@config.command.inspect} " \
39
+ "args: #{@args.join(' ').inspect}>"
40
+ else
41
+ "<Stubbed #{@config.command.inspect}>"
42
+ end
43
+ end
35
44
  end
36
45
  end
37
46
  end
@@ -5,10 +5,10 @@ module Rspec
5
5
  # and monitors input
6
6
  class StubbedCommand
7
7
  def initialize(command, dir)
8
- @dir, @command = dir, command
9
8
  FileUtils.cp(stub_filepath, File.join(dir, command))
10
9
  @call_configuration = CallConfiguration.new(
11
- Pathname.new(dir).join("#{command}_stub.yml")
10
+ Pathname.new(dir).join("#{command}_stub.yml"),
11
+ command
12
12
  )
13
13
  @call_log = CallLog.new(
14
14
  Pathname.new(dir).join("#{command}_calls.yml")
@@ -39,6 +39,10 @@ module Rspec
39
39
  with_args.outputs(contents, to: to)
40
40
  end
41
41
 
42
+ def inspect
43
+ with_args.inspect
44
+ end
45
+
42
46
  private
43
47
 
44
48
  def stub_filepath
@@ -2,7 +2,7 @@ module Rspec
2
2
  module Shell
3
3
  #:nodoc:
4
4
  module Expectations
5
- VERSION = '1.2.0'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  end
8
8
  end
@@ -39,5 +39,13 @@ describe 'Assert called' do
39
39
  expect(command1_stub.with_args('foo')).not_to be_called
40
40
  end
41
41
  end
42
+
43
+ describe 'assertion message' do
44
+ it 'provides a helpful message' do
45
+ expect(command1_stub.inspect).to eql '<Stubbed "command1">'
46
+ expect(command1_stub.with_args('foo bar').inspect).to \
47
+ eql '<Stubbed "command1" args: "foo bar">'
48
+ end
49
+ end
42
50
  end
43
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-shell-expectations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthijs Groen