sandwich 0.0.4 → 0.0.5
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.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
@@ -14,6 +14,10 @@ Then /^show me the source for #{q}$/ do |selector|
|
|
14
14
|
puts locate(selector).html
|
15
15
|
end
|
16
16
|
|
17
|
+
Then /^show me the source for ([^\"]+)$/ do |selector|
|
18
|
+
puts locate(selector_for(selector)).html
|
19
|
+
end
|
20
|
+
|
17
21
|
Then /^show me the page text$/ do
|
18
22
|
IO.popen("html2text", "w+") do |io|
|
19
23
|
io.puts response.body
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'sandwich/ext/string'
|
2
2
|
require 'sandwich/cucumber/world'
|
3
|
-
require 'sandwich/regexps'
|
4
3
|
|
5
4
|
Given /^(an?|the|\d+) (.+) exists?$/ do |total, what|
|
6
5
|
class_for(what).tap do |model|
|
@@ -9,13 +8,22 @@ Given /^(an?|the|\d+) (.+) exists?$/ do |total, what|
|
|
9
8
|
end
|
10
9
|
|
11
10
|
Transform /(an?|\d+) (.+) #{q}$/ do |total, what, value|
|
12
|
-
model =
|
13
|
-
|
11
|
+
model = attr = nil
|
12
|
+
|
13
|
+
begin
|
14
|
+
model = class_for(what)
|
15
|
+
attr = model.default_attribute
|
16
|
+
rescue NameError
|
17
|
+
what, attr = *what.split(/(?:with|in)/).map(&:strip)
|
18
|
+
model = class_for(what)
|
19
|
+
end
|
20
|
+
|
21
|
+
r = total.times.map { model.make(attr => value) }
|
14
22
|
|
15
23
|
r.length == 1 ? r.first : r
|
16
24
|
end
|
17
25
|
|
18
|
-
Transform /the (.+)
|
26
|
+
Transform /the (.+) #{q}$/ do |what, attr, value|
|
19
27
|
class_for(what).find(:first, :conditions => {attr => value})
|
20
28
|
end
|
21
29
|
|
@@ -28,6 +36,10 @@ Given /^(.+) belonging to (.+)$/ do |child, parent|
|
|
28
36
|
child.send("#{parent.class.name.underscore}=", parent)
|
29
37
|
end
|
30
38
|
|
39
|
+
Given /^(a .+ with .+)$/ do |obj|
|
40
|
+
# la la la la
|
41
|
+
end
|
42
|
+
|
31
43
|
Given /^(.+) has (.+)$/ do |parent, child|
|
32
44
|
parent.send(child.class.name.underscore.pluralize) << child
|
33
45
|
end
|
data/sandwich.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sandwich}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Leal"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-19}
|
13
13
|
s.description = %q{Yup, cucumber helpers}
|
14
14
|
s.email = %q{david@thedigitalants.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 5
|
9
|
+
version: 0.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David Leal
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-19 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|