haiti 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abe0ba1bf3abea1e1f8e770b063d5bec0512bfde
4
- data.tar.gz: b6732509f4536726676b518d853860624fc55f92
3
+ metadata.gz: be6ec7f0e2f72963e8a40c529b229752e5ff537c
4
+ data.tar.gz: da2b74a700ae3dd337254da69a6743baf242415f
5
5
  SHA512:
6
- metadata.gz: e0a427e7bbedd783ec0cbd432ebf33eee917ae788cc5f04ffb32e52c72d69c938beb6a07d9fe7f8f79dbbb7d98d2fe462302bb2a8402c763a090f2e46a3c6a79
7
- data.tar.gz: c47aee9e1fdd6f11e68d8624e134605b1de2bbedcd53853e0cac30d19b0d33e8097b957b0aa4767bd96eb5514df39fc4cac06b6b5d1b9dc75eb0c61c0697f469
6
+ metadata.gz: 2c5e89a79967beecc75050b141c8390c290e577cc0f364a5b6d2e3cba7f764738f6985f524510072bc8c24cb7a273af81712b74b1b14390f4e0a4d24c371f332
7
+ data.tar.gz: 3f690950c58e8c8fcb026f331949c57a6d02a47302ef92e7ab0531803e29e685ddb3f30d571b0e7506366adb97b7d285709bfef3dda171e866085f3b9ba2a04a
data/Readme.md CHANGED
@@ -22,11 +22,15 @@ To run tests
22
22
  Todo
23
23
  ====
24
24
 
25
+ **For my own sanity**
26
+ * Stick all this shit on a `@haiti` ivar rather than littering it all over `self`... I don't even know what `self` is in this case.
27
+
25
28
  **These would actually be useful right now**
26
29
 
30
+ * Some way to say that I run it and it succeeds (i.e. not so much effort to print stdout on failures)
27
31
  * All existing defs can take single or double quotes
28
32
  * Failures on stdout also display stderr
29
- * step def for does not include
33
+ * Step def for does not include
30
34
 
31
35
  **These should just generally be done**
32
36
  * Add tests showing that curlies get interpreted where expected
@@ -20,11 +20,12 @@ module Haiti
20
20
  end
21
21
  end
22
22
 
23
- def execute(command, stdin_data=nil)
23
+ def execute(command, stdin_data, env_vars)
24
24
  stdin_data ||= ''
25
+ env_vars ||= {}
25
26
  in_proving_grounds do
26
27
  with_bin_in_path do
27
- Invocation.new *Open3.capture3(command, stdin_data: stdin_data)
28
+ Invocation.new *Open3.capture3(env_vars, command, stdin_data: stdin_data)
28
29
  end
29
30
  end
30
31
  end
@@ -16,7 +16,7 @@ define_steps.call(
16
16
  define_steps.call(
17
17
  'I run "$command"',
18
18
  "I run '$command'",
19
- ) { |command| @last_executed = Haiti::CommandLineHelpers.execute command, @stdin_data }
19
+ ) { |command| @last_executed = Haiti::CommandLineHelpers.execute command, @stdin_data, @env_vars_to_set }
20
20
 
21
21
  define_steps.call(
22
22
  /^(stderr|stdout) is:$/,
@@ -66,3 +66,11 @@ define_steps.call(
66
66
  Haiti::CommandLineHelpers.in_proving_grounds { File.exist? filename }
67
67
  ).to eq true
68
68
  }
69
+
70
+ define_steps.call(
71
+ /^the environment variable "(.*?)" is set to "(.*?)"$/,
72
+ /^the environment variable "(.*?)" is set to '(.*?)'$/
73
+ ) { |name, value|
74
+ @env_vars_to_set ||= {}
75
+ @env_vars_to_set[eval_curlies(name)] = eval_curlies(value)
76
+ }
data/lib/haiti/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Haiti
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -0,0 +1,10 @@
1
+ Feature:
2
+ Scenario:
3
+ Given the environment variable "MY{{?_}}VAR" is set to "1/{{1+1}}/3"
4
+ When I run "ruby -e 'print ENV[%(MY_VAR)]'"
5
+ Then stdout is "1/2/3"
6
+
7
+ Scenario:
8
+ Given the environment variable "MY{{?_}}VAR" is set to '1/{{1+1}}/3'
9
+ When I run "ruby -e 'print ENV[%(MY_VAR)]'"
10
+ Then stdout is "1/2/3"
metadata CHANGED
@@ -1,38 +1,38 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Cheek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-30 00:00:00.000000000 Z
11
+ date: 2014-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: cucumber
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - "~>"
17
18
  - !ruby/object:Gem::Version
18
19
  version: '1.0'
19
- prerelease: false
20
- name: cucumber
21
20
  type: :runtime
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: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
+ name: rspec
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - "~>"
31
32
  - !ruby/object:Gem::Version
32
33
  version: '3.0'
33
- prerelease: false
34
- name: rspec
35
34
  type: :runtime
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
@@ -61,6 +61,7 @@ files:
61
61
  - test/Gemfile.lock
62
62
  - test/bin/repeat_this_back_to_me
63
63
  - test/features/config.feature
64
+ - test/features/given_the_environment_variable.feature
64
65
  - test/features/given_the_file.feature
65
66
  - test/features/given_the_stdin_content.feature
66
67
  - test/features/support/env.rb
@@ -97,6 +98,7 @@ test_files:
97
98
  - test/Gemfile.lock
98
99
  - test/bin/repeat_this_back_to_me
99
100
  - test/features/config.feature
101
+ - test/features/given_the_environment_variable.feature
100
102
  - test/features/given_the_file.feature
101
103
  - test/features/given_the_stdin_content.feature
102
104
  - test/features/support/env.rb