rwebspec-webdriver 0.3.7 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -69,7 +69,7 @@ end
69
69
  spec = Gem::Specification.new do |s|
70
70
  s.platform= Gem::Platform::RUBY
71
71
  s.name = "rwebspec-webdriver"
72
- s.version = "0.3.7"
72
+ s.version = "0.4"
73
73
  s.summary = "Executable functional specification for web applications in RSpec syntax and Selenium-WebDriver"
74
74
  # s.description = ""
75
75
 
@@ -88,9 +88,10 @@ spec = Gem::Specification.new do |s|
88
88
  s.files = s.files + Dir.glob( "test/**/*" )
89
89
  s.files = s.files + Dir.glob( "sample/**/*")
90
90
  s.files = s.files + Dir.glob( "docs/**/*" )
91
- s.add_dependency(%q<rspec>, ["= 1.1.12"])
91
+ s.add_dependency(%q<rspec>, [">= 2.10"])
92
+ s.add_dependency(%q<rspec-core>, [">= 2.10.1"])
92
93
  s.add_dependency("selenium-webdriver", ">= 2.0.1")
93
- s.add_dependency("sanitize", ">= 2.0.0")
94
+ # s.add_dependency("sanitize", ">= 2.0.0")
94
95
  end
95
96
 
96
97
  Rake::GemPackageTask.new(spec) do |pkg|
@@ -1,51 +1,28 @@
1
- module Spec
2
- module Extensions
3
- module Main
4
1
 
5
- alias :spec :describe
6
- alias :specification :describe
7
- alias :test_suite :describe
8
- alias :suite :describe
9
-
10
- end
11
- end
2
+ module RSpec
3
+ module Core
4
+ module DSL
5
+ alias_method :specification, :describe
6
+ alias_method :test_suite, :describe
7
+ end
8
+ end
12
9
  end
13
10
 
14
- # For RSpec 1.1.12
15
- module Spec
16
- module DSL
17
- module Main
11
+ module RSpec
12
+ module Core
13
+ class ExampleGroup
18
14
 
19
- alias :spec :describe
20
- alias :specification :describe
21
- alias :test_suite :describe
22
- alias :suite :describe
15
+ define_example_method :scenario
16
+ define_example_method :story
17
+ define_example_method :test_case
18
+ define_example_method :use_case
19
+ define_example_method :test
23
20
 
24
- end
25
- end
26
- end
27
-
28
- # ZZ patches to RSpec 1.1.4
29
- # - add to_s method to example_group
30
- module Spec
31
- module Example
32
- class ExampleGroup
33
- def to_s
34
- @_defined_description
21
+ class << self
22
+ alias_method :specification, :describe
23
+ alias_method :test_suite, :describe
35
24
  end
36
- end
37
- end
38
- end
39
-
40
- module Spec
41
- module Example
42
- module ExampleGroupMethods
43
25
 
44
- alias_method :scenario, :it
45
- alias_method :story, :it
46
- alias_method :test_case, :it
47
- alias_method :use_case, :it
48
- alias_method :test, :it
49
26
  end
50
27
  end
51
28
  end
@@ -13,11 +13,11 @@ rescue LoadError => no_as1_err
13
13
  # active_support 2.0 loaded error
14
14
  end
15
15
  require 'active_support/core_ext'
16
- require 'spec'
16
+ require 'rspec'
17
17
  require 'selenium-webdriver'
18
18
 
19
19
  unless defined? RWEBSPEC_WEBDRIVER_VERSION
20
- RWEBSPEC_WEBDRIVER_VERSION = "0.3.7"
20
+ RWEBSPEC_WEBDRIVER_VERSION = "0.4"
21
21
  end
22
22
 
23
23
 
@@ -9,7 +9,6 @@ rescue LoadError => e
9
9
  raise "You have must at least WebDriver installed"
10
10
  end
11
11
 
12
- require 'sanitize'
13
12
  require File.join(File.dirname(__FILE__), "element_locator.rb")
14
13
 
15
14
  module RWebSpec
@@ -244,19 +243,24 @@ module RWebSpec
244
243
  @browser.title
245
244
  end
246
245
 
247
- #TODO return plain text of current web page
248
246
  def text(squeeze_spaces = true)
247
+ @browser.find_element(:tag_name, "body").text
248
+ end
249
+
250
+ # @deprecated
251
+ def text_with_sanitize
249
252
  begin
253
+ require 'sanitize'
250
254
  page_text_string = Sanitize.clean(html)
251
- page_text_string = page_text_string.squeeze(" ") if squeeze_spaces# remove duplicated (spaces)
255
+ page_text_string = page_text_string.squeeze(" ") if squeeze_spaces
256
+ # remove duplicated (spaces)
252
257
  return page_text_string
253
258
  rescue => e
254
- @browser.find_element(:tag_name, "body").text
255
- # puts "failed to santize html source => text, #{e}"
259
+ puts "failed to santize html source => text, #{e}"
260
+ return @browser.html
256
261
  end
257
- # @browser.text
258
- end
259
-
262
+ end
263
+
260
264
  [:images, :links, :buttons, :select_lists, :checkboxes, :radios, :text_fields, :divs, :dls, :dds, :dts, :ems, :lis, :maps, :spans, :strongs, :ps, :pres, :labels].each do |method|
261
265
  define_method method do
262
266
  @browser.send(method)
metadata CHANGED
@@ -4,9 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 3
8
- - 7
9
- version: 0.3.7
7
+ - 4
8
+ version: "0.4"
10
9
  platform: ruby
11
10
  authors:
12
11
  - Zhimin Zhan
@@ -14,7 +13,7 @@ autorequire: rwebspec-webdriver
14
13
  bindir: bin
15
14
  cert_chain: []
16
15
 
17
- date: 2012-05-06 00:00:00 +10:00
16
+ date: 2012-05-28 00:00:00 +10:00
18
17
  default_executable:
19
18
  dependencies:
20
19
  - !ruby/object:Gem::Dependency
@@ -22,17 +21,16 @@ dependencies:
22
21
  prerelease: false
23
22
  requirement: &id001 !ruby/object:Gem::Requirement
24
23
  requirements:
25
- - - "="
24
+ - - ">="
26
25
  - !ruby/object:Gem::Version
27
26
  segments:
28
- - 1
29
- - 1
30
- - 12
31
- version: 1.1.12
27
+ - 2
28
+ - 10
29
+ version: "2.10"
32
30
  type: :runtime
33
31
  version_requirements: *id001
34
32
  - !ruby/object:Gem::Dependency
35
- name: selenium-webdriver
33
+ name: rspec-core
36
34
  prerelease: false
37
35
  requirement: &id002 !ruby/object:Gem::Requirement
38
36
  requirements:
@@ -40,13 +38,13 @@ dependencies:
40
38
  - !ruby/object:Gem::Version
41
39
  segments:
42
40
  - 2
43
- - 0
41
+ - 10
44
42
  - 1
45
- version: 2.0.1
43
+ version: 2.10.1
46
44
  type: :runtime
47
45
  version_requirements: *id002
48
46
  - !ruby/object:Gem::Dependency
49
- name: sanitize
47
+ name: selenium-webdriver
50
48
  prerelease: false
51
49
  requirement: &id003 !ruby/object:Gem::Requirement
52
50
  requirements:
@@ -55,8 +53,8 @@ dependencies:
55
53
  segments:
56
54
  - 2
57
55
  - 0
58
- - 0
59
- version: 2.0.0
56
+ - 1
57
+ version: 2.0.1
60
58
  type: :runtime
61
59
  version_requirements: *id003
62
60
  description: