sandwich 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.
- data/.gitignore +1 -0
- data/VERSION +1 -1
- data/lib/sandwich/cucumber/debug_steps.rb +1 -1
- data/lib/sandwich/cucumber/model_steps.rb +14 -9
- data/lib/sandwich/cucumber/table_steps.rb +2 -2
- data/lib/sandwich/ext/object.rb +4 -2
- metadata +3 -4
- data/sandwich.gemspec +0 -78
data/.gitignore
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.6
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
require 'sandwich/ext/string'
|
|
2
2
|
require 'sandwich/cucumber/world'
|
|
3
3
|
|
|
4
|
-
Given /^(an?|the|\d+)
|
|
5
|
-
|
|
6
|
-
total.times { model.make }
|
|
7
|
-
end
|
|
4
|
+
Given /^((?:an?|the|\d+) .+)$/ do |what|
|
|
5
|
+
# la la la la
|
|
8
6
|
end
|
|
9
7
|
|
|
10
|
-
Transform /(an?|\d+) (.+) #{
|
|
8
|
+
Transform /(an?|\d+) (.+) #{qc}$/ do |total, what, value|
|
|
11
9
|
model = attr = nil
|
|
12
10
|
|
|
13
11
|
begin
|
|
@@ -18,16 +16,23 @@ Transform /(an?|\d+) (.+) #{q}$/ do |total, what, value|
|
|
|
18
16
|
model = class_for(what)
|
|
19
17
|
end
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
raise \
|
|
20
|
+
%q{No attribute passed and no default attribute defined. You can do that with:
|
|
21
|
+
|
|
22
|
+
YourModel.default_attribute :your_default_attribute
|
|
23
|
+
|
|
24
|
+
} if attr.nil?
|
|
25
|
+
|
|
26
|
+
r = total.times.map { model.make(attr => value) }
|
|
22
27
|
|
|
23
28
|
r.length == 1 ? r.first : r
|
|
24
29
|
end
|
|
25
30
|
|
|
26
|
-
Transform /the (.+) #{
|
|
31
|
+
Transform /the (.+) #{qc}$/ do |what, attr, value|
|
|
27
32
|
class_for(what).find(:first, :conditions => {attr => value})
|
|
28
33
|
end
|
|
29
34
|
|
|
30
|
-
Transform /the (.+) #{
|
|
35
|
+
Transform /the (.+) #{qc}$/ do |what, value|
|
|
31
36
|
klass = class_for(what)
|
|
32
37
|
klass.find(:first, :conditions => {klass.default_attribute => value})
|
|
33
38
|
end
|
|
@@ -48,7 +53,7 @@ Given /^no (.+) exists?$/ do |what|
|
|
|
48
53
|
class_for(what).delete_all
|
|
49
54
|
end
|
|
50
55
|
|
|
51
|
-
Given /^no (.+) (?:with|in) (.+) #{
|
|
56
|
+
Given /^no (.+) (?:with|in) (.+) #{qc} exists?$/ do |what, attr, value|
|
|
52
57
|
class_for(what).delete_all
|
|
53
58
|
end
|
|
54
59
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
When /^I fill in the #{
|
|
1
|
+
When /^I fill in the #{qc} row, #{qc} column in (.+?) with #{qc}$/ do |row, column, path, value|
|
|
2
2
|
selector = xpath(selector_for(path))
|
|
3
3
|
_, column_index = page.all(:xpath, "#{selector}//th").each_with_index.find { |e, i| e.text == column }
|
|
4
4
|
_, row_index = page.all(:xpath, "#{selector}//tr").each_with_index.find { |e, i| e.text.include?(row) }
|
|
5
5
|
page.locate(:xpath, "((#{selector}//tr)[#{row_index + 1}]/td)[#{column_index + 1}]/input").set(value)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
Then /^I should see #{
|
|
8
|
+
Then /^I should see #{qc} in the (\w+) data row of (.+)$/ do |value, ordinal, path|
|
|
9
9
|
within(selector_for(path)) do
|
|
10
10
|
page.should have_xpath("//tr[#{ordinal.to_i}]/td", :text => value)
|
|
11
11
|
end
|
data/lib/sandwich/ext/object.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
module Sandwich
|
|
2
2
|
module Object
|
|
3
|
-
|
|
3
|
+
QUOTED_UNCAPTURED = '"[^\"]*"'
|
|
4
|
+
QUOTED_CAPTURED = '"([^\"]*)"'
|
|
4
5
|
|
|
5
|
-
def
|
|
6
|
+
def qc() QUOTED_CAPTURED end
|
|
7
|
+
def qu() QUOTED_UNCAPTURED end
|
|
6
8
|
|
|
7
9
|
::Object.send(:include, self)
|
|
8
10
|
end
|
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
|
+
- 6
|
|
9
|
+
version: 0.0.6
|
|
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-21 00:00:00 +01:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -107,7 +107,6 @@ files:
|
|
|
107
107
|
- lib/sandwich/ext/string.rb
|
|
108
108
|
- lib/sandwich/helpers/amounts.rb
|
|
109
109
|
- lib/sandwich/helpers/base.rb
|
|
110
|
-
- sandwich.gemspec
|
|
111
110
|
- spec/sandwich_spec.rb
|
|
112
111
|
- spec/spec.opts
|
|
113
112
|
- spec/spec_helper.rb
|
data/sandwich.gemspec
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
-
# -*- encoding: utf-8 -*-
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |s|
|
|
7
|
-
s.name = %q{sandwich}
|
|
8
|
-
s.version = "0.0.5"
|
|
9
|
-
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.authors = ["David Leal"]
|
|
12
|
-
s.date = %q{2010-04-19}
|
|
13
|
-
s.description = %q{Yup, cucumber helpers}
|
|
14
|
-
s.email = %q{david@thedigitalants.com}
|
|
15
|
-
s.extra_rdoc_files = [
|
|
16
|
-
"LICENSE",
|
|
17
|
-
"README.rdoc"
|
|
18
|
-
]
|
|
19
|
-
s.files = [
|
|
20
|
-
".document",
|
|
21
|
-
".gitignore",
|
|
22
|
-
"LICENSE",
|
|
23
|
-
"README.rdoc",
|
|
24
|
-
"Rakefile",
|
|
25
|
-
"VERSION",
|
|
26
|
-
"lib/sandwich.rb",
|
|
27
|
-
"lib/sandwich/cucumber/debug_steps.rb",
|
|
28
|
-
"lib/sandwich/cucumber/model_steps.rb",
|
|
29
|
-
"lib/sandwich/cucumber/table_steps.rb",
|
|
30
|
-
"lib/sandwich/cucumber/web_steps.rb",
|
|
31
|
-
"lib/sandwich/cucumber/world.rb",
|
|
32
|
-
"lib/sandwich/ext/active_record.rb",
|
|
33
|
-
"lib/sandwich/ext/capybara.rb",
|
|
34
|
-
"lib/sandwich/ext/object.rb",
|
|
35
|
-
"lib/sandwich/ext/string.rb",
|
|
36
|
-
"lib/sandwich/helpers/amounts.rb",
|
|
37
|
-
"lib/sandwich/helpers/base.rb",
|
|
38
|
-
"sandwich.gemspec",
|
|
39
|
-
"spec/sandwich_spec.rb",
|
|
40
|
-
"spec/spec.opts",
|
|
41
|
-
"spec/spec_helper.rb"
|
|
42
|
-
]
|
|
43
|
-
s.homepage = %q{http://github.com/david/sandwich}
|
|
44
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
45
|
-
s.require_paths = ["lib"]
|
|
46
|
-
s.rubygems_version = %q{1.3.6}
|
|
47
|
-
s.summary = %q{Cucumber helpers}
|
|
48
|
-
s.test_files = [
|
|
49
|
-
"spec/sandwich_spec.rb",
|
|
50
|
-
"spec/spec_helper.rb"
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
if s.respond_to? :specification_version then
|
|
54
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
55
|
-
s.specification_version = 3
|
|
56
|
-
|
|
57
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
58
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
|
59
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
|
60
|
-
s.add_runtime_dependency(%q<machinist>, [">= 0"])
|
|
61
|
-
s.add_runtime_dependency(%q<capybara>, [">= 0"])
|
|
62
|
-
s.add_runtime_dependency(%q<cucumber>, [">= 0"])
|
|
63
|
-
else
|
|
64
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
65
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
|
66
|
-
s.add_dependency(%q<machinist>, [">= 0"])
|
|
67
|
-
s.add_dependency(%q<capybara>, [">= 0"])
|
|
68
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
|
69
|
-
end
|
|
70
|
-
else
|
|
71
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
72
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
|
73
|
-
s.add_dependency(%q<machinist>, [">= 0"])
|
|
74
|
-
s.add_dependency(%q<capybara>, [">= 0"])
|
|
75
|
-
s.add_dependency(%q<cucumber>, [">= 0"])
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|