rwebspec 5.3.0 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 513ae7f9cc41b82561318ede7fea7d155aae5a28
4
- data.tar.gz: 2a9cb1472e93d9606709a65dbc7cc064cf853ac2
3
+ metadata.gz: 2101fdc5d2386755b2a83bc4af0ca3222e72cadd
4
+ data.tar.gz: 6058c6433d0801b39b31a0575047ac8c3eccb655
5
5
  SHA512:
6
- metadata.gz: 2b96d1d849fc81b400a28d6e5abe79f00dcf29cb11b5f623dab6c1fbac6c5843a4820a73a4f360f789c983c1e27f8280260758e5c06775e4f5448dfc3c8ec9c1
7
- data.tar.gz: 4cf582825f126a6e92340403c279849e1d6d2176c9cfb8988c4419ffa7f030fb4f45f02d5f070c9473966ff36ca92121db0850f6fcbff32de5fbd6e2a405a1e5
6
+ metadata.gz: d72abc7d2068ee43f8f9eaad950c661bee1e23da55c76ed65266070b7988694e8cc2e5214923b197640977972e716e06a272ab2df12e6793c6ccbdfef9bfce2d
7
+ data.tar.gz: a7c10730c9f906674b8cd50bd926db394240b668905bc4e5d98968f967098fcd9f80eb0bce11c22478c851453a7d6487fb290d2dec19b9cd34cca154ca3391fe
data/CHANGELOG CHANGED
@@ -1,12 +1,26 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 6.0
5
+ [Feature] Support RSpec 3
6
+ [Feature] Default to use RSpec 3 recommend expect syntax
7
+ [Feature] Drop MiniTest (and its workaround), use own assert method
8
+ [Deprecated] Drop "test_suite" and "specification", use stand RSpec's describe to group test cases.
9
+ [Deprecated]
10
+ alias try_upto try_for
11
+ alias try_up_to try_for
12
+ alias try_until try_for
13
+ [Deprecated]
14
+ try, use try_for
15
+ [Deprecated]
16
+ repeated_try, use try_for
17
+ [Update] ContainsText matcher for RSpec 3
18
+
4
19
  5.3.0
5
20
  [New] Lock on RSpec 2.14
6
21
  [New] Support ActiveSupport 4
7
22
  [New] Part support of RSpec to use :should syntax
8
23
 
9
-
10
24
  5.2.1
11
25
  [Fixes] add assertions attribute to RWebSpec::AbstractWebPage to support MiniTest 5
12
26
  (for non-rwebspec projects, users need to handle themselves)
data/Rakefile CHANGED
@@ -77,7 +77,7 @@ end
77
77
  spec = Gem::Specification.new do |s|
78
78
  s.platform= Gem::Platform::RUBY
79
79
  s.name = "rwebspec"
80
- s.version = "5.3.0"
80
+ s.version = "6.0.1"
81
81
  s.summary = "Web application functional specification in Ruby"
82
82
  s.description = "Executable functional specification for web applications in RSpec syntax with Watir or Selenium WebDriver"
83
83
 
@@ -97,19 +97,20 @@ spec = Gem::Specification.new do |s|
97
97
  s.files = s.files + Dir.glob( "test/**/*" )
98
98
  s.files = s.files + Dir.glob( "sample/**/*")
99
99
  s.files = s.files + Dir.glob( "docs/**/*" )
100
- s.add_dependency(%q<rspec>, ["~> 2.14"])
101
- s.add_dependency(%q<rspec-core>, ["~> 2.14"])
102
- s.add_dependency(%q<rspec-mocks>, ["~> 2.14"])
103
- s.add_dependency(%q<rspec-expectations>, ["~> 2.14"])
104
- s.add_dependency("commonwatir", ">= 4.0.0")
105
- s.add_dependency("minitest", ">= 4.0")
100
+
101
+ s.add_dependency(%q<rspec>, ["~> 3.0"])
102
+ s.add_dependency(%q<rspec-core>, ["~> 3.0"])
103
+ s.add_dependency(%q<rspec-mocks>, ["~> 3.0"])
104
+ s.add_dependency(%q<rspec-expectations>, ["~> 3.0"])
105
+ s.add_dependency("commonwatir", "~> 4.0.0")
106
+
106
107
  s.add_dependency("activesupport", ">= 3.2.17")
107
108
  # s.add_dependency("ci_reporter", "~> 1.9.2")
108
109
 
109
110
  unless RUBY_PLATFORM =~ /mingw/
110
- s.add_dependency("selenium-webdriver", ">= 2.40")
111
+ s.add_dependency("selenium-webdriver", "~> 2.42")
111
112
  else
