capybara 0.3.6 → 0.3.7

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.
Files changed (64) hide show
  1. data/History.txt +19 -0
  2. data/README.rdoc +19 -11
  3. data/lib/capybara.rb +1 -2
  4. data/lib/capybara/driver/rack_test_driver.rb +7 -2
  5. data/lib/capybara/server.rb +1 -1
  6. data/{spec/drivers_spec.rb → lib/capybara/spec/driver.rb} +5 -1
  7. data/{spec → lib/capybara/spec}/fixtures/capybara.jpg +0 -0
  8. data/{spec → lib/capybara/spec}/fixtures/test_file.txt +0 -0
  9. data/{spec → lib/capybara/spec}/public/jquery-ui.js +0 -0
  10. data/{spec → lib/capybara/spec}/public/jquery.js +0 -0
  11. data/{spec → lib/capybara/spec}/public/test.js +0 -0
  12. data/{spec/session_spec.rb → lib/capybara/spec/session.rb} +5 -1
  13. data/{spec/dsl → lib/capybara/spec/session}/all_spec.rb +0 -0
  14. data/{spec/dsl → lib/capybara/spec/session}/attach_file_spec.rb +0 -0
  15. data/{spec/dsl → lib/capybara/spec/session}/check_spec.rb +0 -0
  16. data/{spec/dsl → lib/capybara/spec/session}/choose_spec.rb +0 -0
  17. data/{spec/dsl → lib/capybara/spec/session}/click_button_spec.rb +0 -0
  18. data/{spec/dsl → lib/capybara/spec/session}/click_link_spec.rb +0 -0
  19. data/{spec/dsl → lib/capybara/spec/session}/click_spec.rb +0 -0
  20. data/{spec/dsl → lib/capybara/spec/session}/current_url_spec.rb +0 -0
  21. data/{spec/dsl → lib/capybara/spec/session}/fill_in_spec.rb +0 -0
  22. data/{spec/dsl → lib/capybara/spec/session}/find_button_spec.rb +0 -0
  23. data/{spec/dsl → lib/capybara/spec/session}/find_by_id_spec.rb +0 -0
  24. data/{spec/dsl → lib/capybara/spec/session}/find_field_spec.rb +0 -0
  25. data/{spec/dsl → lib/capybara/spec/session}/find_link_spec.rb +0 -0
  26. data/{spec/dsl → lib/capybara/spec/session}/find_spec.rb +0 -0
  27. data/{spec/dsl → lib/capybara/spec/session}/has_button_spec.rb +0 -0
  28. data/{spec/dsl → lib/capybara/spec/session}/has_content_spec.rb +0 -0
  29. data/{spec/dsl → lib/capybara/spec/session}/has_css_spec.rb +0 -0
  30. data/{spec/dsl → lib/capybara/spec/session}/has_field_spec.rb +0 -0
  31. data/{spec/dsl → lib/capybara/spec/session}/has_link_spec.rb +0 -0
  32. data/lib/capybara/spec/session/has_select_spec.rb +89 -0
  33. data/lib/capybara/spec/session/has_table_spec.rb +96 -0
  34. data/{spec/dsl → lib/capybara/spec/session}/has_xpath_spec.rb +0 -0
  35. data/lib/capybara/spec/session/headers.rb +19 -0
  36. data/{spec/session_with_javascript_support_spec.rb → lib/capybara/spec/session/javascript.rb} +11 -4
  37. data/{spec/dsl → lib/capybara/spec/session}/locate_spec.rb +0 -0
  38. data/{spec/dsl → lib/capybara/spec/session}/select_spec.rb +0 -0
  39. data/{spec/dsl → lib/capybara/spec/session}/uncheck_spec.rb +0 -0
  40. data/lib/capybara/spec/session/unselect_spec.rb +48 -0
  41. data/{spec/dsl → lib/capybara/spec/session}/within_spec.rb +0 -0
  42. data/{spec → lib/capybara/spec}/test_app.rb +4 -0
  43. data/{spec → lib/capybara/spec}/views/buttons.erb +0 -0
  44. data/{spec → lib/capybara/spec}/views/fieldsets.erb +0 -0
  45. data/{spec → lib/capybara/spec}/views/form.erb +0 -0
  46. data/{spec → lib/capybara/spec}/views/postback.erb +0 -0
  47. data/{spec → lib/capybara/spec}/views/tables.erb +0 -0
  48. data/{spec → lib/capybara/spec}/views/with_html.erb +1 -0
  49. data/{spec → lib/capybara/spec}/views/with_js.erb +0 -0
  50. data/{spec → lib/capybara/spec}/views/with_scope.erb +0 -0
  51. data/{spec → lib/capybara/spec}/views/with_simple_html.erb +0 -0
  52. data/lib/capybara/version.rb +3 -0
  53. data/spec/session/rack_test_session_spec.rb +8 -0
  54. data/spec/spec_helper.rb +2 -10
  55. metadata +54 -79
  56. data/Manifest.txt +0 -87
  57. data/Rakefile +0 -29
  58. data/config.ru +0 -6
  59. data/script/console +0 -10
  60. data/script/destroy +0 -14
  61. data/script/generate +0 -14
  62. data/spec/session_with_headers_support_spec.rb +0 -13
  63. data/spec/session_without_headers_support_spec.rb +0 -15
  64. data/spec/session_without_javascript_support_spec.rb +0 -15
