celerity 0.0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
data/Rakefile CHANGED
@@ -1,34 +1,11 @@
1
1
  require 'rubygems'
2
- gem 'hoe', '>= 2.3.0'
3
- require 'hoe'
4
- %w[fileutils rubigen].each { |f| require f }
5
-
2
+ require 'rake'
6
3
  require "lib/celerity/version"
7
4
 
8
- Hoe.plugin :newgem # newgem 1.5.2+
9
- Hoe.plugin :website
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- Hoe.spec 'celerity' do |s|
14
- s.developer "Jari Bakken", "jari.bakken@finn.no"
15
- s.version = Celerity::VERSION
16
- s.clean_globs = %w[classes/* pkg/ doc/*]
17
-
18
- s.author << "Jari Bakken" << "T. Alexander Lystad" << "Knut Johannes Dahle"
19
- s.email << "jari.bakken@finn.no"
20
- s.extra_dev_deps << ['sinatra', '>= 0.9.4']
21
- s.summary = "Celerity is a JRuby library for easy and fast functional test automation for web applications."
22
-
23
- # hack to avoid the extra file
24
- @website_config = {'host' => 'jarib@rubyforge.org', 'remote_dir' => "/var/www/gforge-projects/celerity"}
25
- end
26
-
27
5
  Dir['tasks/**/*.rake'].each do |rake|
28
6
  begin
29
7
  load rake
30
- rescue LoadError
8
+ rescue LoadError => e
9
+ puts e.message
31
10
  end
32
11
  end
33
- # load 'tasks/jar.rake'
34
- # load 'tasks/rdoc.rake'
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 7
4
+ :patch: 3
@@ -1,22 +1,96 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{celerity}
5
- s.version = "0.0.7.2"
8
+ s.version = "0.7.3"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Jari Bakken", "Jari Bakken", "T. Alexander Lystad", "Knut Johannes Dahle"]
9
- s.date = %q{2009-09-30}
10
- s.description = %q{Celerity is a JRuby library for easy and fast functional test automation for web applications.
11
-
12
- Celerity is a JRuby wrapper around HtmlUnit – a headless Java browser with
13
- JavaScript support. It provides a simple API for programmatic navigation through
14
- web applications. Celerity provides a superset of Watir's API.}
15
- s.email = ["jari.bakken@finn.no", "jari.bakken@finn.no"]
16
- s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt"]
17
- s.files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Rakefile", "celerity.gemspec", "lib/celerity.rb", "lib/celerity/browser.rb", "lib/celerity/clickable_element.rb", "lib/celerity/collections.rb", "lib/celerity/container.rb", "lib/celerity/default_viewer.rb", "lib/celerity/disabled_element.rb", "lib/celerity/element.rb", "lib/celerity/element_collection.rb", "lib/celerity/element_locator.rb", "lib/celerity/elements/button.rb", "lib/celerity/elements/file_field.rb", "lib/celerity/elements/form.rb", "lib/celerity/elements/frame.rb", "lib/celerity/elements/image.rb", "lib/celerity/elements/label.rb", "lib/celerity/elements/link.rb", "lib/celerity/elements/meta.rb", "lib/celerity/elements/non_control_elements.rb", "lib/celerity/elements/option.rb", "lib/celerity/elements/radio_check.rb", "lib/celerity/elements/select_list.rb", "lib/celerity/elements/table.rb", "lib/celerity/elements/table_cell.rb", "lib/celerity/elements/table_elements.rb", "lib/celerity/elements/table_row.rb", "lib/celerity/elements/text_field.rb", "lib/celerity/exception.rb", "lib/celerity/htmlunit.rb", "lib/celerity/htmlunit/commons-codec-1.4.jar", "lib/celerity/htmlunit/commons-collections-3.2.1.jar", "lib/celerity/htmlunit/commons-httpclient-3.1.jar", "lib/celerity/htmlunit/commons-io-1.4.jar", "lib/celerity/htmlunit/commons-lang-2.4.jar", "lib/celerity/htmlunit/commons-logging-1.1.1.jar", "lib/celerity/htmlunit/cssparser-0.9.5.jar", "lib/celerity/htmlunit/htmlunit-2.7-SNAPSHOT.jar", "lib/celerity/htmlunit/htmlunit-core-js-2.7-SNAPSHOT.jar", "lib/celerity/htmlunit/nekohtml-1.9.13.jar", "lib/celerity/htmlunit/sac-1.3.jar", "lib/celerity/htmlunit/serializer-2.7.1.jar", "lib/celerity/htmlunit/xalan-2.7.1.jar", "lib/celerity/htmlunit/xercesImpl-2.9.1.jar", "lib/celerity/htmlunit/xml-apis-1.3.04.jar", "lib/celerity/identifier.rb", "lib/celerity/ignoring_web_connection.rb", "lib/celerity/input_element.rb", "lib/celerity/javascript_debugger.rb", "lib/celerity/listener.rb", "lib/celerity/resources/no_viewer.png", "lib/celerity/short_inspect.rb", "lib/celerity/util.rb", "lib/celerity/version.rb", "lib/celerity/viewer_connection.rb", "lib/celerity/watir_compatibility.rb", "lib/celerity/xpath_support.rb", "spec/browser_authentication_spec.rb", "spec/browser_spec.rb", "spec/clickable_element_spec.rb", "spec/default_viewer_spec.rb", "spec/element_spec.rb", "spec/filefield_spec.rb", "spec/htmlunit_spec.rb", "spec/index_offset_spec.rb", "spec/listener_spec.rb", "spec/spec_helper.rb", "tasks/benchmark.rake", "tasks/deployment.rake", "tasks/environment.rake", "tasks/fix.rake", "tasks/jar.rake", "tasks/rdoc.rake", "tasks/rspec.rake", "tasks/snapshot.rake", "tasks/website.rake", "tasks/yard.rake"]
18
- s.homepage = %q{http://celerity.rubyforge.org/}
19
- s.rdoc_options = ["--main", "README.rdoc"]
11
+ s.authors = ["Jari Bakken", "T. Alexander Lystad", "Knut Johannes Dahle"]
12
+ s.date = %q{2009-10-07}
13
+ s.description = %q{Celerity is a JRuby wrapper around HtmlUnit a headless Java browser with JavaScript support. It provides a simple API for programmatic navigation through web applications. Celerity provides a superset of Watir's API.}
14
+ s.email = %q{jari.bakken@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ "HISTORY",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "celerity.gemspec",
26
+ "lib/celerity.rb",
27
+ "lib/celerity/browser.rb",
28
+ "lib/celerity/clickable_element.rb",
29
+ "lib/celerity/collections.rb",
30
+ "lib/celerity/container.rb",
31
+ "lib/celerity/default_viewer.rb",
32
+ "lib/celerity/disabled_element.rb",
33
+ "lib/celerity/element.rb",
34
+ "lib/celerity/element_collection.rb",
35
+ "lib/celerity/element_locator.rb",
36
+ "lib/celerity/elements/button.rb",
37
+ "lib/celerity/elements/file_field.rb",
38
+ "lib/celerity/elements/form.rb",
39
+ "lib/celerity/elements/frame.rb",
40
+ "lib/celerity/elements/image.rb",
41
+ "lib/celerity/elements/label.rb",
42
+ "lib/celerity/elements/link.rb",
43
+ "lib/celerity/elements/meta.rb",
44
+ "lib/celerity/elements/non_control_elements.rb",
45
+ "lib/celerity/elements/option.rb",
46
+ "lib/celerity/elements/radio_check.rb",
47
+ "lib/celerity/elements/select_list.rb",
48
+ "lib/celerity/elements/table.rb",
49
+ "lib/celerity/elements/table_cell.rb",
50
+ "lib/celerity/elements/table_elements.rb",
51
+ "lib/celerity/elements/table_row.rb",
52
+ "lib/celerity/elements/text_field.rb",
53
+ "lib/celerity/exception.rb",
54
+ "lib/celerity/htmlunit.rb",
55
+ "lib/celerity/htmlunit/commons-codec-1.4.jar",
56
+ "lib/celerity/htmlunit/commons-collections-3.2.1.jar",
57
+ "lib/celerity/htmlunit/commons-httpclient-3.1.jar",
58
+ "lib/celerity/htmlunit/commons-io-1.4.jar",
59
+ "lib/celerity/htmlunit/commons-lang-2.4.jar",
60
+ "lib/celerity/htmlunit/commons-logging-1.1.1.jar",
61
+ "lib/celerity/htmlunit/cssparser-0.9.5.jar",
62
+ "lib/celerity/htmlunit/htmlunit-2.7-SNAPSHOT.jar",
63
+ "lib/celerity/htmlunit/htmlunit-core-js-2.7-SNAPSHOT.jar",
64
+ "lib/celerity/htmlunit/nekohtml-1.9.13.jar",
65
+ "lib/celerity/htmlunit/sac-1.3.jar",
66
+ "lib/celerity/htmlunit/serializer-2.7.1.jar",
67
+ "lib/celerity/htmlunit/xalan-2.7.1.jar",
68
+ "lib/celerity/htmlunit/xercesImpl-2.9.1.jar",
69
+ "lib/celerity/htmlunit/xml-apis-1.3.04.jar",
70
+ "lib/celerity/identifier.rb",
71
+ "lib/celerity/ignoring_web_connection.rb",
72
+ "lib/celerity/input_element.rb",
73
+ "lib/celerity/javascript_debugger.rb",
74
+ "lib/celerity/listener.rb",
75
+ "lib/celerity/resources/no_viewer.png",
76
+ "lib/celerity/short_inspect.rb",
77
+ "lib/celerity/util.rb",
78
+ "lib/celerity/version.rb",
79
+ "lib/celerity/viewer_connection.rb",
80
+ "lib/celerity/watir_compatibility.rb",
81
+ "lib/celerity/xpath_support.rb",
82
+ "tasks/benchmark.rake",
83
+ "tasks/fix.rake",
84
+ "tasks/jar.rake",
85
+ "tasks/jeweler.rake",
86
+ "tasks/rdoc.rake",
87
+ "tasks/snapshot.rake",
88
+ "tasks/spec.rake",
89
+ "tasks/website.rake",
90
+ "tasks/yard.rake"
91
+ ]
92
+ s.homepage = %q{http://github.com/jarib/celerity}
93
+ s.rdoc_options = ["--charset=UTF-8"]
20
94
  s.require_paths = ["lib"]
21
95
  s.rubyforge_project = %q{celerity}
22
96
  s.rubygems_version = %q{1.3.5}
@@ -27,14 +101,17 @@ web applications. Celerity provides a superset of Watir's API.}
27
101
  s.specification_version = 3
28
102
 
29
103
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
104
+ s.add_development_dependency(%q<rspec>, [">= 0"])
105
+ s.add_development_dependency(%q<yard>, [">= 0"])
30
106
  s.add_development_dependency(%q<sinatra>, [">= 0.9.4"])
31
- s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
32
107
  else
108
+ s.add_dependency(%q<rspec>, [">= 0"])
109
+ s.add_dependency(%q<yard>, [">= 0"])
33
110
  s.add_dependency(%q<sinatra>, [">= 0.9.4"])
34
- s.add_dependency(%q<hoe>, [">= 2.3.3"])
35
111
  end
36
112
  else
113
+ s.add_dependency(%q<rspec>, [">= 0"])
114
+ s.add_dependency(%q<yard>, [">= 0"])
37
115
  s.add_dependency(%q<sinatra>, [">= 0.9.4"])
38
- s.add_dependency(%q<hoe>, [">= 2.3.3"])
39
116
  end
40
117
  end
@@ -33,7 +33,7 @@ module Celerity
33
33
  # @see Celerity::Container for an introduction to the main API.
34
34
  #
35
35
  # @option opts :browser [:internet_explorer, :firefox, :firefox3] (:firefox3) Set the BrowserVersion used by HtmlUnit. Defaults to Firefox 3.
36
- # @option opts :charset [String] ("UTF-8") Specify the charset that webclient will use for requests, and those where texts are getting gibberished, like Browser#html.
36
+ # @option opts :charset [String] ("UTF-8") Specify the charset that webclient will use for requests.
37
37
  # @option opts :css [Boolean] (false) Enable CSS. Disabled by default.
38
38
  # @option opts :ignore_pattern [Regexp] See Browser#ignore_pattern=
39
39
  # @option opts :javascript_enabled [Boolean] (true) Enable/disable JavaScript evaluation. Enabled by default.
@@ -62,8 +62,8 @@ module Celerity
62
62
  raise ArgumentError, "expected one of #{render_types.inspect} for key :render"
63
63
  end
64
64
 
65
- opts = opts.dup # we'll delete from opts, so dup to avoid side effects
66
65
  @options = opts.dup # keep the unmodified version around as well
66
+ opts = opts.dup # we'll delete from opts, so dup to avoid side effects
67
67
 
68
68
  @render_type = opts.delete(:render) || :html
69
69
  @charset = opts.delete(:charset) || "UTF-8"
@@ -1,3 +1,3 @@
1
1
  module Celerity
2
- VERSION = "0.0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gem|
4
+ # see http://www.rubygems.org/read/chapter/20 for additional settings
5
+ gem.name = "celerity"
6
+ gem.summary = "Celerity is a JRuby library for easy and fast functional test automation for web applications."
7
+ gem.description = %Q{Celerity is a JRuby wrapper around HtmlUnit – a headless Java browser with JavaScript support. It provides a simple API for programmatic navigation through web applications. Celerity provides a superset of Watir's API.}
8
+ gem.email = "jari.bakken@gmail.com"
9
+ gem.homepage = "http://github.com/jarib/celerity"
10
+ gem.authors = ["Jari Bakken", "T. Alexander Lystad", "Knut Johannes Dahle"]
11
+ gem.rubyforge_project = "celerity"
12
+ gem.test_files = [] # the gem is big enough as it is
13
+
14
+ gem.files.reject! { |f| f =~ /^(website|doc|benchmark|log|spec|\.)/}
15
+
16
+ gem.add_development_dependency "rspec"
17
+ gem.add_development_dependency "yard"
18
+ gem.add_development_dependency 'sinatra', '>= 0.9.4'
19
+ end
20
+
21
+ Jeweler::GemcutterTasks.new
22
+ Jeweler::RubyforgeTasks.new { |rf| rf.doc_task = "yardoc" }
23
+ rescue LoadError
24
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
25
+ task :spec => :check_dependencies
26
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec/rake/spectask'
2
+ Spec::Rake::SpecTask.new(:spec) do |spec|
3
+ spec.libs << 'lib' << 'spec'
4
+ spec.spec_files = FileList['spec/**/*_spec.rb']
5
+ end
6
+
7
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
8
+ spec.libs << 'lib' << 'spec'
9
+ spec.pattern = 'spec/**/*_spec.rb'
10
+ spec.rcov = true
11
+ spec.rcov_opts = %w[--exclude spec,fcntl,path_helper,yaml --no-rcovrt]
12
+ end
13
+
14
+ if File.exist?(path = "spec/watirspec/watirspec.rake")
15
+ load path
16
+ end
17
+
18
+ namespace :watirspec do
19
+ desc 'Initialize and fetch the watirspec submodule'
20
+ task :init do
21
+ sh "git submodule init"
22
+ sh "git submodule update"
23
+ end
24
+ end
25
+
26
+ task :default => :spec
@@ -1,17 +1,10 @@
1
- #desc 'Generate website files'
2
- #task :website_generate => :ruby_env do
3
- # (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
- # sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
- # end
6
- #end
7
-
8
- desc 'Upload website files to rubyforge'
9
- task :website_upload do
10
- host = "#{rubyforge_username}@rubyforge.org"
11
- remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
- local_dir = 'website'
13
- sh %{rsync -rlgoDCv #{local_dir}/ #{host}:#{remote_dir}}
14
- end
15
-
16
- #desc 'Generate and upload website files'
17
- #task :website => [:website_generate, :website_upload, :publish_docs]
1
+ namespace :website do
2
+ desc 'Upload website files to rubyforge'
3
+ task :upload do
4
+ host = "jarib@rubyforge.org"
5
+ remote_dir = "/var/www/gforge-projects/celerity"
6
+ local_dir = 'website'
7
+
8
+ sh %{rsync -rlgoDCv #{local_dir}/ #{host}:#{remote_dir}}
9
+ end
10
+ end
@@ -1,9 +1,16 @@
1
1
  begin
2
- require "yard"
3
-
4
- YARD::Rake::YardocTask.new do |t|
5
- t.files = ["lib/**/*.rb"]
6
- t.options += ["-o", "website/yard"]
2
+ require 'yard'
3
+ YARD::Rake::YardocTask.new
4
+
5
+ desc 'Generate docs to website/yard'
6
+ namespace :yardoc do
7
+ YARD::Rake::YardocTask.new(:website) do |t|
8
+ t.options += ["-o", "website/yard"]
9
+ end
7
10
  end
11
+
8
12
  rescue LoadError
13
+ task :yardoc do
14
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
15
+ end
9
16
  end
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celerity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
- - Jari Bakken
9
8
  - T. Alexander Lystad
10
9
  - Knut Johannes Dahle
11
10
  autorequire:
@@ -16,43 +15,50 @@ date: 2009-10-07 00:00:00 +02:00
16
15
  default_executable:
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
- name: sinatra
18
+ name: rspec
20
19
  type: :development
21
20
  version_requirement:
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: 0.9.4
25
+ version: "0"
26
+ version:
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
29
+ type: :development
30
+ version_requirement:
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
27
36
  version:
28
37
  - !ruby/object:Gem::Dependency
29
- name: hoe
38
+ name: sinatra
30
39
  type: :development
31
40
  version_requirement:
32
41
  version_requirements: !ruby/object:Gem::Requirement
33
42
  requirements:
34
43
  - - ">="
35
44
  - !ruby/object:Gem::Version
36
- version: 2.3.3
45
+ version: 0.9.4
37
46
  version:
38
- description: ""
39
- email:
40
- - jari.bakken@finn.no
41
- - jari.bakken@finn.no
47
+ description: "Celerity is a JRuby wrapper around HtmlUnit \xE2\x80\x93 a headless Java browser with JavaScript support. It provides a simple API for programmatic navigation through web applications. Celerity provides a superset of Watir's API."
48
+ email: jari.bakken@gmail.com
42
49
  executables: []
43
50
 
44
51
  extensions: []
45
52
 
46
53
  extra_rdoc_files:
47
- - History.txt
48
- - License.txt
49
- - Manifest.txt
54
+ - LICENSE
55
+ - README.rdoc
50
56
  files:
51
- - History.txt
52
- - License.txt
53
- - Manifest.txt
57
+ - HISTORY
58
+ - LICENSE
54
59
  - README.rdoc
55
60
  - Rakefile
61
+ - VERSION.yml
56
62
  - celerity.gemspec
57
63
  - lib/celerity.rb
58
64
  - lib/celerity/browser.rb
@@ -110,34 +116,22 @@ files:
110
116
  - lib/celerity/viewer_connection.rb
111
117
  - lib/celerity/watir_compatibility.rb
112
118
  - lib/celerity/xpath_support.rb
113
- - spec/browser_authentication_spec.rb
114
- - spec/browser_spec.rb
115
- - spec/clickable_element_spec.rb
116
- - spec/default_viewer_spec.rb
117
- - spec/element_spec.rb
118
- - spec/filefield_spec.rb
119
- - spec/htmlunit_spec.rb
120
- - spec/index_offset_spec.rb
121
- - spec/listener_spec.rb
122
- - spec/spec_helper.rb
123
119
  - tasks/benchmark.rake
124
- - tasks/deployment.rake
125
- - tasks/environment.rake
126
120
  - tasks/fix.rake
127
121
  - tasks/jar.rake
122
+ - tasks/jeweler.rake
128
123
  - tasks/rdoc.rake
129
- - tasks/rspec.rake
130
124
  - tasks/snapshot.rake
125
+ - tasks/spec.rake
131
126
  - tasks/website.rake
132
127
  - tasks/yard.rake
133
128
  has_rdoc: true
134
- homepage:
129
+ homepage: http://github.com/jarib/celerity
135
130
  licenses: []
136
131
 
137
132
  post_install_message:
138
133
  rdoc_options:
139
- - --main
140
- - README.txt
134
+ - --charset=UTF-8
141
135
  require_paths:
142
136
  - lib
143
137
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -1,82 +0,0 @@
1
- History.txt
2
- License.txt
3
- Manifest.txt
4
- README.rdoc
5
- Rakefile
6
- celerity.gemspec
7
- lib/celerity.rb
8
- lib/celerity/browser.rb
9
- lib/celerity/clickable_element.rb
10
- lib/celerity/collections.rb
11
- lib/celerity/container.rb
12
- lib/celerity/default_viewer.rb
13
- lib/celerity/disabled_element.rb
14
- lib/celerity/element.rb
15
- lib/celerity/element_collection.rb
16
- lib/celerity/element_locator.rb
17
- lib/celerity/elements/button.rb
18
- lib/celerity/elements/file_field.rb
19
- lib/celerity/elements/form.rb
20
- lib/celerity/elements/frame.rb
21
- lib/celerity/elements/image.rb
22
- lib/celerity/elements/label.rb
23
- lib/celerity/elements/link.rb
24
- lib/celerity/elements/meta.rb
25
- lib/celerity/elements/non_control_elements.rb
26
- lib/celerity/elements/option.rb
27
- lib/celerity/elements/radio_check.rb
28
- lib/celerity/elements/select_list.rb
29
- lib/celerity/elements/table.rb
30
- lib/celerity/elements/table_cell.rb
31
- lib/celerity/elements/table_elements.rb
32
- lib/celerity/elements/table_row.rb
33
- lib/celerity/elements/text_field.rb
34
- lib/celerity/exception.rb
35
- lib/celerity/htmlunit.rb
36
- lib/celerity/htmlunit/commons-codec-1.4.jar
37
- lib/celerity/htmlunit/commons-collections-3.2.1.jar
38
- lib/celerity/htmlunit/commons-httpclient-3.1.jar
39
- lib/celerity/htmlunit/commons-io-1.4.jar
40
- lib/celerity/htmlunit/commons-lang-2.4.jar
41
- lib/celerity/htmlunit/commons-logging-1.1.1.jar
42
- lib/celerity/htmlunit/cssparser-0.9.5.jar
43
- lib/celerity/htmlunit/htmlunit-2.7-SNAPSHOT.jar
44
- lib/celerity/htmlunit/htmlunit-core-js-2.7-SNAPSHOT.jar
45
- lib/celerity/htmlunit/nekohtml-1.9.13.jar
46
- lib/celerity/htmlunit/sac-1.3.jar
47
- lib/celerity/htmlunit/serializer-2.7.1.jar
48
- lib/celerity/htmlunit/xalan-2.7.1.jar
49
- lib/celerity/htmlunit/xercesImpl-2.9.1.jar
50
- lib/celerity/htmlunit/xml-apis-1.3.04.jar
51
- lib/celerity/identifier.rb
52
- lib/celerity/ignoring_web_connection.rb
53
- lib/celerity/input_element.rb
54
- lib/celerity/javascript_debugger.rb
55
- lib/celerity/listener.rb
56
- lib/celerity/resources/no_viewer.png
57
- lib/celerity/short_inspect.rb
58
- lib/celerity/util.rb
59
- lib/celerity/version.rb
60
- lib/celerity/viewer_connection.rb
61
- lib/celerity/watir_compatibility.rb
62
- lib/celerity/xpath_support.rb
63
- spec/browser_authentication_spec.rb
64
- spec/browser_spec.rb
65
- spec/clickable_element_spec.rb
66
- spec/default_viewer_spec.rb
67
- spec/element_spec.rb
68
- spec/filefield_spec.rb
69
- spec/htmlunit_spec.rb
70
- spec/index_offset_spec.rb
71
- spec/listener_spec.rb
72
- spec/spec_helper.rb
73
- tasks/benchmark.rake
74
- tasks/deployment.rake
75
- tasks/environment.rake
76
- tasks/fix.rake
77
- tasks/jar.rake
78
- tasks/rdoc.rake
79
- tasks/rspec.rake
80
- tasks/snapshot.rake
81
- tasks/website.rake
82
- tasks/yard.rake
@@ -1,16 +0,0 @@
1
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
2
-
3
- describe "Browser" do
4
-
5
- describe "#credentials=" do
6
- it "sets the basic authentication credentials" do
7
- browser.goto(WatirSpec.host + "/authentication")
8
- browser.text.should_not include("ok")
9
-
10
- browser.credentials = "foo:bar"
11
-
12
- browser.goto(WatirSpec.host + "/authentication")
13
- browser.text.should include("ok")
14
- end
15
- end
16
- end
@@ -1,300 +0,0 @@
1
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
2
-
3
- describe "Browser" do
4
- describe "#new" do
5
- it "raises TypeError if argument is not a Hash" do
6
- lambda { Browser.new(:foo) }.should raise_error(TypeError)
7
- end
8
-
9
- it "raises ArgumentError if given bad arguments for :render key" do
10
- lambda { Browser.new(:render => :foo) }.should raise_error(ArgumentError)
11
- end
12
-
13
- it "raises ArgumentError if given bad arguments for :browser key" do
14
- lambda { Browser.new(:browser => 'foo') }.should raise_error(ArgumentError)
15
- end
16
-
17
- it "raises ArgumentError if given an unknown option" do
18
- lambda { Browser.new(:foo => 1) }.should raise_error(ArgumentError)
19
- end
20
-
21
- it "should hold the init options" do
22
- browser.options.should == WatirSpec.browser_args.first
23
- end
24
-
25
- it "should use the specified proxy" do
26
- # TODO: find a better way to test this with rack
27
- require 'webrick/httpproxy'
28
-
29
- received = false
30
- blk = lambda { received = true }
31
- s = WEBrick::HTTPProxyServer.new(:Port => 2001, :ProxyContentHandler => blk)
32
- Thread.new { s.start }
33
-
34
- b = Browser.new(WatirSpec.browser_args.first.merge(:proxy => "localhost:2001"))
35
- b.goto(WatirSpec.host)
36
- s.shutdown
37
-
38
- received.should be_true
39
- end
40
-
41
- it "should use the specified user agent" do
42
- b = Browser.new(WatirSpec.browser_args.first.merge(:user_agent => "Celerity"))
43
- b.goto(WatirSpec.host + "/header_echo")
44
- b.text.should include('"HTTP_USER_AGENT"=>"Celerity"')
45
- b.close
46
- end
47
-
48
- it "does not try to find a viewer if created with :viewer => false" do
49
- ViewerConnection.should_not_receive(:create)
50
-
51
- b = Browser.new(:viewer => false)
52
- b.close
53
- end
54
-
55
- it "tries to find a viewer if created with :viewer => nil" do
56
- ViewerConnection.should_receive(:create).with("127.0.0.1", 6429)
57
-
58
- b = Browser.new(:viewer => nil)
59
- b.close
60
- end
61
-
62
- it "tries to find a viewer on the specified host/port with :viewer => String" do
63
- ViewerConnection.should_receive(:create).with("localhost", 1234)
64
-
65
- b = Browser.new(:viewer => "localhost:1234")
66
- b.close
67
- end
68
- end
69
-
70
- describe "#html" do
71
- %w(shift_jis iso-2022-jp euc-jp).each do |charset|
72
- it "returns decoded #{charset.upcase} when :charset specified" do
73
- browser = Browser.new(WatirSpec.browser_args.first.merge(:charset => charset.upcase))
74
- browser.goto(WatirSpec.files + "/#{charset}_text.html")
75
- # Browser#text is automagically transcoded into the right charset, but Browser#html isn't.
76
- browser.html.should =~ /本日は晴天なり。/
77
- browser.close
78
- end
79
- end
80
- end
81
-
82
- describe "#response_headers" do
83
- it "returns the response headers (as a hash)" do
84
- browser.goto(WatirSpec.host + "/non_control_elements.html")
85
- browser.response_headers.should be_kind_of(Hash)
86
- browser.response_headers['Date'].should be_kind_of(String)
87
- browser.response_headers['Content-Type'].should be_kind_of(String)
88
- end
89
- end
90
-
91
- describe "#content_type" do
92
- it "returns the content type" do
93
- browser.goto(WatirSpec.host + "/non_control_elements.html")
94
- browser.content_type.should =~ /\w+\/\w+/
95
- end
96
- end
97
-
98
- describe "#io" do
99
- it "returns the io object of the content" do
100
- browser.goto(WatirSpec.files + "/non_control_elements.html")
101
- browser.io.should be_kind_of(IO)
102
- browser.io.read.should == File.read("#{WatirSpec.html}/non_control_elements.html")
103
- end
104
- end
105
-
106
- describe "#goto" do
107
- it "raises UnexpectedPageException if the content type is not understood" do
108
- lambda { browser.goto(WatirSpec.host + "/octet_stream") }.should raise_error(UnexpectedPageException)
109
- end
110
- end
111
-
112
- describe "#cookies" do
113
- it "returns set cookies as a Ruby hash" do
114
- cookies = browser.cookies
115
- cookies.should be_instance_of(Hash)
116
- cookies.should be_empty
117
-
118
- browser.goto(WatirSpec.host + "/set_cookie")
119
-
120
- cookies = browser.cookies
121
- cookies.size.should == 1
122
- cookies[WatirSpec::Server.host]['monster'].should == "/"
123
- end
124
- end
125
-
126
- describe "#clear_cookies" do
127
- it "clears all cookies" do
128
- b = WatirSpec.new_browser
129
- b.cookies.should be_empty
130
-
131
- b.goto(WatirSpec.host + "/set_cookie")
132
- b.cookies.size.should == 1
133
- b.clear_cookies
134
- b.cookies.should be_empty
135
-
136
- b.close
137
- end
138
- end
139
-
140
- describe "add_cookie" do
141
- it "adds a cookie with the given domain, name and value" do
142
- browser.add_cookie("example.com", "foo", "bar")
143
- cookies = browser.cookies
144
- cookies.should be_instance_of(Hash)
145
- cookies.should have_key('example.com')
146
- cookies['example.com']['foo'].should == 'bar'
147
-
148
- browser.clear_cookies
149
- end
150
-
151
- it "adds a cookie with the specified options" do
152
- browser.add_cookie("example.com", "foo", "bar", :path => "/foobar", :expires => Time.now + 100000)
153
- cookies = browser.cookies
154
- cookies.should be_instance_of(Hash)
155
- cookies['example.com']['foo'].should == 'bar'
156
- end
157
- end
158
-
159
- describe "remove_cookie" do
160
- it "removes the cookie for the given domain and name" do
161
- b = WatirSpec.new_browser
162
- b.goto(WatirSpec.host + "/set_cookie")
163
-
164
- b.remove_cookie(WatirSpec::Server.host, "monster")
165
- b.cookies.should be_empty
166
-
167
- b.close
168
- end
169
-
170
- it "raises an error if no such cookie exists" do
171
- lambda { browser.remove_cookie("bogus.com", "bar") }.should raise_error(CookieNotFoundError)
172
- end
173
- end
174
-
175
- describe "#wait" do
176
- it "should wait for javascript timers to finish" do
177
- alerts = 0
178
- browser.add_listener(:alert) { alerts += 1 }
179
- browser.goto(WatirSpec.files + "/timeout.html")
180
- browser.div(:id, 'alert').click
181
- browser.wait.should be_true
182
- alerts.should == 1
183
- end
184
- end
185
-
186
- describe "#wait_while" do
187
- it "waits until the specified condition becomes false" do
188
- browser.goto(WatirSpec.files + "/timeout.html")
189
- browser.div(:id, "change").click
190
- browser.wait_while { browser.contains_text("Trigger change") }
191
- browser.div(:id, "change").text.should == "all done"
192
- end
193
-
194
- it "returns the value returned from the block" do
195
- browser.wait_while { false }.should == false
196
- end
197
- end
198
-
199
- describe "#wait_until" do
200
- it "waits until the condition becomes true" do
201
- browser.goto(WatirSpec.files + "/timeout.html")
202
- browser.div(:id, "change").click
203
- browser.wait_until { browser.contains_text("all done") }
204
- end
205
-
206
- it "returns the value returned from the block" do
207
- browser.wait_until { true }.should == true
208
- end
209
- end
210
-
211
- describe "#element_by_xpath" do
212
- it "returns usable elements even though they're not supported" do
213
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
214
-
215
- el = browser.element_by_xpath("//link")
216
- el.should be_instance_of(Celerity::Element)
217
- el.rel.should == "stylesheet"
218
- end
219
- end
220
-
221
- describe "#focused_element" do
222
- it "returns the element that currently has the focus" do
223
- b = WatirSpec.new_browser
224
- b.goto(WatirSpec.files + "/forms_with_input_elements.html")
225
- b.focused_element.id.should == "new_user_first_name"
226
-
227
- b.close
228
- end
229
- end
230
-
231
- describe "#status_code" do
232
- it "returns the status code of the last request" do
233
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
234
- browser.status_code.should == 200
235
-
236
- browser.goto(WatirSpec.host + "/doesnt_exist")
237
- browser.status_code.should == 404
238
- end
239
- end
240
-
241
- describe "#status_code_exceptions" do
242
- it "raises status code exceptions if set to true" do
243
- browser.status_code_exceptions = true
244
- lambda do
245
- browser.goto(WatirSpec.host + "/doesnt_exist")
246
- end.should raise_error(NavigationException)
247
- end
248
- end
249
-
250
- describe "#javascript_exceptions" do
251
- it "raises javascript exceptions if set to true" do
252
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
253
- browser.javascript_exceptions = true
254
- lambda do
255
- browser.execute_script("no_such_function()")
256
- end.should raise_error
257
- end
258
- end
259
-
260
- describe "#add_listener" do
261
- it "should click OK for confirm() calls" do
262
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
263
- browser.add_listener(:confirm) { }
264
- browser.execute_script("confirm()").should == true
265
- end
266
- end
267
-
268
- describe "#add_checker" do
269
-
270
- # watir only supports a lambda instance as argument, celerity supports both
271
- it "runs the given block on each page load" do
272
- output = ''
273
-
274
- browser.add_checker { |browser| output << browser.text }
275
- browser.goto(WatirSpec.files + "/non_control_elements.html")
276
-
277
- output.should include('Dubito, ergo cogito, ergo sum')
278
- end
279
- end
280
-
281
-
282
- describe "#confirm" do
283
- it "clicks 'OK' for a confirm() call" do
284
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
285
-
286
- browser.confirm(true) do
287
- browser.execute_script('confirm()').should be_true
288
- end
289
- end
290
-
291
- it "clicks 'cancel' for a confirm() call" do
292
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
293
-
294
- browser.confirm(false) do
295
- browser.execute_script('confirm()').should be_false
296
- end
297
- end
298
- end
299
-
300
- end
@@ -1,39 +0,0 @@
1
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
2
-
3
- describe "ClickableElement" do
4
-
5
- before :each do
6
- browser.goto(WatirSpec.files + "/non_control_elements.html")
7
- end
8
-
9
- describe "#click_and_attach" do
10
- it 'opens a page in a new browser with the same options' do
11
- b = browser.link(:name, /bad_attribute/).click_and_attach
12
- b.text.include?("User administration").should be_true # to make sure it is open.
13
- b.options.should == browser.options
14
- b.cookies.should == browser.cookies
15
- end
16
-
17
- it "opens the page in a new browser with the same cookies" do
18
- browser.add_cookie("localhost", "foo", "bar")
19
- old_cookies = browser.cookies
20
- old_cookies.should_not be_empty
21
-
22
- browser.goto(WatirSpec.files + "/non_control_elements.html")
23
- b = browser.link(:name, /bad_attribute/).click_and_attach
24
-
25
- b.should_not == browser
26
- b.cookies.should == old_cookies
27
- end
28
- end
29
-
30
- describe "#download" do
31
- it 'returns a click-opened page as io' do
32
- expected = File.read "#{WatirSpec.files}/forms_with_input_elements.html".sub("file://", '')
33
-
34
- browser.link(:name, /bad_attribute/).download.read.should == expected
35
- browser.link(:name, /bad_attribute/).should exist
36
- end
37
- end
38
-
39
- end
@@ -1,23 +0,0 @@
1
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
2
-
3
- describe "DefaultViewer" do
4
-
5
- before :all do
6
- browser.goto(WatirSpec.files + "/definition_lists.html")
7
- end
8
-
9
- describe ".save" do
10
- it "saves the default image to the given path" do
11
- fail("don't run specs with CelerityViewer") if browser.viewer != Celerity::DefaultViewer
12
- fname = File.expand_path "default_viewer_test.png"
13
- default = "#{File.dirname(__FILE__)}/../lib/celerity/resources/no_viewer.png"
14
-
15
- browser.viewer.save(fname)
16
- File.exist?(fname).should be_true
17
- File.read(fname).should == File.read(default)
18
-
19
- File.delete(fname)
20
- end
21
- end
22
- end
23
-
@@ -1,51 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "Element" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- describe "#identifier_string" do
11
- it "doesn't make the next locate find the wrong element" do
12
- elem = browser.div(:id, 'hidden_parent')
13
- elem.should exist
14
- def elem.public_identifier_string; identifier_string end # method is private
15
- elem.public_identifier_string
16
- elem.id.should == 'hidden_parent'
17
- end
18
- end
19
-
20
- describe "#method_missing" do
21
- it "magically returns the requested attribute if the attribute is defined in the attribute list" do
22
- browser.form(:index, 1).action.should == 'post_to_me'
23
- end
24
-
25
- it "raises NoMethodError if the requested method isn't among the attributes" do
26
- lambda { browser.button(:index, 1).no_such_attribute_or_method }.should raise_error(NoMethodError)
27
- end
28
- end
29
-
30
- describe "#xpath" do
31
- it "gets the canonical xpath of this element" do
32
- browser.text_field(:id, "new_user_email").xpath.should == '/html/body/form[1]/fieldset[1]/input[3]'
33
- end
34
- end
35
-
36
- describe "#javascript_object" do
37
- it "should return the JavaScript object representing the receiver" do
38
- obj = browser.div(:id, "onfocus_test").javascript_object
39
- obj.should be_kind_of(com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement)
40
- obj.should be_instance_of(com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDivElement)
41
- obj.client_width.should be_kind_of(Integer)
42
- end
43
- end
44
-
45
- describe "#locate" do
46
- it "raises ArgumentError when used with :object and the object given isn't an HtmlElement subclass" do
47
- lambda { Link.new(browser, :object, "foo").locate }.should raise_error(ArgumentError)
48
- end
49
- end
50
-
51
- end
@@ -1,18 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
3
-
4
- describe "FileField" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- describe "#set" do
11
- it "sends content as correct content type for common file types" do
12
- browser.file_field(:name, "new_user_portrait").set("foo.doc")
13
- obj = browser.file_field(:name, "new_user_portrait").locate
14
- obj.getContentType.should == "application/msword"
15
- end
16
- end
17
-
18
- end
@@ -1,56 +0,0 @@
1
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
2
-
3
- describe "HtmlUnit bugs" do
4
- describe "HtmlUnit bug 1968686: https://sourceforge.net/tracker/index.php?func=detail&aid=1968686&group_id=47038&atid=448266" do
5
- it "does not raise NativeException: java.lang.StackOverflowError when going to a page where Javascripts prints a <body> tag inside another <body> tag" do
6
- lambda { browser.goto(WatirSpec.files + "/bug_javascript_001.html") }.should_not raise_error(NativeException)
7
- end
8
- end
9
-
10
- describe "HtmlUnit bug 1968708: https://sourceforge.net/tracker/index.php?func=detail&aid=1968708&group_id=47038&atid=448266" do
11
- it "only considers the first attribute if there are duplicate attributes" do
12
- browser.goto(WatirSpec.files + "/bug_duplicate_attributes.html")
13
- browser.text_field(:index, 1).id.should == "org_id"
14
- end
15
- end
16
-
17
- describe "NekoHtml parser bug: https://sourceforge.net/tracker/?func=detail&aid=2824922&group_id=47038&atid=448266" do
18
- it "does not run out of java heap space" do
19
- lambda { browser.goto(WatirSpec.files + "/parser_bug_001.html") }.should_not raise_error
20
- end
21
- end
22
-
23
- # disabled for CI - need fix from HtmlUnit
24
- # describe "HtmlUnit bug XXXXXX" do
25
- # it "returns strings as UTF-8 when there's a charset mismatch between HTTP response header and <meta> tag" do
26
- # browser.goto(WatirSpec.host + "/charset_mismatch")
27
- # browser.h1(:index, 1).text.should == "\303\270"
28
- # end
29
- # end
30
-
31
- it "evaluates <script> tags injected in the DOM through JQuery's replaceWith() - fixed in rev. 3598" do
32
- browser.goto(WatirSpec.files + "/jquery.html")
33
- browser.link(:class, 'editLink').click
34
- browser.div(:id, 'content').text.should == "typeof update: function"
35
- end
36
-
37
- it "doesn't return the TinyMCE DOM when executing javascript functions" do
38
- b = WatirSpec.new_browser
39
-
40
- b.goto(WatirSpec.files + "/tiny_mce.html")
41
- b.text.should include("Beskrivelse")
42
- b.checkbox(:id, "exemption").set
43
- b.text.should include("Beskrivelse")
44
-
45
- b.close
46
- end
47
-
48
- describe "HtmlUnit bug 2811607: https://sourceforge.net/tracker/?func=detail&aid=2811607&group_id=47038&atid=448266" do
49
- it "correctly prevents default on <form>#submit()" do
50
- browser.goto(WatirSpec.files + "/prevent_form_submit.html")
51
- browser.button(:id, "next").click
52
- browser.title.should == "preventDefault() on form submission"
53
- end
54
- end
55
-
56
- end
@@ -1,24 +0,0 @@
1
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
2
-
3
- describe "Celerity.index_offset" do
4
-
5
- before :all do
6
- browser.goto(WatirSpec.files + "/non_control_elements.html")
7
-
8
- Celerity.index_offset = 0
9
- end
10
-
11
- it "returns the correct divs" do
12
- divs = browser.divs.to_a
13
-
14
- divs.each_with_index do |div, idx|
15
- browser.div(:index, idx).id.should == div.id
16
- end
17
- end
18
-
19
- after :all do
20
- Celerity.index_offset = 1
21
- end
22
-
23
- end
24
-
@@ -1,142 +0,0 @@
1
- require File.dirname(__FILE__) + '/watirspec/spec_helper'
2
-
3
- describe "Listener" do
4
- before(:each) do
5
- @web_client = mock("WebClient", :null_object => true)
6
- @listener = Celerity::Listener.new(@web_client)
7
- end
8
-
9
- it "implements the StatusHandler interface" do
10
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.StatusHandler)
11
-
12
- @listener.should respond_to(:statusMessageChanged)
13
- lambda { @listener.statusMessageChanged('page', 'message') }.should_not raise_error
14
- end
15
-
16
- it "implements the ConfirmHandler interface" do
17
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.ConfirmHandler)
18
-
19
- @listener.should respond_to(:handleConfirm)
20
- lambda { @listener.handleConfirm('page', 'message') }.should_not raise_error
21
- end
22
-
23
- it "implements the AttachmentHandler interface" do
24
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.attachment.AttachmentHandler)
25
-
26
- @listener.should respond_to(:handleAttachment)
27
- lambda { @listener.handleAttachment('page') }.should_not raise_error
28
- end
29
-
30
- it "implements the AlertHandler interface" do
31
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.AlertHandler)
32
-
33
- @listener.should respond_to(:handleAlert)
34
- lambda { @listener.handleAlert('page', 'message') }.should_not raise_error
35
- end
36
-
37
- it "implements the HTMLParserListener interface" do
38
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.html.HTMLParserListener)
39
-
40
- @listener.should respond_to(:error)
41
- @listener.should respond_to(:warning)
42
-
43
- lambda { @listener.error('message', 'url', 1, 2, "key") }.should_not raise_error
44
- lambda { @listener.warning('message', 'url', 1, 2, "key") }.should_not raise_error
45
- end
46
-
47
- it "implements the WebWindowListener interface" do
48
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.WebWindowListener)
49
-
50
- @listener.should respond_to(:webWindowClosed)
51
- @listener.should respond_to(:webWindowContentChanged)
52
- @listener.should respond_to(:webWindowOpened)
53
-
54
- lambda { @listener.webWindowClosed('event') }.should_not raise_error
55
- lambda { @listener.webWindowContentChanged('event') }.should_not raise_error
56
- lambda { @listener.webWindowOpened('event') }.should_not raise_error
57
- end
58
-
59
- it "implements the IncorrectnessListener interface" do
60
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.IncorrectnessListener)
61
-
62
- @listener.should respond_to(:notify)
63
- lambda { @listener.notify('message', 'origin') }.should_not raise_error
64
- end
65
-
66
- it "implements the PromptHandler interface" do
67
- @listener.should be_a_kind_of(com.gargoylesoftware.htmlunit.PromptHandler)
68
-
69
- @listener.should respond_to(:handlePrompt)
70
- lambda { @listener.handlePrompt('page', 'message') }.should_not raise_error
71
- end
72
-
73
-
74
- describe "#add_listener" do
75
- it "adds itself as a listener for the :status type" do
76
- @web_client.should_receive('setStatusHandler').with(@listener)
77
- @listener.add_listener(:status) {}
78
- end
79
-
80
- it "adds itself as a listener for the :alert type" do
81
- @web_client.should_receive('setAlertHandler').with(@listener)
82
- @listener.add_listener(:alert) {}
83
- end
84
-
85
- it "adds itself as a listener for the :confirm type" do
86
- @web_client.should_receive('setConfirmHandler').with(@listener)
87
- @listener.add_listener(:confirm) {}
88
- end
89
-
90
- it "adds itself as a listener for the :prompt type" do
91
- @web_client.should_receive('setPromptHandler').with(@listener)
92
- @listener.add_listener(:prompt) {}
93
- end
94
-
95
- it "adds itself as a listener for the :web_window_event type" do
96
- @web_client.should_receive('addWebWindowListener').with(@listener)
97
- @listener.add_listener(:web_window_event) {}
98
- end
99
-
100
- it "adds itself as a listener for the :html_parser type" do
101
- @web_client.should_receive('setHTMLParserListener').with(@listener)
102
- @listener.add_listener(:html_parser) {}
103
- end
104
-
105
- it "adds itself as a listener for the :incorrectness type" do
106
- @web_client.should_receive('setIncorrectnessListener').with(@listener)
107
- @listener.add_listener(:incorrectness) {}
108
- end
109
-
110
- it "adds itself as a listener for the :attachment type" do
111
- @web_client.should_receive('setAttachmentHandler').with(@listener)
112
- @listener.add_listener(:attachment) {}
113
- end
114
- end
115
-
116
- describe "#remove_listener" do
117
- it "removes the listener at the given index" do
118
- updates = []
119
- first, second = lambda { updates << :first }, lambda { updates << :second }
120
-
121
- @listener.add_listener(:prompt, &first)
122
- @listener.add_listener(:prompt, &second)
123
-
124
- @listener.remove_listener(:prompt, 0)
125
- @listener.handlePrompt('foo', 'bar')
126
- updates.should == [:second]
127
- end
128
- end
129
-
130
- it "handles several invocations of all registered listeners" do
131
- updates = []
132
- @listener.add_listener(:alert) { updates << :first }
133
- @listener.add_listener(:alert) { updates << :second }
134
-
135
- @listener.handleAlert('foo', 'bar')
136
- updates.should == [:first, :second]
137
-
138
- @listener.handleAlert('foo', 'bar')
139
- updates.should == [:first, :second, :first, :second]
140
- end
141
-
142
- end
@@ -1,8 +0,0 @@
1
- $:.unshift File.expand_path("#{File.dirname(__FILE__)}/../lib")
2
- require 'celerity'
3
-
4
- include Celerity
5
- include Celerity::Exception
6
- java.lang.System.setProperty("java.awt.headless", "true")
7
-
8
- WatirSpec.browser_args = [{ :log_level => $DEBUG ? :all : :off }]
@@ -1,43 +0,0 @@
1
- #desc 'Release the website and new gem version'
2
- #task :deploy => [:check_version, :website, :release] do
3
- # puts "Remember to create SVN tag:"
4
- # puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
- # "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
- # puts "Suggested comment:"
7
- # puts "Tagging release #{CHANGES}"
8
- #end
9
-
10
- desc 'Builds and installs gem locally'
11
- task :local_deploy => [:install_gem]
12
-
13
- #task :check_version do
14
- # unless ENV['VERSION']
15
- # puts 'Must pass a VERSION=x.y.z release version'
16
- # exit
17
- # end
18
- # unless ENV['VERSION'] == VERS
19
- # puts "Please update your version.rb to match the release version, currently #{VERS}"
20
- # exit
21
- # end
22
- #end
23
-
24
- #desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
- #task :install_gem_no_doc => [:clean, :package] do
26
- # sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
- #end
28
-
29
- namespace :manifest do
30
- desc 'Recreate Manifest.txt to include ALL files'
31
- task :refresh do
32
- `rake check_manifest | patch -p0 > Manifest.txt`
33
- end
34
- desc 'Create new Manifest.txt in diff format'
35
- task :new do
36
- manifest = File.new('Manifest.txt', 'w+')
37
- Dir.glob(File.join("**", "*")).each do |f|
38
- manifest.puts f
39
- end
40
- manifest.flush
41
- puts "####\n# Remember to edit Manifest.txt and remove unwanted file entries!\n####"
42
- end
43
- end
@@ -1,7 +0,0 @@
1
- task :ruby_env do
2
- RUBY_APP = if RUBY_PLATFORM =~ /java/
3
- "jruby"
4
- else
5
- "ruby"
6
- end unless defined? RUBY_APP
7
- end
@@ -1,43 +0,0 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'spec'
6
- end
7
-
8
- begin
9
- require 'spec/rake/spectask'
10
- rescue LoadError
11
- puts <<-EOS
12
- To use rspec for testing you must install rspec gem:
13
- gem install rspec
14
- EOS
15
- exit(0)
16
- end
17
-
18
-
19
- if File.exist?(path = "spec/watirspec/watirspec.rake")
20
- load path
21
- end
22
-
23
- namespace :watirspec do
24
- desc 'Initialize and fetch the watirspec submodule'
25
- task :init do
26
- sh "git submodule init"
27
- sh "git submodule update"
28
- end
29
- end
30
-
31
- desc "Run the specs under spec/"
32
- Spec::Rake::SpecTask.new do |t|
33
- t.spec_files = FileList['spec/**/*_spec.rb']
34
- # t.ruby_opts = %w[--headless] if RUBY_PLATFORM =~ /java/
35
-
36
- begin
37
- require 'rcov'
38
- t.rcov = true
39
- t.rcov_opts = ['--exclude', 'spec,fcntl,path_helper,yaml', '--no-rcovrt']
40
- rescue LoadError
41
- end
42
-
43
- end