112
- s.add_dependency("watir-classic", ">= 4.0.0")
113
+ s.add_dependency("watir-classic", "~> 4.0.1")
113
114
  end
114
115
  end
115
116
 
@@ -1,4 +1,8 @@
1
1
 
2
+ =begin
3
+
4
+ # Deprecated for RSpec 3
5
+
2
6
  module RSpec
3
7
  module Core
4
8
  module DSL
@@ -8,11 +12,14 @@ module RSpec
8
12
  end
9
13
  end
10
14
 
15
+ =end
16
+
11
17
  module RSpec
12
18
  module Core
13
19
  class ExampleGroup
14
20
 
15
21
  class << self
22
+ # the following might not be used
16
23
  alias_method :specification, :describe
17
24
  alias_method :test_suite, :describe
18
25
 
@@ -1,8 +1,22 @@
1
1
 
2
2
  module RWebSpec
3
3
  module Assert
4
- include ::MiniTest::Assertions
5
-
4
+
5
+ # own assert method
6
+ def assert test, msg = nil
7
+ msg ||= "Failed assertion, no message given."
8
+ # comment out self.assertions += 1 to counting assertions
9
+ unless test then
10
+ msg = msg.call if Proc === msg
11
+ raise RWebSpec::Assertion, msg
12
+ end
13
+ true
14
+ end
15
+
16
+ def fail(message)
17
+ perform_assertion { assert(false, message) }
18
+ end
19
+
6
20
  def assert_not(condition, msg = "")
7
21
  perform_assertion { assert(!condition, msg) }
8
22
  end
@@ -11,11 +25,6 @@ module RWebSpec
11
25
  perform_assertion { assert(!actual.nil?, msg) }
12
26
  end
13
27
 
14
- def fail(message)
15
- perform_assertion { assert(false, message) }
16
- end
17
-
18
- # assertions
19
28
  def assert_title_equals(title)
20
29
  assert_equals(title, @web_browser.page_title)
21
30
  end
@@ -6,6 +6,13 @@
6
6
  # useful hekoer methods for testing
7
7
  #
8
8
  module RWebSpec
9
+
10
+ class Assertion < Exception
11
+ def error
12
+ self
13
+ end
14
+ end
15
+
9
16
  module Core
10
17
 
11
18
  # open a browser, and set base_url via hash, but does not acually
@@ -122,8 +129,12 @@ module RWebSpec
122
129
  yield
123
130
  last_error = nil
124
131
  return true
125
- rescue MiniTest::Assertion => e1
132
+ rescue RWebSpec::Assertion => e1
126
133
  last_error = e1
134
+ rescue ArgumentError => ae
135
+ last_error = ae
136
+ rescue RSpec::Expectations::ExpectationNotMetError => ree
137
+ last_error = ree
127
138
  rescue => e
128
139
  last_error = e
129
140
  end
@@ -134,18 +145,20 @@ module RWebSpec
134
145
  raise "Timeout after #{duration.to_i} seconds."
135
146
  end
136
147
 
137
- alias try_upto try_for
138
- alias try_up_to try_for
139
- alias try_until try_for
140
-
148
+ # Deprecated
149
+ # alias try_upto try_for
150
+ # alias try_up_to try_for
151
+ # alias try_until try_for
152
+ =begin
141
153
  def try(timeout = $testwise_polling_timeout, polling_interval = $testwise_polling_interval || 1, &block)
142
154
  puts "Warning: method 'try' is deprecated (won't support in RWebSpec 3), use try_for instead."
143
155
  try_for(timeout, polling_interval) {
144
156
  yield
145
157
  }
146
158
  end
159
+ =end
147
160
 
148
-
161
+ =begin
149
162
  # Try the operation up to specified times, and sleep given interval (in seconds)
150
163
  # Error will be ignored until timeout
151
164
  # Example
@@ -171,6 +184,7 @@ module RWebSpec
171
184
  end
172
185
  yield
173
186
  end
187
+ =end
174
188
 
175
189
 
176
190
  ##
@@ -240,6 +254,9 @@ module RWebSpec
240
254
  def failsafe(& block)
241
255
  begin
242
256
  yield
257
+ rescue RWebSpec::Assertion => e1
258
+ rescue ArgumentError => ae
259
+ rescue RSpec::Expectations::ExpectationNotMetError => ree
243
260
  rescue =>e
244
261
  end
245
262
  end
@@ -23,10 +23,13 @@ class ContainsText
23
23
  end
24
24
 
25
25
  # error message for should_not
26
- def negative_failure_message
26
+ def failure_message_when_negated
27
27
  "expected '#{actual_text}' not to contain '#{@expected}', but it did"
28
28
  end
29
29
 