@@ -1,3 +1,22 @@
1
+ # Versiob 0.3.7
2
+
3
+ Release date: 2010-04-09
4
+
5
+ This is a drop in compatible maintainance release. It's mostly
6
+ important for driver authors.
7
+
8
+ ### Added
9
+
10
+ * RackTest scans for data-method which rails3 uses to change the request method
11
+
12
+ ### Fixed
13
+
14
+ * Don't hang when starting server on Windoze
15
+
16
+ ### Changed
17
+
18
+ * The driver and session specs are now located inside lib! Driver authors can simply require them.
19
+
1
20
  # Version 0.3.6
2
21
 
3
22
  Release date: 2010-03-22
@@ -101,6 +101,11 @@ At the moment, Capybara supports Webdriver, also called Selenium 2.0, *not*
101
101
  Selenium RC. Provided Firefox is installed, everything is set up for you, and
102
102
  you should be able to start using Selenium right away.
103
103
 
104
+ If desired, you can change Selenium browser to :chrome or :ie:
105
+
106
+ require "selenium-webdriver"
107
+ Selenium::WebDriver.for :chrome
108
+
104
109
  == Celerity
105
110
 
106
111
  Celerity only runs on JRuby, so you'll need to install the celerity gem under
@@ -217,7 +222,7 @@ You can also find specific elements, in order to manipulate them:
217
222
  find_button('Send').click
218
223
 
219
224
  find('//table/tr').click
220
- wait_for("//*[@id='overlay'").find("//h1").click
225
+ locate("//*[@id='overlay'").find("//h1").click
221
226
  all('a').each { |a| a[:href] }
222
227
 
223
228
  === Scripting
@@ -276,26 +281,27 @@ examples. Just load the DSL and include it anywhere:
276
281
  require 'capybara'
277
282
  require 'capybara/dsl'
278
283
 
279
- include Capybara
280
284
  Capybara.default_driver = :culerity
281
285
 
282
- within("//form[@id='session']") do
283
- fill_in 'Login', :with => 'user@example.com'
284
- fill_in 'Password', :with => 'password'
286
+ module MyModule
287
+ include Capybara
288
+
289
+ def login!
290
+ within("//form[@id='session']") do
291
+ fill_in 'Login', :with => 'user@example.com'
292
+ fill_in 'Password', :with => 'password'
293
+ end
294
+ click_link 'Sign in'
295
+ end
285
296
  end
286
- click_link 'Sign in'
287
297
 
288
298
  == Calling remote servers
289
299
 
290
300
  Normally Capybara expects to be testing an in-process Rack application, but you can also use it to talk to a web server running anywhere on the internets, by setting app_host:
291
301
 
292
- require 'capybara'
293
- require 'capybara/dsl'
294
-
295
- include Capybara
296
302
  Capybara.current_driver = :selenium
297
303
  Capybara.app_host = 'http://www.google.com'
298
-
304
+ ...
299
305
  visit('/')
300
306
 
301
307
  Note that rack-test does not support running against a remote server. With drivers that support it, you can also visit any URL directly:
@@ -383,6 +389,8 @@ The following people have dedicated their time and effort to Capybara:
383
389
  * Darrin Holst
384
390
  * Steven Parkes
385
391
  * Davide Marquês
392
+ * Lucas Prim
393
+ * José Valim
386
394
 
387
395
  == License:
388
396
 
@@ -2,8 +2,6 @@ require 'timeout'
2
2
  require 'nokogiri'
3
3
 
4
4
  module Capybara
5
- VERSION = '0.3.6'
6
-
7
5
  class CapybaraError < StandardError; end
8
6
  class DriverNotFoundError < CapybaraError; end
9
7
  class ElementNotFound < CapybaraError; end
@@ -37,6 +35,7 @@ module Capybara
37
35
  autoload :Node, 'capybara/node'
38
36
  autoload :XPath, 'capybara/xpath'
39
37
  autoload :Searchable, 'capybara/searchable'
38
+ autoload :VERSION, 'capybara/version'
40
39
 
41
40
  module Driver
42
41
  autoload :Base, 'capybara/driver/base'
@@ -74,7 +74,8 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
74
74
 
75
75
  def click
76
76
  if tag_name == 'a'
77
- driver.visit(self[:href].to_s)
77
+ method = self["data-method"] || :get
78
+ driver.process(method, self[:href].to_s)
78
79
  elsif (tag_name == 'input' or tag_name == 'button') and %w(submit image).include?(type)
79
80
  Form.new(driver, form).submit(self)
80
81
  end
@@ -186,8 +187,12 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
186
187
  end
