hq-dev 0.0.5 → 0.0.6
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/features/support/env.rb +1 -0
- data/features/support/steps.rb +21 -0
- data/features/temp-dir.feature +33 -0
- data/features/time.feature +56 -0
- data/lib/hq/cucumber/temp-dir.rb +5 -0
- data/lib/hq/cucumber/time.rb +40 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60aba906d0e871ee569ad9e004aec7487e193447
|
4
|
+
data.tar.gz: 3942e6f7f1a5a230b130ad7e0844f366eeb347cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e24429a2428604f929d9f562fb9f959ffc0ff6f654d262730835666016ed01afc11184f02109501534fe527062dd253c90b3130fc0944e42d6d44219673155c
|
7
|
+
data.tar.gz: 41804a7be4cc5debffeb723027c04a891658877193505b1db0934997110331adfba234cb1e759d9391d86e911e9a23c3af96e1f41785959be2c0c668631d68f8
|
@@ -0,0 +1 @@
|
|
1
|
+
require "hq/cucumber/temp-dir"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
When /^I run "(.*?)"$/ do
|
2
|
+
|command|
|
3
|
+
|
4
|
+
@command_output = `#{command}`
|
5
|
+
@command_exit_status = $?.exitstatus
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^the exit status should be (\d+)$/ do
|
10
|
+
|exit_status_str|
|
11
|
+
|
12
|
+
@command_exit_status.should == exit_status_str.to_i
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
Then /^the output should contain:$/ do
|
17
|
+
|string|
|
18
|
+
|
19
|
+
@command_output.should include string
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Temporary directory and files
|
2
|
+
|
3
|
+
Scenario:
|
4
|
+
|
5
|
+
Given a file "features/support/env.rb":
|
6
|
+
"""
|
7
|
+
require "hq/cucumber/temp-dir"
|
8
|
+
"""
|
9
|
+
Given a file "features/support/steps.rb":
|
10
|
+
"""
|
11
|
+
Then /^the file is created correctly$/ do
|
12
|
+
File.read("abc.def").should == "Hello world"
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
And a file "features/test.feature":
|
16
|
+
"""
|
17
|
+
Feature:
|
18
|
+
Scenario:
|
19
|
+
Given a file "abc.def":
|
20
|
+
\"\"\"
|
21
|
+
Hello world
|
22
|
+
\"\"\"
|
23
|
+
Then the file is created correctly
|
24
|
+
"""
|
25
|
+
|
26
|
+
When I run "cucumber"
|
27
|
+
|
28
|
+
Then the exit status should be 0
|
29
|
+
And the output should contain:
|
30
|
+
"""
|
31
|
+
1 scenario (1 passed)
|
32
|
+
2 steps (2 passed)
|
33
|
+
"""
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Feature: Time manipulation
|
2
|
+
|
3
|
+
Background:
|
4
|
+
|
5
|
+
Given a file "features/support/env.rb":
|
6
|
+
"""
|
7
|
+
require "hq/cucumber/time"
|
8
|
+
"""
|
9
|
+
|
10
|
+
And a file "features/support/steps.rb":
|
11
|
+
"""
|
12
|
+
Then /^the time should be correct$/ do
|
13
|
+
Time.now.to_i.should >= 1368458271
|
14
|
+
end
|
15
|
+
Then /^the time should be (\d+)$/ do
|
16
|
+
|time_str|
|
17
|
+
Time.now.to_i.should == time_str.to_i
|
18
|
+
end
|
19
|
+
"""
|
20
|
+
|
21
|
+
Scenario: Normal behaviour
|
22
|
+
|
23
|
+
Given a file "features/test.feature":
|
24
|
+
"""
|
25
|
+
Feature:
|
26
|
+
Scenario:
|
27
|
+
Then the time should be correct
|
28
|
+
"""
|
29
|
+
|
30
|
+
When I run "cucumber"
|
31
|
+
|
32
|
+
Then the exit status should be 0
|
33
|
+
And the output should contain:
|
34
|
+
"""
|
35
|
+
1 scenario (1 passed)
|
36
|
+
1 step (1 passed)
|
37
|
+
"""
|
38
|
+
|
39
|
+
Scenario: Override with integer
|
40
|
+
|
41
|
+
Given a file "features/test.feature":
|
42
|
+
"""
|
43
|
+
Feature:
|
44
|
+
Scenario:
|
45
|
+
Given the time is 123456
|
46
|
+
Then the time should be 123456
|
47
|
+
"""
|
48
|
+
|
49
|
+
When I run "cucumber"
|
50
|
+
|
51
|
+
Then the exit status should be 0
|
52
|
+
And the output should contain:
|
53
|
+
"""
|
54
|
+
1 scenario (1 passed)
|
55
|
+
2 steps (2 passed)
|
56
|
+
"""
|
data/lib/hq/cucumber/temp-dir.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "fileutils"
|
1
2
|
require "tmpdir"
|
2
3
|
|
3
4
|
Before do
|
@@ -20,6 +21,10 @@ end
|
|
20
21
|
Given /^a file "(.*?)":$/ do
|
21
22
|
|file_name, file_contents|
|
22
23
|
|
24
|
+
dir_name = File.dirname file_name
|
25
|
+
|
26
|
+
FileUtils.mkdir_p dir_name
|
27
|
+
|
23
28
|
File.open file_name, "w" do
|
24
29
|
|file_io|
|
25
30
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'cucumber/rspec/doubles'
|
2
|
+
|
3
|
+
Before do
|
4
|
+
|
5
|
+
original_now = Time.method(:now)
|
6
|
+
|
7
|
+
@time_override = nil
|
8
|
+
|
9
|
+
Time.stub(:now) do
|
10
|
+
if @time_override
|
11
|
+
@time_override
|
12
|
+
else
|
13
|
+
original_now.call
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
Given /^the time is (.+)$/ do
|
20
|
+
|time_str|
|
21
|
+
|
22
|
+
case time_str
|
23
|
+
|
24
|
+
# when /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/
|
25
|
+
|
26
|
+
# @time_override =
|
27
|
+
# Time.parse time_str
|
28
|
+
|
29
|
+
when /^(\d+)$/
|
30
|
+
|
31
|
+
@time_override =
|
32
|
+
Time.at time_str.to_i
|
33
|
+
|
34
|
+
else
|
35
|
+
|
36
|
+
raise "Invalid time"
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hq-dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Pharaoh
|
@@ -104,6 +104,7 @@ extensions: []
|
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
106
|
- lib/hq/cucumber/temp-dir.rb
|
107
|
+
- lib/hq/cucumber/time.rb
|
107
108
|
- data/gem-versions
|
108
109
|
- defaults/test-files
|
109
110
|
- defaults/development-dependencies
|
@@ -113,6 +114,10 @@ files:
|
|
113
114
|
- templates/gemspec
|
114
115
|
- templates/travis
|
115
116
|
- templates/gemfile
|
117
|
+
- features/temp-dir.feature
|
118
|
+
- features/time.feature
|
119
|
+
- features/support/steps.rb
|
120
|
+
- features/support/env.rb
|
116
121
|
- bin/hq-dev-release
|
117
122
|
- bin/hq-dev-init
|
118
123
|
homepage: https://github.com/jamespharaoh/hq-dev
|
@@ -138,4 +143,8 @@ rubygems_version: 2.0.3
|
|
138
143
|
signing_key:
|
139
144
|
specification_version: 4
|
140
145
|
summary: HQ dev
|
141
|
-
test_files:
|
146
|
+
test_files:
|
147
|
+
- features/temp-dir.feature
|
148
|
+
- features/time.feature
|
149
|
+
- features/support/steps.rb
|
150
|
+
- features/support/env.rb
|