mechanical-cuke 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -0
- data/VERSION +1 -1
- data/features/step_definitions/table_steps.rb +5 -0
- data/features/support/env.rb +1 -0
- data/features/support/paths.rb +4 -0
- data/features/table_steps.feature +12 -0
- data/features/web_steps.feature +8 -1
- data/lib/mechanical-cuke.rb +4 -0
- data/lib/mechanical-cuke/web_steps.rb +4 -0
- data/test/fixtures/hello.txt +1 -0
- data/test/fixtures/server/server.rb +18 -0
- data/test/fixtures/server/views/table.erb +23 -0
- data/test/fixtures/server/views/upload_form.erb +18 -0
- metadata +6 -1
data/Rakefile
CHANGED
@@ -46,6 +46,10 @@ begin
|
|
46
46
|
Cucumber::Rake::Task.new(:cucumber)
|
47
47
|
|
48
48
|
task :cucumber => :check_dependencies
|
49
|
+
|
50
|
+
Cucumber::Rake::Task.new(:wip, 'Run features that are in progress') do |t|
|
51
|
+
t.cucumber_opts = "--tags @wip:3 --wip features"
|
52
|
+
end
|
49
53
|
rescue LoadError
|
50
54
|
task :cucumber do
|
51
55
|
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/features/support/env.rb
CHANGED
data/features/support/paths.rb
CHANGED
@@ -9,6 +9,10 @@ module NavigationHelpers
|
|
9
9
|
'/'
|
10
10
|
when /the form page/
|
11
11
|
'/form'
|
12
|
+
when /the table page/
|
13
|
+
'/table'
|
14
|
+
when /the upload page/
|
15
|
+
'/upload'
|
12
16
|
else
|
13
17
|
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
14
18
|
"Now, go and add a mapping in #{__FILE__}"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Table Steps
|
2
|
+
Even though tableish is part of Cucumber
|
3
|
+
I need to make sure it works with Mechanize
|
4
|
+
(because it depends on body_respose being defined).
|
5
|
+
|
6
|
+
Scenario: I should see the following table
|
7
|
+
Given I am on the table page
|
8
|
+
Then I should see the following table:
|
9
|
+
| Column One | Column Two |
|
10
|
+
| One | Two |
|
11
|
+
| Three | Four |
|
12
|
+
|
data/features/web_steps.feature
CHANGED
@@ -48,7 +48,14 @@ Feature: Using Mechanize
|
|
48
48
|
And I should see "ID-ed"
|
49
49
|
|
50
50
|
@mock_launchy
|
51
|
-
Scenario:
|
51
|
+
Scenario: Save and Open Step
|
52
52
|
Given I am on the index page
|
53
53
|
Then show me the page
|
54
54
|
|
55
|
+
Scenario: Attach File Step
|
56
|
+
Given I am on the upload page
|
57
|
+
When I attach the file "test/fixtures/hello.txt" to "upload"
|
58
|
+
And I press "Submit"
|
59
|
+
Then I should see "File hello.txt uploaded"
|
60
|
+
|
61
|
+
|
data/lib/mechanical-cuke.rb
CHANGED
@@ -45,6 +45,10 @@ When /^(?:|I )choose "([^\"]*)"$/ do |field|
|
|
45
45
|
r.check
|
46
46
|
end
|
47
47
|
|
48
|
+
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
49
|
+
form.file_upload_with(:name => field).file_name = path
|
50
|
+
end
|
51
|
+
|
48
52
|
Then /^(?:|I )should see "([^\"]*)"$/ do |text|
|
49
53
|
if defined?(Spec::Rails::Matchers)
|
50
54
|
response.should contain(text)
|
@@ -0,0 +1 @@
|
|
1
|
+
Hello World
|
@@ -18,3 +18,21 @@ end
|
|
18
18
|
post '/form' do
|
19
19
|
erb :form_output
|
20
20
|
end
|
21
|
+
|
22
|
+
get '/table' do
|
23
|
+
erb :table
|
24
|
+
end
|
25
|
+
|
26
|
+
get '/upload' do
|
27
|
+
erb :upload_form
|
28
|
+
end
|
29
|
+
|
30
|
+
post '/upload' do
|
31
|
+
unless params[:upload] &&
|
32
|
+
(tmpfile = params[:upload][:tempfile]) &&
|
33
|
+
(name = params[:upload][:filename])
|
34
|
+
"No file selected"
|
35
|
+
else
|
36
|
+
"File #{name} uploaded"
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
</head>
|
5
|
+
<title></title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<table id="table">
|
9
|
+
<tr>
|
10
|
+
<th>Column One</th>
|
11
|
+
<th>Column Two</th>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td>One</td>
|
15
|
+
<td>Two</td>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td>Three</td>
|
19
|
+
<td>Four</td>
|
20
|
+
</tr>
|
21
|
+
</body>
|
22
|
+
</html>
|
23
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>Form</title>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<form id="form_id" name="form_name" action="" method="POST"
|
8
|
+
enctype="multipart/form-data">
|
9
|
+
<p>
|
10
|
+
<label for="upload_id">File</label>
|
11
|
+
<input type="file" id="upload_id" name="upload">
|
12
|
+
</p>
|
13
|
+
<p>
|
14
|
+
<input type="submit" value="Submit">
|
15
|
+
</p>
|
16
|
+
</form>
|
17
|
+
</body>
|
18
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mechanical-cuke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spike Ilacqua
|
@@ -59,17 +59,22 @@ files:
|
|
59
59
|
- Rakefile
|
60
60
|
- VERSION
|
61
61
|
- features/step_definitions/mechanical-cuke_steps.rb
|
62
|
+
- features/step_definitions/table_steps.rb
|
62
63
|
- features/support/env.rb
|
63
64
|
- features/support/mocha.rb
|
64
65
|
- features/support/paths.rb
|
66
|
+
- features/table_steps.feature
|
65
67
|
- features/web_steps.feature
|
66
68
|
- lib/mechanical-cuke.rb
|
67
69
|
- lib/mechanical-cuke/save_and_open.rb
|
68
70
|
- lib/mechanical-cuke/web_steps.rb
|
71
|
+
- test/fixtures/hello.txt
|
69
72
|
- test/fixtures/server/server.rb
|
70
73
|
- test/fixtures/server/views/form.erb
|
71
74
|
- test/fixtures/server/views/form_output.erb
|
72
75
|
- test/fixtures/server/views/index.erb
|
76
|
+
- test/fixtures/server/views/table.erb
|
77
|
+
- test/fixtures/server/views/upload_form.erb
|
73
78
|
has_rdoc: true
|
74
79
|
homepage: http://github.com/spikex/mechanical-cuke
|
75
80
|
licenses: []
|