data_spec 0.0.3 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/features/core.feature +3 -0
- data/lib/data_spec/cucumber.rb +3 -0
- data/lib/data_spec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d743dff97cb583826480de5f7247583ca3c595a
|
|
4
|
+
data.tar.gz: 80dd7b490ee0e85434af7b738a76ea7e85f1556d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d163a15da3f0cdc5ebf18cfb7a8e3a9e46b3acfc7eb4f84765f837d46a5235810b34800c1e9437254d40c560db327ff69c9af8fd1b32d7ef24c552b717ba514d
|
|
7
|
+
data.tar.gz: 217ce499aba7c3b1a57893b6fa3bb3bb5f38ac8ac037bc73a51544371b2a78d951be93f2bff904ad9ef7ec6acf22b2aebb419e986d77c4776cd794976086bf14
|
data/README.md
CHANGED
|
@@ -87,11 +87,14 @@ Given the data is:
|
|
|
87
87
|
- bacon
|
|
88
88
|
- 1
|
|
89
89
|
- 2013-07-06 20:09:32.824102000 -07:00
|
|
90
|
+
- "https://www.google.com/images/srpr/logo4w.png"
|
|
90
91
|
"""
|
|
91
92
|
Then the data at "0" should be of type String
|
|
92
93
|
Then the data at "1" should be of type Fixnum
|
|
93
94
|
Then the data at "2" should be of type Time
|
|
95
|
+
Then the data at "3" should be of type URI
|
|
94
96
|
```
|
|
97
|
+
Note: Checking a URI involves actually fetching the URI
|
|
95
98
|
|
|
96
99
|
Use embedded code:
|
|
97
100
|
```ruby
|
data/features/core.feature
CHANGED
|
@@ -109,6 +109,7 @@ Feature: Core Steps
|
|
|
109
109
|
string: bacon
|
|
110
110
|
hash: {}
|
|
111
111
|
array: []
|
|
112
|
+
url: "https://www.google.com/images/srpr/logo4w.png"
|
|
112
113
|
"""
|
|
113
114
|
Then the data at "date" should be of type Time
|
|
114
115
|
And the data at "fixnum" should be of type Fixnum
|
|
@@ -116,3 +117,5 @@ Feature: Core Steps
|
|
|
116
117
|
And the data at "string" should be of type String
|
|
117
118
|
And the data at "hash" should be of type Hash
|
|
118
119
|
And the data at "array" should be of type Array
|
|
120
|
+
And the data at "url" should be of type URI
|
|
121
|
+
#Note: ^^ Actually fetches the URL
|
data/lib/data_spec/cucumber.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require File.expand_path("../../data_spec", __FILE__)
|
|
2
2
|
require 'data_spec'
|
|
3
3
|
require 'time'
|
|
4
|
+
require 'open-uri'
|
|
4
5
|
|
|
5
6
|
World(DataSpec::Helpers, DataSpec::Matchers)
|
|
6
7
|
|
|
@@ -31,6 +32,8 @@ Then(/^the data at "(.*?)" should be of type ([A-Za-z]+)$/) do |path, type|
|
|
|
31
32
|
#JSON doesn't actually interpret a time string into a Time,
|
|
32
33
|
# YAML will, but Time doesn't parse a Time object
|
|
33
34
|
data.should match_block(lambda{|item| Time.parse(item.to_s).is_a? Time}).at(path)
|
|
35
|
+
elsif type == "URI"
|
|
36
|
+
expect { open(DataSpec::Helpers.at_path(data, path)) }.to_not raise_error
|
|
34
37
|
else
|
|
35
38
|
data.should match_block(lambda{|item| item.is_a? Object.const_get(type)}).at(path)
|
|
36
39
|
end
|
data/lib/data_spec/version.rb
CHANGED