screenplay 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/screenplay.rb +12 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbcc4ac9d699fdd6e2b71a70585015534e9bb5c2
4
- data.tar.gz: cc08b1b7d01e3eb147e9483c1f6f9a82da25ba43
3
+ metadata.gz: a95ba6ead19e8a30a517ff94ea7616598bf5bb65
4
+ data.tar.gz: acda5c62d8456b8f9bff4b925b36965cc82ef6e0
5
5
  SHA512:
6
- metadata.gz: 4892dba6463c1cb57afb70d3f636d5e1d884e829347d164edb3990e234321db8ad6e21cec9147b80da165ddd2ecee4616b127cede24bf02b56bae2b8c4333393
7
- data.tar.gz: dedd7dc8c0a7b4fda97920ccb58a2068b5526e5e3a3d6ac9ba92b80ba91aa0d0aa47fa3cc13e8e3f26ecb1d3c2adea3450432409941a82be73551bf6a488fd5c
6
+ metadata.gz: e7cc1dc7b6b9348a38a98c5bc7c5fcd9556266a909febb3faf915e7b29b04ec37a693a3abbe4bac17a74982e99f0b11f995ed55ef48186ef2a4f46ea121eedea
7
+ data.tar.gz: 495367c4a4da1847bcd59c7197f318f811595be3b12d4aead02ec955b813ded14dd35e63aa843149e67dcf030375e99ff32342a1ce16ac58a69b2a14b385acf4
data/lib/screenplay.rb CHANGED
@@ -11,6 +11,8 @@ require 'screenplay/scenarios'
11
11
  module Screenplay
12
12
  extend self
13
13
 
14
+ attr_reader :options
15
+
14
16
  def prepare
15
17
  Configuration.load
16
18
  Cast.autoload
@@ -18,8 +20,10 @@ module Screenplay
18
20
  end
19
21
 
20
22
  def play(options = {})
21
- options[:quiet] ||= false
22
- options[:human_friendly] ||= false
23
+ @options = options
24
+ @options[:quiet] ||= false
25
+ @options[:human_friendly] ||= false
26
+ @options[:show_output] = @options[:show_output] && !@options[:quiet]
23
27
 
24
28
  raise 'ERROR: Couldn\'t find any scenarios to play.' if Scenarios.size == 0
25
29
 
@@ -29,7 +33,7 @@ module Screenplay
29
33
  }
30
34
 
31
35
  each_scene { | scenario, actor_name, params, input, index |
32
- puts "##### #{scenario.name} - #{actor_name}: #####" if !options[:quiet] && options[:show_output]
36
+ puts "##### #{scenario.name} - #{actor_name}: #####" if !@options[:quiet] && @options[:show_output]
33
37
  params ||= {}
34
38
  begin
35
39
  output = Cast.get(actor_name).play(params, input)
@@ -37,18 +41,17 @@ module Screenplay
37
41
  raise ScenarioFailedException.new(scenario, index, actor_name, e)
38
42
  end
39
43
  output.symbolize_keys!
40
- unless (options[:quiet])
41
- if (options[:show_output])
42
- output_str = options[:human_friendly] ? JSON.pretty_generate(output) : output.to_s
43
- puts "output = #{output_str}"
44
- puts ''
44
+ unless (@options[:quiet])
45
+ if (@options[:show_output])
46
+ puts "output = " + @options[:human_friendly] ? JSON.pretty_generate(output) : output.to_s
47
+ puts ''
45
48
  else
46
49
  STDOUT << '.'
47
50
  end
48
51
  end
49
52
  output
50
53
  }
51
- puts '' unless (options[:quiet])
54
+ puts '' unless @options[:quiet]
52
55
  end
53
56
 
54
57
  def each_scene
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: screenplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taco Jan Osinga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client