187
188
 
188
189
  def visit(path, attributes = {})
190
+ process(:get, path, attributes)
191
+ end
192
+
193
+ def process(method, path, attributes = {})
189
194
  return if path.gsub(/^#{current_path}/, '') =~ /^#/
190
- get(path, attributes, env)
195
+ send(method, path, attributes, env)
191
196
  follow_redirects!
192
197
  end
193
198
 
@@ -93,7 +93,7 @@ private
93
93
  if res.is_a?(Net::HTTPSuccess) or res.is_a?(Net::HTTPRedirection)
94
94
  return res.body == @app.object_id.to_s
95
95
  end
96
- rescue Errno::ECONNREFUSED
96
+ rescue Errno::ECONNREFUSED, Errno::EBADF
97
97
  return false
98
98
  end
99
99
 
@@ -1,4 +1,8 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
1
+ require 'capybara/spec/test_app'
2
+
3
+ Dir[File.dirname(__FILE__)+'/driver/*'].each { |group|
4
+ require group
5
+ }
2
6
 
3
7
  shared_examples_for 'driver' do
4
8
 
@@ -1,6 +1,10 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
1
+ require 'capybara/spec/test_app'
2
2
  require 'nokogiri'
3
3
 
4
+ Dir[File.dirname(__FILE__)+'/session/*'].each { |group|
5
+ require group
6
+ }
7
+
4
8
  shared_examples_for "session" do
5
9
  def extract_results(session)
6
10
  YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text
@@ -0,0 +1,89 @@
1
+ shared_examples_for "has_select" do
2
+ describe '#has_select?' do
3
+ before { @session.visit('/form') }
4
+
5
+ it "should be true if the field is on the page" do
6
+ @session.should have_select('Locale')
7
+ @session.should have_select('form_region')
8
+ @session.should have_select('Languages')
9
+ end
10
+
11
+ it "should be false if the field is not on the page" do
12
+ @session.should_not have_select('Monkey')
13
+ end
14
+
15
+ context 'with selected value' do
16
+ it "should be true if a field with the given value is on the page" do
17
+ @session.should have_select('form_locale', :selected => 'English')
18
+ @session.should have_select('Region', :selected => 'Norway')
19
+ @session.should have_select('Underwear', :selected => ['Briefs', 'Commando'])
20
+ end
21
+
22
+ it "should be false if the given field is not on the page" do
23
+ @session.should_not have_select('Locale', :selected => 'Swedish')
24
+ @session.should_not have_select('Does not exist', :selected => 'John')
25
+ @session.should_not have_select('City', :selected => 'Not there')
26
+ @session.should_not have_select('Underwear', :selected => ['Briefs', 'Nonexistant'])
27
+ @session.should_not have_select('Underwear', :selected => ['Briefs', 'Boxers'])
28
+ end
29
+ end
30
+
31
+ context 'with options' do
32
+ it "should be true if a field with the given options is on the page" do
33
+ @session.should have_select('form_locale', :options => ['English'])
34
+ @session.should have_select('Region', :options => ['Norway', 'Sweden'])
35
+ end
36
+
37
+ it "should be false if the given field is not on the page" do
38
+ @session.should_not have_select('Locale', :options => ['Not there'])
39
+ @session.should_not have_select('Does not exist', :options => ['John'])
40
+ @session.should_not have_select('City', :options => ['London', 'Made up city'])
41
+ end
42
+ end
43
+ end
44
+
45
+ describe '#has_no_select?' do
46
+ before { @session.visit('/form') }
47
+
48
+ it "should be false if the field is on the page" do
49
+ @session.should_not have_no_select('Locale')
50
+ @session.should_not have_no_select('form_region')
51
+ @session.should_not have_no_select('Languages')
52
+ end
53
+
54
+ it "should be true if the field is not on the page" do
55
+ @session.should have_no_select('Monkey')
56
+ end
57
+
58
+ context 'with selected value' do
59
+ it "should be false if a field with the given value is on the page" do
60
+ @session.should_not have_no_select('form_locale', :selected => 'English')
61
+ @session.should_not have_no_select('Region', :selected => 'Norway')
62
+ @session.should_not have_no_select('Underwear', :selected => ['Briefs', 'Commando'])
63
+ end
64
+
65
+ it "should be true if the given field is not on the page" do
66
+ @session.should have_no_select('Locale', :selected => 'Swedish')
67
+ @session.should have_no_select('Does not exist', :selected => 'John')
68
+ @session.should have_no_select('City', :selected => 'Not there')
69
+ @session.should have_no_select('Underwear', :selected => ['Briefs', 'Nonexistant'])
70
+ @session.should have_no_select('Underwear', :selected => ['Briefs', 'Boxers'])
71
+ end
72
+ end
73
+
74
+ context 'with options' do
75
+ it "should be false if a field with the given options is on the page" do
76
+ @session.should_not have_no_select('form_locale', :options => ['English'])
77
+ @session.should_not have_no_select('Region', :options => ['Norway', 'Sweden'])
78
+ end
79
+
80
+ it "should be true if the given field is not on the page" do
81
+ @session.should have_no_select('Locale', :options => ['Not there'])
82
+ @session.should have_no_select('Does not exist', :options => ['John'])
83
+ @session.should have_no_select('City', :options => ['London', 'Made up city'])
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+
@@ -0,0 +1,96 @@
1
+ shared_examples_for "has_table" do
2
+ describe '#has_table?' do
3
+ before do
4
+ @session.visit('/tables')
5
+ end
6
+
7
+ it "should be true if the field is on the page" do
8
+ @session.should have_table('Deaths')
9
+ @session.should have_table('villain_table')
10
+ end
11
+
12
+ it "should be false if the field is not on the page" do
13
+ @session.should_not have_table('Monkey')
14
+ end
15
+
16
+ context 'with rows' do
17
+ it "should be true if a table with the given rows is on the page" do
18
+ @session.should have_table('Ransom', :rows => [['2007', '$300', '$100']])
19
+ @session.should have_table('Deaths', :rows => [['2007', '66', '7'], ['2008', '123', '12']])
20
+ end
21
+
22
+ it "should be true if the given rows are incomplete" do
23
+ @session.should have_table('Ransom', :rows => [['$300', '$100']])
24
+ end
25
+
26
+ it "should be false if the given table is not on the page" do
27
+ @session.should_not have_table('Does not exist', :selected => 'John')
28
+ end
29
+
30
+ it "should be false if the given rows contain incorrect elements" do
31
+ @session.should_not have_table('Ransom', :rows => [['2007', '$1000000000', '$100']])
32
+ end
33
+
34
+ it "should be false if the given rows are incorrectly ordered" do
35
+ @session.should_not have_table('Ransom', :rows => [['2007', '$100', '$300']])
36
+ end
37
+
38
+ it "should be false if the only some of the given rows are correct" do
39
+ @session.should_not have_table('Deaths', :rows => [['2007', '66', '7'], ['2007', '99999999', '12']])
40
+ end
41
+
42
+ it "should be false if the given rows are out of order" do
43
+ @session.should_not have_table('Deaths', :rows => [['2007', '123', '12'], ['2007', '66', '7']])
44
+ end
45
+ end
46
+ end
47
+
48
+ describe '#has_no_table?' do
49
+ before do
50
+ @session.visit('/tables')
51
+ end
52
+
53
+ it "should be false if the field is on the page" do
54
+ @session.should_not have_no_table('Deaths')
55
+ @session.should_not have_no_table('villain_table')
56
+ end
57
+
58
+ it "should be true if the field is not on the page" do
59
+ @session.should have_no_table('Monkey')
60
+ end
61
+
62
+ context 'with rows' do
63
+ it "should be false if a table with the given rows is on the page" do
64
+ @session.should_not have_no_table('Ransom', :rows => [['2007', '$300', '$100']])
65
+ @session.should_not have_no_table('Deaths', :rows => [['2007', '66', '7'], ['2008', '123', '12']])
66
+ end
67
+
68
+ it "should be false if the given rows are incomplete" do
69
+ @session.should_not have_no_table('Ransom', :rows => [['$300', '$100']])
70
+ end
71
+
72
+ it "should be true if the given table is not on the page" do
73
+ @session.should have_no_table('Does not exist', :selected => 'John')
74
+ end
75
+
76
+ it "should be true if the given rows contain incorrect elements" do
77
+ @session.should have_no_table('Ransom', :rows => [['2007', '$1000000000', '$100']])
78
+ end
79
+
80
+ it "should be true if the given rows are incorrectly ordered" do
81
+ @session.should have_no_table('Ransom', :rows => [['2007', '$100', '$300']])
82
+ end
83
+
84
+ it "should be true if the only some of the given rows are correct" do
85
+ @session.should have_no_table('Deaths', :rows => [['2007', '66', '7'], ['2007', '99999999', '12']])
86
+ end
87
+
88
+ it "should be true if the given rows are out of order" do
89
+ @session.should have_no_table('Deaths', :rows => [['2007', '123', '12'], ['2007', '66', '7']])
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+
96
+
@@ -0,0 +1,19 @@
1
+ shared_examples_for "session with headers support" do
2
+ describe '#response_headers' do
3
+ it "should return response headers" do
4
+ @session.visit('/with_simple_html')
5
+ @session.response_headers['Content-Type'].should == 'text/html'
6
+ end
7
+ end
8
+ end
9
+
10
+ shared_examples_for "session without headers support" do
11
+ describe "#response_headers" do
12
+ before{ @session.visit('/with_simple_html') }
13
+ it "should raise an error" do
14
+ running {
15
+ @session.response_headers
16
+ }.should raise_error(Capybara::NotSupportedByDriverError)
17
+ end
18
+ end
19
+ end
@@ -1,7 +1,3 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
2
-
3
- require 'nokogiri'
4
-
5
1
  shared_examples_for "session with javascript support" do
6
2
  describe 'all JS specs' do
7
3
  before do
@@ -195,3 +191,14 @@ shared_examples_for "session with javascript support" do
195
191
 
196
192
  end
197
193
  end
194
+
195
+ shared_examples_for "session without javascript support" do
196
+ describe "#evaluate_script" do
197
+ before{ @session.visit('/with_simple_html') }
198
+ it "should raise an error" do
199
+ running {
200
+ @session.evaluate_script('3 + 3')
201
+ }.should raise_error(Capybara::NotSupportedByDriverError)
202
+ end
203
+ end
204
+ end
@@ -0,0 +1,48 @@
1
+ shared_examples_for "unselect" do
2
+ describe "#unselect" do
3
+ before do
4
+ @session.visit('/form')
5
+ end
6
+
7
+ context "with multiple select" do
8
+ it "should unselect an option from a select box by id" do
9
+ @session.unselect('Commando', :from => 'form_underwear')
10
+ @session.click_button('awesome')
11
+ extract_results(@session)['underwear'].should include('Briefs', 'Boxer Briefs')
12
+ extract_results(@session)['underwear'].should_not include('Commando')
13
+ end
14
+
15
+ it "should unselect an option from a select box by label" do
16
+ @session.unselect('Commando', :from => 'Underwear')
17
+ @session.click_button('awesome')
18
+ extract_results(@session)['underwear'].should include('Briefs', 'Boxer Briefs')
19
+ extract_results(@session)['underwear'].should_not include('Commando')
20
+ end
21
+
22
+ it "should favour exact matches to option labels" do
23
+ @session.unselect("Briefs", :from => 'Underwear')
24
+ @session.click_button('awesome')
25
+ extract_results(@session)['underwear'].should include('Commando', 'Boxer Briefs')
26
+ extract_results(@session)['underwear'].should_not include('Briefs')
27
+ end
28
+ end
29
+
30
+ context "with single select" do
31
+ it "should raise an error" do
32
+ running { @session.unselect("English", :from => 'form_locale') }.should raise_error(Capybara::UnselectNotAllowed)
33
+ end
34
+ end
35
+
36
+ context "with a locator that doesn't exist" do
37
+ it "should raise an error" do
38
+ running { @session.unselect('foo', :from => 'does not exist') }.should raise_error(Capybara::ElementNotFound)
39
+ end
40
+ end
41
+
42
+ context "with an option that doesn't exist" do
43
+ it "should raise an error" do
44
+ running { @session.unselect('Does not Exist', :from => 'form_underwear') }.should raise_error(Capybara::OptionNotFound)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -42,6 +42,10 @@ class TestApp < Sinatra::Base
42
42
  redirect '/redirect_again'
43
43
  end
44
44
 
45
+ delete "/delete" do
46
+ "The requested object was deleted"
47
+ end
48
+
45
49
  get '/redirect_back' do
46
50
  redirect back
47
51
  end
@@ -23,6 +23,7 @@
23
23
  <a href="/redirect_back">BackToMyself</a>
24
24
  <a title="twas a fine link" href="/redirect">A link came first</a>
25
25
  <a title="a fine link" href="/with_simple_html">A link</a>
26
+ <a title="a fine link with data method" data-method="delete" href="/delete">A link with data-method</a>
26
27
  <a>No Href</a>
27
28
  <a href="">Blank Href</a>
28
29
  <a href="#">Blank Anchor</a>
@@ -0,0 +1,3 @@
1
+ module Capybara
2
+ VERSION = '0.3.7'
3
+ end
@@ -18,6 +18,14 @@ describe Capybara::Session do
18
18
  end
19
19
  end
20
20
 
21
+ describe '#click_link' do
22
+ it "should use data-method if available" do
23
+ @session.visit "/with_html"
24
+ @session.click_link "A link with data-method"
25
+ @session.body.should == 'The requested object was deleted'
26
+ end
27
+ end
28
+
21
29
  it_should_behave_like "session"
22
30
  it_should_behave_like "session without javascript support"
23
31
  it_should_behave_like "session with headers support"
@@ -5,16 +5,8 @@ require 'rubygems'
5
5
  require 'spec'
6
6
  require 'spec/autorun'
7
7
  require 'capybara'
8
- require 'test_app'
9
- require 'drivers_spec'
10
- require 'session_spec'
11
- Dir[File.dirname(__FILE__)+'/dsl/*'].each { |group|
12
- require group
13
- }
14
- require 'session_with_javascript_support_spec'
15
- require 'session_without_javascript_support_spec'
16
- require 'session_with_headers_support_spec'
17
- require 'session_without_headers_support_spec'
8
+ require 'capybara/spec/driver'
9
+ require 'capybara/spec/session'
18
10
 
19
11
  alias :running :lambda
20
12
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 7
9
+ version: 0.3.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonas Nicklas
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-22 00:00:00 +00:00
17
+ date: 2010-04-09 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -128,26 +128,7 @@ dependencies:
128
128
  version: 1.2.9
129
129
  type: :development
130
130
  version_requirements: *id008
131
- - !ruby/object:Gem::Dependency
132
- name: hoe
133
- prerelease: false
134
- requirement: &id009 !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- segments:
139
- - 2
140
- - 5
141
- - 0
142
- version: 2.5.0
143
- type: :development
144
- version_requirements: *id009
145
- description: |-
146
- Capybara aims to simplify the process of integration testing Rack applications,
147
- such as Rails, Sinatra or Merb. It is inspired by and aims to replace Webrat as
148
- a DSL for interacting with a webapplication. It is agnostic about the driver
149
- running your tests and currently comes bundled with rack-test, Culerity,
150
- Celerity and Selenium support built in.
131
+ description: Capybara is an integration testing tool for rack based web applications. It simulates how a user would interact with a website
151
132
  email:
152
133
  - jonas.nicklas@gmail.com
153
134
  executables: []
@@ -155,16 +136,8 @@ executables: []
155
136
  extensions: []
156
137
 
157
138
  extra_rdoc_files:
158
- - History.txt
159
- - Manifest.txt
160
139
  - README.rdoc
161
140
  files:
162
- - History.txt
163
- - Manifest.txt
164
- - README.rdoc
165
- - Rakefile
166
- - config.ru
167
- - lib/capybara.rb
168
141
  - lib/capybara/cucumber.rb
169
142
  - lib/capybara/driver/base.rb
170
143
  - lib/capybara/driver/celerity_driver.rb
@@ -178,11 +151,56 @@ files:
178
151
  - lib/capybara/searchable.rb
179
152
  - lib/capybara/server.rb
180
153
  - lib/capybara/session.rb
154
+ - lib/capybara/spec/driver.rb
155
+ - lib/capybara/spec/fixtures/capybara.jpg
156
+ - lib/capybara/spec/fixtures/test_file.txt
157
+ - lib/capybara/spec/public/jquery-ui.js
158
+ - lib/capybara/spec/public/jquery.js
159
+ - lib/capybara/spec/public/test.js
160
+ - lib/capybara/spec/session/all_spec.rb
161
+ - lib/capybara/spec/session/attach_file_spec.rb
162
+ - lib/capybara/spec/session/check_spec.rb
163
+ - lib/capybara/spec/session/choose_spec.rb
164
+ - lib/capybara/spec/session/click_button_spec.rb
165
+ - lib/capybara/spec/session/click_link_spec.rb
166
+ - lib/capybara/spec/session/click_spec.rb
167
+ - lib/capybara/spec/session/current_url_spec.rb
168
+ - lib/capybara/spec/session/fill_in_spec.rb
169
+ - lib/capybara/spec/session/find_button_spec.rb
170
+ - lib/capybara/spec/session/find_by_id_spec.rb
171
+ - lib/capybara/spec/session/find_field_spec.rb
172
+ - lib/capybara/spec/session/find_link_spec.rb
173
+ - lib/capybara/spec/session/find_spec.rb
174
+ - lib/capybara/spec/session/has_button_spec.rb
175
+ - lib/capybara/spec/session/has_content_spec.rb
176
+ - lib/capybara/spec/session/has_css_spec.rb
177
+ - lib/capybara/spec/session/has_field_spec.rb
178
+ - lib/capybara/spec/session/has_link_spec.rb
179
+ - lib/capybara/spec/session/has_select_spec.rb
180
+ - lib/capybara/spec/session/has_table_spec.rb
181
+ - lib/capybara/spec/session/has_xpath_spec.rb
182
+ - lib/capybara/spec/session/headers.rb
183
+ - lib/capybara/spec/session/javascript.rb
184
+ - lib/capybara/spec/session/locate_spec.rb
185
+ - lib/capybara/spec/session/select_spec.rb
186
+ - lib/capybara/spec/session/uncheck_spec.rb
187
+ - lib/capybara/spec/session/unselect_spec.rb
188
+ - lib/capybara/spec/session/within_spec.rb
189
+ - lib/capybara/spec/session.rb
190
+ - lib/capybara/spec/test_app.rb
191
+ - lib/capybara/spec/views/buttons.erb
192
+ - lib/capybara/spec/views/fieldsets.erb
193
+ - lib/capybara/spec/views/form.erb
194
+ - lib/capybara/spec/views/postback.erb
195
+ - lib/capybara/spec/views/tables.erb
196
+ - lib/capybara/spec/views/with_html.erb
197
+ - lib/capybara/spec/views/with_js.erb
198
+ - lib/capybara/spec/views/with_scope.erb
199
+ - lib/capybara/spec/views/with_simple_html.erb
200
+ - lib/capybara/version.rb
181
201
  - lib/capybara/wait_until.rb
182
202
  - lib/capybara/xpath.rb
183
- - script/console
184
- - script/destroy
185
- - script/generate
203
+ - lib/capybara.rb
186
204
  - spec/capybara_spec.rb
187
205
  - spec/driver/celerity_driver_spec.rb
188
206
  - spec/driver/culerity_driver_spec.rb
@@ -190,37 +208,7 @@ files:
190
208
  - spec/driver/remote_culerity_driver_spec.rb
191
209
  - spec/driver/remote_selenium_driver_spec.rb
192
210
  - spec/driver/selenium_driver_spec.rb
193
- - spec/drivers_spec.rb
194
- - spec/dsl/all_spec.rb
195
- - spec/dsl/attach_file_spec.rb
196
- - spec/dsl/check_spec.rb
197
- - spec/dsl/choose_spec.rb
198
- - spec/dsl/click_button_spec.rb
199
- - spec/dsl/click_link_spec.rb
200
- - spec/dsl/click_spec.rb
201
- - spec/dsl/current_url_spec.rb
202
- - spec/dsl/fill_in_spec.rb
203
- - spec/dsl/find_button_spec.rb
204
- - spec/dsl/find_by_id_spec.rb
205
- - spec/dsl/find_field_spec.rb
206
- - spec/dsl/find_link_spec.rb
207
- - spec/dsl/find_spec.rb
208
- - spec/dsl/has_button_spec.rb
209
- - spec/dsl/has_content_spec.rb
210
- - spec/dsl/has_css_spec.rb
211
- - spec/dsl/has_field_spec.rb
212
- - spec/dsl/has_link_spec.rb
213
- - spec/dsl/has_xpath_spec.rb
214
- - spec/dsl/locate_spec.rb
215
- - spec/dsl/select_spec.rb
216
- - spec/dsl/uncheck_spec.rb
217
- - spec/dsl/within_spec.rb
218
211
  - spec/dsl_spec.rb
219
- - spec/fixtures/capybara.jpg
220
- - spec/fixtures/test_file.txt
221
- - spec/public/jquery-ui.js
222
- - spec/public/jquery.js
223
- - spec/public/test.js
224
212
  - spec/save_and_open_page_spec.rb
225
213
  - spec/searchable_spec.rb
226
214
  - spec/server_spec.rb
@@ -228,24 +216,11 @@ files:
228
216
  - spec/session/culerity_session_spec.rb
229
217
  - spec/session/rack_test_session_spec.rb
230
218
  - spec/session/selenium_session_spec.rb
231
- - spec/session_spec.rb
232
- - spec/session_with_headers_support_spec.rb
233
- - spec/session_with_javascript_support_spec.rb
234
- - spec/session_without_headers_support_spec.rb
235
- - spec/session_without_javascript_support_spec.rb
236
219
  - spec/spec_helper.rb
237
- - spec/test_app.rb
238
- - spec/views/buttons.erb
239
- - spec/views/fieldsets.erb
240
- - spec/views/form.erb
241
- - spec/views/postback.erb
242
- - spec/views/tables.erb
243
- - spec/views/with_html.erb
244
- - spec/views/with_js.erb
245
- - spec/views/with_scope.erb
246
- - spec/views/with_simple_html.erb
247
220
  - spec/wait_until_spec.rb
248
221
  - spec/xpath_spec.rb
222
+ - README.rdoc
223
+ - History.txt
249
224
  has_rdoc: true
250
225
  homepage: http://github.com/jnicklas/capybara
251
226
  licenses: []
@@ -1,87 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.rdoc
4
- Rakefile
5
- config.ru
6
- lib/capybara.rb
7
- lib/capybara/cucumber.rb
8
- lib/capybara/driver/base.rb
9
- lib/capybara/driver/celerity_driver.rb
10
- lib/capybara/driver/culerity_driver.rb
11
- lib/capybara/driver/rack_test_driver.rb
12
- lib/capybara/driver/selenium_driver.rb
13
- lib/capybara/dsl.rb
14
- lib/capybara/node.rb
15
- lib/capybara/rails.rb
16
- lib/capybara/save_and_open_page.rb
17
- lib/capybara/searchable.rb
18
- lib/capybara/server.rb
19
- lib/capybara/session.rb
20
- lib/capybara/wait_until.rb
21
- lib/capybara/xpath.rb
22
- script/console
23
- script/destroy
24
- script/generate
25
- spec/capybara_spec.rb
26
- spec/driver/celerity_driver_spec.rb
27
- spec/driver/culerity_driver_spec.rb
28
- spec/driver/rack_test_driver_spec.rb
29
- spec/driver/remote_culerity_driver_spec.rb
30
- spec/driver/remote_selenium_driver_spec.rb
31
- spec/driver/selenium_driver_spec.rb
32
- spec/drivers_spec.rb
33
- spec/dsl/all_spec.rb
34
- spec/dsl/attach_file_spec.rb
35
- spec/dsl/check_spec.rb
36
- spec/dsl/choose_spec.rb
37
- spec/dsl/click_button_spec.rb
38
- spec/dsl/click_link_spec.rb
39
- spec/dsl/click_spec.rb
40
- spec/dsl/current_url_spec.rb
41
- spec/dsl/fill_in_spec.rb
42
- spec/dsl/find_button_spec.rb
43
- spec/dsl/find_by_id_spec.rb
44
- spec/dsl/find_field_spec.rb
45
- spec/dsl/find_link_spec.rb
46
- spec/dsl/find_spec.rb
47
- spec/dsl/has_button_spec.rb
48
- spec/dsl/has_content_spec.rb
49
- spec/dsl/has_css_spec.rb
50
- spec/dsl/has_field_spec.rb
51
- spec/dsl/has_link_spec.rb
52
- spec/dsl/has_xpath_spec.rb
53
- spec/dsl/locate_spec.rb
54
- spec/dsl/select_spec.rb
55
- spec/dsl/uncheck_spec.rb
56
- spec/dsl/within_spec.rb
57
- spec/dsl_spec.rb
58
- spec/fixtures/capybara.jpg
59
- spec/fixtures/test_file.txt
60
- spec/public/jquery-ui.js
61
- spec/public/jquery.js
62
- spec/public/test.js
63
- spec/save_and_open_page_spec.rb
64
- spec/searchable_spec.rb
65
- spec/server_spec.rb
66
- spec/session/celerity_session_spec.rb
67
- spec/session/culerity_session_spec.rb
68
- spec/session/rack_test_session_spec.rb
69
- spec/session/selenium_session_spec.rb
70
- spec/session_spec.rb
71
- spec/session_with_headers_support_spec.rb
72
- spec/session_with_javascript_support_spec.rb
73
- spec/session_without_headers_support_spec.rb
74
- spec/session_without_javascript_support_spec.rb
75
- spec/spec_helper.rb
76
- spec/test_app.rb
77
- spec/views/buttons.erb
78
- spec/views/fieldsets.erb
79
- spec/views/form.erb
80
- spec/views/postback.erb
81
- spec/views/tables.erb
82
- spec/views/with_html.erb
83
- spec/views/with_js.erb
84
- spec/views/with_scope.erb
85
- spec/views/with_simple_html.erb
86
- spec/wait_until_spec.rb
87
- spec/xpath_spec.rb
data/Rakefile DELETED
@@ -1,29 +0,0 @@
1
- require 'rubygems'
2
-
3
- gem 'hoe', '>= 2.1.0'
4
- require 'hoe'
5
-
6
- Hoe.plugin :newgem
7
-
8
- # Generate all the Rake tasks
9
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
10
- Hoe.spec 'capybara' do
11
- developer 'Jonas Nicklas', 'jonas.nicklas@gmail.com'
12
-
13
- self.readme_file = 'README.rdoc'
14
- self.extra_rdoc_files = Dir['*.rdoc']
15
-
16
- self.extra_deps = [
17
- ['nokogiri', '>= 1.3.3'],
18
- ['mime-types', '>= 1.16'],
19
- ['culerity', '>= 0.2.4'],
20
- ['selenium-webdriver', '>= 0.0.3'],
21
- ['rack', '>= 1.0.0'],
22
- ['rack-test', '>= 0.5.2'],
23
- ]
24
-
25
- self.extra_dev_deps = [
26
- ['sinatra', '>= 0.9.4'],
27
- ['rspec', '>= 1.2.9']
28
- ]
29
- end
data/config.ru DELETED
@@ -1,6 +0,0 @@
1
- ## This is not needed for Thin > 1.0.0
2
- ENV['RACK_ENV'] = "production"
3
-
4
- require File.expand_path('spec/test_app', File.dirname(__FILE__))
5
-
6
- run TestApp
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/capybara.rb'}"
9
- puts "Loading capybara gem"
10
- exec "#{irb} #{libs} --simple-prompt"
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
@@ -1,13 +0,0 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
2
-
3
-
4
- shared_examples_for "session with headers support" do
5
-
6
- describe '#response_headers' do
7
- it "should return response headers" do
8
- @session.visit('/with_simple_html')
9
- @session.response_headers['Content-Type'].should == 'text/html'
10
- end
11
- end
12
-
13
- end
@@ -1,15 +0,0 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
2
-
3
- require 'nokogiri'
4
-
5
- shared_examples_for "session without headers support" do
6
- describe "#evaluate_script" do
7
- before{ @session.visit('/with_simple_html') }
8
- it "should raise an error" do
9
- running {
10
- @session.response_headers
11
- }.should raise_error(Capybara::NotSupportedByDriverError)
12
- end
13
- end
14
- end
15
-
@@ -1,15 +0,0 @@
1
- require File.expand_path('spec_helper', File.dirname(__FILE__))
2
-
3
- require 'nokogiri'
4
-
5
- shared_examples_for "session without javascript support" do
6
- describe "#evaluate_script" do
7
- before{ @session.visit('/with_js') }
8
- it "should raise an error" do
9
- running {
10
- @session.evaluate_script("1+5")
11
- }.should raise_error(Capybara::NotSupportedByDriverError)
12
- end
13
- end
14
-
15
- end