30
+ # RSpec 2 compatibility:
31
+ alias_method :failure_message_for_should, :failure_message
32
+ alias_method :failure_message_for_should_not, :failure_message_when_negated
30
33
  end
31
34
 
32
35
 
@@ -35,3 +38,6 @@ def contains_text?(expected)
35
38
  ContainsText.new(expected)
36
39
  end
37
40
  alias contains? contains_text?
41
+ alias contains contains_text?
42
+ alias contain? contains_text?
43
+ alias contain contains_text?
@@ -33,10 +33,8 @@ module RWebSpec
33
33
  # browser: passed to do assertion within the page
34
34
  # page_text: text used to identify the page, title will be the first candidate
35
35
  attr_accessor :page_specific_text
36
- attr_accessor :assertions # for MiniTest 5: https://github.com/seattlerb/minitest/issues/286
37
36
 
38
37
  def initialize(the_browser, page_specific_text = nil)
39
- self.assertions = 0 # MiniTest 5
40
38
 
41
39
  @web_browser = @browser = @web_tester = the_browser
42
40
  @page_specific_text = page_specific_text
@@ -255,6 +255,7 @@ module RWebSpec
255
255
  @browser.find_element(:tag_name, "body").text
256
256
  end
257
257
 
258
+ =begin
258
259
  # @deprecated
259
260
  def text_with_sanitize
260
261
  begin
@@ -268,6 +269,7 @@ module RWebSpec
268
269
  return @browser.html
269
270
  end
270
271
  end
272
+ =end
271
273
 
272
274
  # :links => removed
273
275
  # :checkboxes => removed
@@ -718,21 +720,7 @@ module RWebSpec
718
720
  # http://wiki.openqa.org/display/WTR/FAQ#FAQ-HowdoIattachtoapopupwindow%3F
719
721
  #
720
722
  def start_clicker(button, waitTime= 9, user_input=nil)
721
- # get a handle if one exists
722
- hwnd = @browser.enabled_popup(waitTime)
723
- if (hwnd) # yes there is a popup
724
- w = WinClicker.new
725
- if (user_input)
726
- w.setTextValueForFileNameField(hwnd, "#{user_input}")
727
- end
728
- # I put this in to see the text being input it is not necessary to work
729
- sleep 3
730
- # "OK" or whatever the name on the button is
731
- w.clickWindowsButton_hwnd(hwnd, "#{button}")
732
- #
733
- # this is just cleanup
734
- w = nil
735
- end
723
+ raise "Not support when using Selenium WebDriver, try alternative approach."
736
724
  end
737
725
 
738
726
  # return underlying browser
data/lib/rwebspec.rb CHANGED
@@ -8,8 +8,12 @@ gem "activesupport" #, "~> 3.2.17"
8
8
  require 'active_support'
9
9
  require 'active_support/deprecation'
10
10
 
11
- gem "minitest" #, "~> 4.0" # ver 5 return errors
12
- require 'minitest/autorun'
11
+ # Using own assert
12
+ #
13
+ # if user want to use testing library such as MiniTest, add require in your own helper and tests
14
+ #
15
+ # gem "minitest" #, "~> 4.0" # ver 5 return errors
16
+ # require 'minitest/autorun'
13
17
 
14
18
  # Load active_support, so that we can use 1.days.ago
15
19
  begin
@@ -31,7 +35,7 @@ if ::RSpec::Version::STRING && ::RSpec::Version::STRING =~ /^3/
31
35
  end
32
36
 
33
37
  unless defined? RWEBSPEC_VERSION
34
- RWEBSPEC_VERSION = RWEBUNIT_VERSION = "5.3.0"
38
+ RWEBSPEC_VERSION = RWEBUNIT_VERSION = "6.0.1"
35
39
  end
36
40
 
37
41
  $testwise_polling_interval = 1 # seconds
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwebspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zhimin Zhan
8
8
  autorequire: rwebspec
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-10 00:00:00.000000000 Z
11
+ date: 2014-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,84 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.14'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.14'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.14'
33
+ version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.14'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-mocks
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.14'
47
+ version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.14'
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-expectations
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.14'
61
+ version: '3.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.14'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: commonwatir
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 4.0.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 4.0.0
83
- - !ruby/object:Gem::Dependency
84
- name: minitest
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '4.0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '4.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: activesupport
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -112,16 +98,16 @@ dependencies:
112
98
  name: selenium-webdriver
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - ">="
101
+ - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '2.40'
103
+ version: '2.42'
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
- - - ">="
108
+ - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '2.40'
110
+ version: '2.42'
125
111
  description: Executable functional specification for web applications in RSpec syntax
126
112
  with Watir or Selenium WebDriver
127
113
  email: zhimin@agileway.com.au