shoes-cucumber 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +38 -0
- data/lib/shoes/cucumber.rb +2 -49
- data/lib/shoes/cucumber/helper/helper.rb +17 -0
- data/lib/shoes/cucumber/step_definitions/general_steps.rb +62 -0
- data/lib/shoes/cucumber/version.rb +2 -1
- data/shoes-cucumber.gemspec +4 -2
- metadata +82 -37
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
<pre>
|
2
|
+
DtttttttD
|
3
|
+
D:::::.:::D
|
4
|
+
D::: : ::D
|
5
|
+
D:: ::::::D
|
6
|
+
D:: ::: :D
|
7
|
+
D::: : :::D
|
8
|
+
t,,:,,,,t
|
9
|
+
tf D;tD
|
10
|
+
j tt
|
11
|
+
DGDD D D
|
12
|
+
tD D D
|
13
|
+
D L D DDDtD D L GD DD D DDD DDDtL GD
|
14
|
+
tD D D D tD D D j DD DD DD tD D tD Dt D
|
15
|
+
GD D D D D D DD tD D tD tD D LD DD
|
16
|
+
DD D tD D D tD DD tD D tD jD D D D
|
17
|
+
DD D DD D tD DD D fD D LD D DDt D
|
18
|
+
tD D tD fD DD G tD LGD D DD D DD D D D tD
|
19
|
+
GDDD DD tDD tDD DD jDD D D DD tDDt DDD tD
|
20
|
+
|
21
|
+
... for Shoes!
|
22
|
+
</pre>
|
23
|
+
|
24
|
+
## About
|
25
|
+
|
26
|
+
Team Shoes needs to run tests to make Shoes. You make Shoes apps; you
|
27
|
+
probably want to test them too! Well, shoes-cucumber to the rescue!
|
28
|
+
|
29
|
+
## ... but not just yet
|
30
|
+
|
31
|
+
This project is in the 'primordial-ooze' stage. See that 0.0.1? Yeah.
|
32
|
+
I'm serious. So! It's probably not useful to you yet. But don't let me
|
33
|
+
stop you! Just know that it's quite limited.
|
34
|
+
|
35
|
+
## Using it
|
36
|
+
|
37
|
+
Just require 'shoes/cucumber' in your env.rb, and make sure you've got
|
38
|
+
'shoes-cucumber' in your Gemfile. Easy as pie!
|
data/lib/shoes/cucumber.rb
CHANGED
@@ -1,51 +1,4 @@
|
|
1
1
|
require "shoes/cucumber/version"
|
2
|
+
require "shoes/mocks"
|
3
|
+
require "shoes/cucumber/step_definitions/general_steps"
|
2
4
|
|
3
|
-
require 'rspec/mocks'
|
4
|
-
class Shoes;
|
5
|
-
RSpec::Mocks.setup(self)
|
6
|
-
class Types; end
|
7
|
-
class Background; end
|
8
|
-
class Border; end
|
9
|
-
class Canvas; end
|
10
|
-
class Check; end
|
11
|
-
class Radio; end
|
12
|
-
class EditLine; end
|
13
|
-
class EditBox; end
|
14
|
-
class Effect; end
|
15
|
-
class Image; end
|
16
|
-
class ListBox; end
|
17
|
-
class Progress; end
|
18
|
-
class Shape; end
|
19
|
-
class TextBlock; end
|
20
|
-
class Text; end
|
21
|
-
|
22
|
-
# All of the classes above are ones that Shoes needs to be just
|
23
|
-
# bootstrapped, all the ones below are ones I'm mocking out from
|
24
|
-
# the C code. I'm not sure if there's a good distinction...
|
25
|
-
|
26
|
-
class Button
|
27
|
-
attr_accessor :name
|
28
|
-
def initialize(name, &blk)
|
29
|
-
self.name = name
|
30
|
-
instance_eval &blk if block_given?
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
attr_accessor :elements
|
35
|
-
|
36
|
-
def initialize
|
37
|
-
self.elements = []
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.app
|
41
|
-
new
|
42
|
-
end
|
43
|
-
|
44
|
-
def append(&blk)
|
45
|
-
instance_eval &blk if block_given?
|
46
|
-
end
|
47
|
-
|
48
|
-
def button(name, &blk)
|
49
|
-
self.elements << Button.new(name, &blk)
|
50
|
-
end
|
51
|
-
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
NAME_METHOD_MAPPING = { "button" => "button",
|
2
|
+
"paragraph" => "para",
|
3
|
+
"link" => "link" }
|
4
|
+
|
5
|
+
def singularize(string)
|
6
|
+
# for now it's easy enough, get rid of the s
|
7
|
+
if string[-1] == "s"
|
8
|
+
string.chop
|
9
|
+
else
|
10
|
+
string
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def class_for(element_name)
|
15
|
+
Shoes.const_get(singularize(element_name).capitalize)
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require_relative '../helper/helper.rb'
|
2
|
+
|
3
|
+
Given /^a Shoes application$/ do
|
4
|
+
@app = Shoes.app
|
5
|
+
end
|
6
|
+
|
7
|
+
Given /^the Shoes application in "([^"]+)"$/ do |file_path|
|
8
|
+
# load as I want a fresh file every time
|
9
|
+
load './' + file_path
|
10
|
+
@app = Shoes.application
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^I append an? ([^"]+) with text "([^"]+)" to the main window$/ do
|
14
|
+
|element_name, text|
|
15
|
+
@app.append do
|
16
|
+
send(NAME_METHOD_MAPPING[element_name], text)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
When /^I append an? ([^"]+) to the main window$/ do |element_name|
|
21
|
+
@app.append do
|
22
|
+
send(NAME_METHOD_MAPPING[element_name], "hello")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^I click the ([^"]+) labeled "([^"]+)"$/ do |element_name, text|
|
27
|
+
class_name = class_for(element_name)
|
28
|
+
button = @app.elements.find do |element|
|
29
|
+
element.kind_of?(class_name) && element.text == text
|
30
|
+
end
|
31
|
+
button.click
|
32
|
+
end
|
33
|
+
|
34
|
+
Then /^I should see an? ([^"]+)$/ do |element_name|
|
35
|
+
class_name = class_for(element_name)
|
36
|
+
@app.elements.find{ |element| element.kind_of?(class_name) }.should_not be_nil
|
37
|
+
end
|
38
|
+
|
39
|
+
Then /^I should see an? ([^"]+) with text "([^"]+)"$/ do |element_name, text|
|
40
|
+
class_name = class_for(element_name)
|
41
|
+
@app.elements.find do |element|
|
42
|
+
element.kind_of?(class_name) && element.text == text
|
43
|
+
end.should_not be_nil
|
44
|
+
end
|
45
|
+
|
46
|
+
Then /^I should see (\d+) ([^"]+)$/ do |number, element_name|
|
47
|
+
class_name = class_for(element_name)
|
48
|
+
@app.elements.find_all do |element|
|
49
|
+
element.kind_of? class_name
|
50
|
+
end.size.should be number.to_i
|
51
|
+
end
|
52
|
+
|
53
|
+
Then /^a popup should appear$/ do
|
54
|
+
@app.events.find { |element| element.kind_of?(Shoes::Alert) }.should_not be_nil
|
55
|
+
end
|
56
|
+
|
57
|
+
Then /^a popup with text "([^"]+)" should appear$/ do |text|
|
58
|
+
@app.events.find do |element|
|
59
|
+
element.kind_of?(Shoes::Alert) && element.text == text
|
60
|
+
end.should_not be_nil
|
61
|
+
end
|
62
|
+
|
data/shoes-cucumber.gemspec
CHANGED
@@ -5,8 +5,8 @@ require "shoes/cucumber/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "shoes-cucumber"
|
7
7
|
s.version = Shoes::Cucumber::VERSION
|
8
|
-
s.authors = ["Steve Klabnik"]
|
9
|
-
s.email = ["steve@steveklabnik.com"]
|
8
|
+
s.authors = ["Steve Klabnik", "Tobias Pfeiffer"]
|
9
|
+
s.email = ["steve@steveklabnik.com", "tobias.pfeiffer@student.hpi.uni-potsdam"]
|
10
10
|
s.homepage = "http://github.com/shoes/shoes-cucumber"
|
11
11
|
s.summary = %q{Use Cukes to test your Shoes!}
|
12
12
|
s.description = %q{Use Cukes to test your Shoes! Mostly mocking at this point, but eventually will let you test all aspects of Shoes apps.}
|
@@ -18,4 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_runtime_dependency "cucumber"
|
20
20
|
s.add_runtime_dependency "rspec"
|
21
|
+
s.add_runtime_dependency "shoes-mocks"
|
21
22
|
end
|
23
|
+
|
metadata
CHANGED
@@ -1,74 +1,119 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoes-cucumber
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Steve Klabnik
|
14
|
+
- Tobias Pfeiffer
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
|
19
|
+
date: 2011-09-25 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
15
23
|
name: cucumber
|
16
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
26
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
22
34
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
26
37
|
name: rspec
|
27
|
-
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
40
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
33
48
|
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: shoes-mocks
|
34
52
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :runtime
|
63
|
+
version_requirements: *id003
|
64
|
+
description: Use Cukes to test your Shoes! Mostly mocking at this point, but eventually will let you test all aspects of Shoes apps.
|
65
|
+
email:
|
39
66
|
- steve@steveklabnik.com
|
67
|
+
- tobias.pfeiffer@student.hpi.uni-potsdam
|
40
68
|
executables: []
|
69
|
+
|
41
70
|
extensions: []
|
71
|
+
|
42
72
|
extra_rdoc_files: []
|
43
|
-
|
73
|
+
|
74
|
+
files:
|
44
75
|
- .gitignore
|
45
76
|
- Gemfile
|
77
|
+
- README.md
|
46
78
|
- Rakefile
|
47
79
|
- lib/shoes/cucumber.rb
|
80
|
+
- lib/shoes/cucumber/helper/helper.rb
|
81
|
+
- lib/shoes/cucumber/step_definitions/general_steps.rb
|
48
82
|
- lib/shoes/cucumber/version.rb
|
49
83
|
- shoes-cucumber.gemspec
|
84
|
+
has_rdoc: true
|
50
85
|
homepage: http://github.com/shoes/shoes-cucumber
|
51
86
|
licenses: []
|
87
|
+
|
52
88
|
post_install_message:
|
53
89
|
rdoc_options: []
|
54
|
-
|
90
|
+
|
91
|
+
require_paths:
|
55
92
|
- lib
|
56
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
94
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
103
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
68
111
|
requirements: []
|
112
|
+
|
69
113
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 1.5.2
|
71
115
|
signing_key:
|
72
116
|
specification_version: 3
|
73
117
|
summary: Use Cukes to test your Shoes!
|
74
118
|
test_files: []
|
119
|
+
|