lebowski 0.2.1 → 0.3.0
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.
- data/Gemfile +12 -0
- data/History.md +12 -1
- data/README.md +5 -5
- data/Rakefile +37 -19
- data/bin/lebowski +0 -1
- data/bin/lebowski-spec +5 -6
- data/lib/lebowski/foundation/core.rb +19 -0
- data/lib/lebowski/foundation/mixins/list_item_view_support.rb +10 -2
- data/lib/lebowski/foundation/mixins/user_actions.rb +101 -69
- data/lib/lebowski/foundation/proxy_object.rb +1 -20
- data/lib/lebowski/foundation/views/view.rb +10 -0
- data/lib/lebowski/{spec → rspec}/core.rb +1 -1
- data/lib/lebowski/{spec → rspec}/matchers/be.rb +2 -2
- data/lib/lebowski/{spec → rspec}/matchers/has.rb +2 -2
- data/lib/lebowski/{spec → rspec}/matchers/match_supporters/has_object_function.rb +3 -3
- data/lib/lebowski/{spec → rspec}/matchers/match_supporters/has_predicate_with_no_prefix.rb +1 -1
- data/lib/lebowski/{spec → rspec}/matchers/match_supporters/has_predicate_with_prefix_has.rb +1 -1
- data/lib/lebowski/{spec → rspec}/matchers/match_supporters/match_supporter.rb +1 -1
- data/lib/lebowski/{spec → rspec}/matchers/method_missing.rb +4 -4
- data/lib/lebowski/{spec → rspec}/operators/operator.rb +1 -1
- data/lib/lebowski/{spec → rspec}/operators/that.rb +10 -4
- data/lib/lebowski/{spec → rspec}/util.rb +1 -1
- data/lib/lebowski/rspec.rb +17 -0
- data/lib/lebowski/runtime/sprout_core_extensions.rb +58 -23
- data/lib/lebowski/version.rb +7 -7
- data/resources/README +1 -0
- data/resources/user-extensions.js +254 -20
- data/spec/spec_helper.rb +1 -0
- metadata +200 -106
- data/Manifest.txt +0 -93
- data/lib/lebowski/spec.rb +0 -17
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "selenium-client", "~> 1.2.18"
|
4
|
+
gem "rspec", "~> 2.1.0"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.5.1"
|
11
|
+
gem "rcov", ">= 0"
|
12
|
+
end
|
data/History.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# lebowski 0.3.0 December 6, 2010
|
2
|
+
|
3
|
+
* Updated to now work with Ruby 1.9.2 and RSpec v2
|
4
|
+
* Fixes drag and drop user actions
|
5
|
+
* Fixes clicking on segmented view's buttons
|
6
|
+
* Fixes mouse user actions so that, by default, DOM elements are clicked in the center instead of relative (0, 0)
|
7
|
+
* Fixes RSpec extension That operator's contains? method
|
8
|
+
* Note: If creating an instance of the Selenium client driver that you want to pass to Lebowski's
|
9
|
+
MainApplication, you must now supply the client with a timeout value or else you will immediately get a
|
10
|
+
timeout error (e.g. set :timeout_in_seconds => 60)
|
11
|
+
|
1
12
|
# lebowski 0.2.1 October 6, 2010
|
2
13
|
|
3
14
|
* Fixed MainApplication object's define_root_object method
|
@@ -21,6 +32,6 @@
|
|
21
32
|
* Updated the drag and drop user action so that you can specify mouse offsets
|
22
33
|
* Updated what values can be passed to the main application browser parameter. Can now supply string values and :chrome
|
23
34
|
|
24
|
-
# lebowski 0.1.1
|
35
|
+
# lebowski 0.1.1 June 7, 2010
|
25
36
|
|
26
37
|
* Open source beta release
|
data/README.md
CHANGED
@@ -32,13 +32,13 @@ in order to open up a browser, load your SproutCore application, and communicate
|
|
32
32
|
Knowledge of selenium server is not required to use the framework. (Note that the selenium server is
|
33
33
|
dependent on your system having the latest Java runtime installed).
|
34
34
|
|
35
|
-
The framework also comes with extensions to [RSpec](http://
|
35
|
+
The framework also comes with extensions to [RSpec](http://relishapp.com/rspec) that you can optionally use to
|
36
36
|
write your scripts, but RSpec is not required to use the Lebowski framework.
|
37
37
|
|
38
38
|
#Installing Lebowski
|
39
39
|
|
40
40
|
Installing the Lebowski framework is simple. First, make sure that you have the latest Ruby installed
|
41
|
-
on your machine (
|
41
|
+
on your machine (versions >= 1.9.2). Once you have Ruby installed, you can get the Lebowski framework
|
42
42
|
by invoking the following from your terminal:
|
43
43
|
|
44
44
|
$ gem install lebowski
|
@@ -48,8 +48,8 @@ Depending on the setup of your system you may have to call `gem1.9` and use the
|
|
48
48
|
If everything worked out you should have the lebowski gem installed on your computer. The framework is
|
49
49
|
dependent on two gems:
|
50
50
|
|
51
|
-
* selenium-client 1.2.18
|
52
|
-
* rspec 1.
|
51
|
+
* selenium-client, ~> 1.2.18
|
52
|
+
* rspec, ~> 2.1.0
|
53
53
|
|
54
54
|
For RSpec, it is only required if you plan on using the Lebowski's RSpec extensions.
|
55
55
|
|
@@ -68,7 +68,7 @@ you can grab the framework by doing the following:
|
|
68
68
|
|
69
69
|
$ gem install sproutcore
|
70
70
|
|
71
|
-
At this time, the Lebowski framework works with SproutCore v1.
|
71
|
+
At this time, the Lebowski framework works with SproutCore v1.4.x.
|
72
72
|
|
73
73
|
In addition to SproutCore, it is also advised that you, at minimum, have [Firefox](http://www.mozilla.com/en-US/firefox/personal.html)
|
74
74
|
installed on your system since that is the default browser used to run your SproutCore application using
|
data/Rakefile
CHANGED
@@ -1,29 +1,46 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
3
|
-
require 'hoe'
|
4
|
-
require 'fileutils'
|
5
|
-
require './lib/lebowski'
|
2
|
+
require 'bundler'
|
6
3
|
|
7
|
-
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
require './lib/lebowski/version.rb'
|
16
|
+
|
17
|
+
Jeweler::Tasks.new do |gem|
|
18
|
+
gem.name = 'lebowski'
|
19
|
+
gem.version = Lebowski::Version::STRING
|
20
|
+
gem.homepage = 'http://github.com/FrozenCanuck/Lebowski'
|
21
|
+
gem.license = 'MIT'
|
22
|
+
gem.summary = 'A test automation framework for SproutCore'
|
23
|
+
gem.description = <<-DESCRIPTION
|
13
24
|
|
14
|
-
Lebowski is a test automation framework designed for full feature, integration,
|
15
|
-
|
25
|
+
Lebowski is a test automation framework designed for full feature, integration, and
|
26
|
+
regression testing of SproutCore applications.
|
16
27
|
|
17
28
|
DESCRIPTION
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
29
|
+
gem.email = 'michael.lee.cohen@gmail.com'
|
30
|
+
gem.authors = ['Michael Cohen']
|
31
|
+
gem.add_dependency 'selenium-client', '~> 1.2.18'
|
32
|
+
gem.add_dependency 'rspec', '~> 2.1.0'
|
33
|
+
gem.add_development_dependency 'rspec', '~> 2.1.0'
|
34
|
+
gem.add_development_dependency 'bundler', '~> 1.0.0'
|
35
|
+
gem.add_development_dependency 'jeweler', '~> 1.5.1'
|
36
|
+
gem.add_development_dependency 'rcov', '>= 0'
|
37
|
+
gem.executables = ['lebowski', 'lebowski-spec', 'lebowski-start-server']
|
38
|
+
gem.files.exclude 'examples'
|
39
|
+
gem.test_files = []
|
40
|
+
gem.post_install_message = <<-POST_INSTALL_MESSAGE
|
24
41
|
#{'*'*50}
|
25
42
|
|
26
|
-
Thank you for installing lebowski-#{Lebowski::
|
43
|
+
Thank you for installing lebowski-#{Lebowski::Version::STRING}
|
27
44
|
|
28
45
|
Please be sure to read the README.md and History.md
|
29
46
|
for useful information on how to use this framework
|
@@ -37,4 +54,5 @@ DESCRIPTION
|
|
37
54
|
|
38
55
|
#{'*'*50}
|
39
56
|
POST_INSTALL_MESSAGE
|
40
|
-
end
|
57
|
+
end
|
58
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/bin/lebowski
CHANGED
data/bin/lebowski-spec
CHANGED
@@ -14,16 +14,15 @@ if ARGV.length == 0
|
|
14
14
|
exit
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
require 'spec/autorun'
|
17
|
+
gem 'rspec', "~> 2.1.0"
|
18
|
+
require 'rspec'
|
19
|
+
|
21
20
|
gem 'lebowski'
|
22
|
-
require 'lebowski/
|
21
|
+
require 'lebowski/rspec'
|
23
22
|
|
24
23
|
include Lebowski::Foundation
|
25
24
|
include Lebowski::Foundation::Views
|
26
25
|
include Lebowski::Foundation::Panes
|
27
26
|
include Lebowski::SCUI::Views
|
28
27
|
|
29
|
-
|
28
|
+
require 'rspec/autorun'
|
@@ -77,6 +77,25 @@ module Lebowski
|
|
77
77
|
def get_root_application_object()
|
78
78
|
return Util.get_root_application_object(self)
|
79
79
|
end
|
80
|
+
|
81
|
+
#
|
82
|
+
# Will return a string in camel case format for any value that follows the Ruby
|
83
|
+
# variable and method naming convention (e.g. my_variable_name). As an example:
|
84
|
+
#
|
85
|
+
# Util.to_camel_case(:some_long_name) # => "someLongName"
|
86
|
+
# Util.to_camel_case("function_foo_bar") # => "functionFooBar"
|
87
|
+
#
|
88
|
+
def self.to_camel_case(value)
|
89
|
+
camel_case_str = ""
|
90
|
+
word_counter = 1
|
91
|
+
words = value.to_s.split('_')
|
92
|
+
return words[0] if words.length == 1
|
93
|
+
words.each do |word|
|
94
|
+
camel_case_str << ((word_counter == 1) ? word : word.sub(/./) { |s| s.upcase })
|
95
|
+
word_counter = word_counter.next
|
96
|
+
end
|
97
|
+
return camel_case_str
|
98
|
+
end
|
80
99
|
|
81
100
|
end
|
82
101
|
|
@@ -23,11 +23,19 @@ module Lebowski
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def apply_drag_before(source)
|
26
|
-
|
26
|
+
params = {
|
27
|
+
:mouse_offset_x => :center,
|
28
|
+
:mouse_offset_y => :center
|
29
|
+
}
|
30
|
+
source.drag_to self, (self.width / 2).floor, 2, params
|
27
31
|
end
|
28
32
|
|
29
33
|
def apply_drag_after(source)
|
30
|
-
|
34
|
+
params = {
|
35
|
+
:mouse_offset_x => :center,
|
36
|
+
:mouse_offset_y => :center
|
37
|
+
}
|
38
|
+
source.drag_to self, (self.width / 2).floor, row_height - 2, params
|
31
39
|
end
|
32
40
|
|
33
41
|
def row_height()
|
@@ -16,11 +16,6 @@ module Lebowski
|
|
16
16
|
include KeyCheck
|
17
17
|
include StallSupport
|
18
18
|
|
19
|
-
def mouse_move()
|
20
|
-
@driver.sc_mouse_move action_target, *action_locator_args
|
21
|
-
stall :mouse_move
|
22
|
-
end
|
23
|
-
|
24
19
|
def mouse_move_at(x, y)
|
25
20
|
@driver.sc_mouse_move_at action_target, x, y, *action_locator_args
|
26
21
|
stall :mouse_move
|
@@ -36,20 +31,59 @@ module Lebowski
|
|
36
31
|
stall :mouse_down
|
37
32
|
end
|
38
33
|
|
34
|
+
def right_mouse_down_at(x, y)
|
35
|
+
@driver.sc_right_mouse_down_at action_target, x, y, *action_locator_args
|
36
|
+
stall :right_mouse_down
|
37
|
+
end
|
38
|
+
|
39
|
+
def right_mouse_up_at(x, y)
|
40
|
+
@driver.sc_right_mouse_up_at action_target, x, y, *action_locator_args
|
41
|
+
stall :right_mouse_up
|
42
|
+
end
|
43
|
+
|
44
|
+
def click_at(x, y)
|
45
|
+
mouse_down_at x, y
|
46
|
+
mouse_up_at x, y
|
47
|
+
stall :click
|
48
|
+
end
|
49
|
+
|
50
|
+
def right_click_at(x, y)
|
51
|
+
right_mouse_down_at x, y
|
52
|
+
right_mouse_up_at x, y
|
53
|
+
stall :right_click
|
54
|
+
end
|
55
|
+
|
56
|
+
def mouse_move()
|
57
|
+
@driver.sc_mouse_move action_target, *action_locator_args
|
58
|
+
stall :mouse_move
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Used to perform a mouse down on this view in the remote application
|
63
|
+
#
|
64
|
+
def mouse_down()
|
65
|
+
mouse_down_at :center, :center
|
66
|
+
end
|
67
|
+
|
39
68
|
#
|
40
69
|
# Used to perform a mouse up on this view in the remote application
|
41
70
|
#
|
42
71
|
def mouse_up()
|
43
|
-
|
44
|
-
stall :mouse_up
|
72
|
+
mouse_up_at :center, :center
|
45
73
|
end
|
46
74
|
|
47
75
|
#
|
48
|
-
# Used to perform a mouse down on this view in the remote application
|
76
|
+
# Used to perform a mouse down with right button on this view in the remote application
|
49
77
|
#
|
50
|
-
def
|
51
|
-
|
52
|
-
|
78
|
+
def right_mouse_down()
|
79
|
+
right_mouse_down_at :center, :center
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# Used to perform a mouse up with right button on this view in the remote application
|
84
|
+
#
|
85
|
+
def right_mouse_up()
|
86
|
+
right_mouse_up_at :center, :center
|
53
87
|
end
|
54
88
|
|
55
89
|
#
|
@@ -61,10 +95,13 @@ module Lebowski
|
|
61
95
|
stall :click
|
62
96
|
end
|
63
97
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
98
|
+
#
|
99
|
+
# Used to perform a single right click on this view in the remote application
|
100
|
+
#
|
101
|
+
def right_click()
|
102
|
+
right_mouse_down
|
103
|
+
right_mouse_up
|
104
|
+
stall :right_click
|
68
105
|
end
|
69
106
|
|
70
107
|
#
|
@@ -82,46 +119,21 @@ module Lebowski
|
|
82
119
|
@driver.sc_double_click action_target, *action_locator_args
|
83
120
|
stall :double_click
|
84
121
|
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# Used to perform a mouse up with right button on this view in the remote application
|
88
|
-
#
|
89
|
-
def right_mouse_up()
|
90
|
-
@driver.sc_right_mouse_up action_target, *action_locator_args
|
91
|
-
stall :right_mouse_up
|
92
|
-
end
|
93
122
|
|
94
123
|
#
|
95
|
-
# Used to perform a mouse
|
124
|
+
# Used to perform a mouse wheel action on the x-axis
|
96
125
|
#
|
97
|
-
def
|
98
|
-
@driver.
|
99
|
-
stall :
|
100
|
-
end
|
101
|
-
|
102
|
-
def right_mouse_up_at(x, y)
|
103
|
-
@driver.sc_right_mouse_up_at action_target, x, y, *action_locator_args
|
104
|
-
stall :right_mouse_up
|
105
|
-
end
|
106
|
-
|
107
|
-
def right_mouse_down_at(x, y)
|
108
|
-
@driver.sc_right_mouse_down_at action_target, x, y, *action_locator_args
|
109
|
-
stall :right_mouse_down
|
126
|
+
def mouse_wheel_delta_x(delta)
|
127
|
+
@driver.sc_mouse_wheel_delta_x action_target, delta, *action_locator_args
|
128
|
+
stall :mouse_wheel
|
110
129
|
end
|
111
130
|
|
112
131
|
#
|
113
|
-
# Used to perform a
|
132
|
+
# Used to perform a mouse wheel action on the y-axis
|
114
133
|
#
|
115
|
-
def
|
116
|
-
|
117
|
-
|
118
|
-
stall :right_click
|
119
|
-
end
|
120
|
-
|
121
|
-
def right_click_at(x, y)
|
122
|
-
right_mouse_down_at x, y
|
123
|
-
right_mouse_up_at x, y
|
124
|
-
stall :right_click
|
134
|
+
def mouse_wheel_delta_y(delta)
|
135
|
+
@driver.sc_mouse_wheel_delta_y action_target, delta, *action_locator_args
|
136
|
+
stall :mouse_wheel
|
125
137
|
end
|
126
138
|
|
127
139
|
#
|
@@ -206,33 +218,29 @@ module Lebowski
|
|
206
218
|
mouse_offset_y = get_mouse_offset(params[0][:mouse_offset_y], :y)
|
207
219
|
end
|
208
220
|
|
221
|
+
# First be sure to disable autoscrolling in the application. This needs
|
222
|
+
# to be done so that autoscrolling will not interfere with our drag
|
223
|
+
# and drop user action
|
224
|
+
@driver.sc_disable_all_autoscrolling
|
225
|
+
|
209
226
|
self.scroll_to_visible
|
227
|
+
|
210
228
|
mouse_down_at mouse_offset_x, mouse_offset_y
|
211
229
|
mouse_move_at mouse_offset_x, mouse_offset_y
|
212
|
-
|
230
|
+
|
231
|
+
# Make sure the element we are dragging relative to is visible
|
232
|
+
relative_to.scroll_to_visible if relative_to.kind_of? PositionedElement
|
213
233
|
|
214
|
-
|
215
|
-
|
234
|
+
rel_pos = relative_position(x, y, relative_to)
|
235
|
+
mouse_move_at rel_pos.x, rel_pos.y
|
216
236
|
|
217
|
-
|
218
|
-
|
219
|
-
rel_x = rel_x + position.x * -1
|
220
|
-
rel_y = rel_y + position.y * -1
|
221
|
-
if relative_to.kind_of? PositionedElement
|
222
|
-
position = relative_to.position
|
223
|
-
rel_x = rel_x + position.x
|
224
|
-
rel_y = rel_y + position.y
|
225
|
-
elsif relative_to == :window
|
226
|
-
else
|
227
|
-
raise ArgumentError.new "relative to source must be a positioned element: #{relative_to.class}"
|
228
|
-
end
|
229
|
-
end
|
237
|
+
rel_pos = relative_position(x, y, relative_to)
|
238
|
+
mouse_up_at rel_pos.x, rel_pos.y
|
230
239
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
mouse_up_at rel_x, rel_y
|
240
|
+
# Enable autoscrolling and mouse move events since we have completed the
|
241
|
+
# drag and drop operation
|
242
|
+
@driver.sc_enable_all_autoscrolling
|
243
|
+
@driver.sc_enable_mouse_move_event
|
236
244
|
|
237
245
|
stall :drag
|
238
246
|
end
|
@@ -303,6 +311,30 @@ module Lebowski
|
|
303
311
|
|
304
312
|
private
|
305
313
|
|
314
|
+
def relative_position(x, y, relative_to)
|
315
|
+
rel_x = 0
|
316
|
+
rel_y = 0
|
317
|
+
|
318
|
+
if not relative_to.nil?
|
319
|
+
position = self.position
|
320
|
+
rel_x += position.x * -1
|
321
|
+
rel_y += position.y * -1
|
322
|
+
if relative_to.kind_of? PositionedElement
|
323
|
+
position = relative_to.position
|
324
|
+
rel_x += position.x
|
325
|
+
rel_y += position.y
|
326
|
+
elsif relative_to == :window
|
327
|
+
else
|
328
|
+
raise ArgumentError.new "relative to source must be a positioned element: #{relative_to.class}"
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
rel_x += x
|
333
|
+
rel_y += y
|
334
|
+
|
335
|
+
return Lebowski::Coords.new rel_x, rel_y
|
336
|
+
end
|
337
|
+
|
306
338
|
def assert_is_collection_view(value, name)
|
307
339
|
if not value.kind_of? Lebowski::Foundation::Views::CollectionView
|
308
340
|
raise ArgumentInvalidTypeError.new name, value, Lebowski::Foundation::Views::CollectionView
|
@@ -449,7 +449,7 @@ module Lebowski
|
|
449
449
|
#
|
450
450
|
def method_missing(sym, *args, &block)
|
451
451
|
if (not sym.to_s =~ /\?$/) and (args.length == 0)
|
452
|
-
camel_case = to_camel_case(sym.to_s)
|
452
|
+
camel_case = Util.to_camel_case(sym.to_s)
|
453
453
|
return self[camel_case] if sc_path_defined?(camel_case)
|
454
454
|
end
|
455
455
|
super
|
@@ -648,25 +648,6 @@ module Lebowski
|
|
648
648
|
return value
|
649
649
|
end
|
650
650
|
|
651
|
-
#
|
652
|
-
# Will return a string in camel case format for any value that follows the Ruby
|
653
|
-
# variable and method naming convention (e.g. my_variable_name). As an example:
|
654
|
-
#
|
655
|
-
# Util.to_camel_case(:some_long_name) # => "someLongName"
|
656
|
-
# Util.to_camel_case("function_foo_bar") # => "functionFooBar"
|
657
|
-
#
|
658
|
-
def to_camel_case(value)
|
659
|
-
camel_case_str = ""
|
660
|
-
word_counter = 1
|
661
|
-
words = value.to_s.split('_')
|
662
|
-
return words[0] if words.length == 1
|
663
|
-
words.each do |word|
|
664
|
-
camel_case_str << ((word_counter == 1) ? word : word.sub(/./) { |s| s.upcase })
|
665
|
-
word_counter = word_counter.next
|
666
|
-
end
|
667
|
-
return camel_case_str
|
668
|
-
end
|
669
|
-
|
670
651
|
end
|
671
652
|
|
672
653
|
end
|
@@ -81,6 +81,16 @@ module Lebowski
|
|
81
81
|
@driver.sc_view_scroll_to_visible(abs_path)
|
82
82
|
end
|
83
83
|
|
84
|
+
#
|
85
|
+
# Gets the parent view of this view that is scrollable. If this view
|
86
|
+
# has no parent that is scrollable then null is returned
|
87
|
+
#
|
88
|
+
def scrollable_parent_view()
|
89
|
+
layer_id = @driver.get_sc_scrollable_parent_view_layer_id(abs_path)
|
90
|
+
app = Util::get_root_application_object(self)
|
91
|
+
return app["##{layer_id}"] if (not layer_id.nil?)
|
92
|
+
end
|
93
|
+
|
84
94
|
#
|
85
95
|
# Gets the string representing of the view's layer. The layer in SproutCore is
|
86
96
|
# the root DOM element of the view. This method will return an HTML string
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# myobject.should exist_in_app => myobject.exists? == true
|
14
14
|
# myobject.should_not exist_in_app => myobject.exists? == false
|
15
15
|
#
|
16
|
-
|
16
|
+
RSpec::Matchers.define :exist_in_app do
|
17
17
|
match do |object|
|
18
18
|
object.exists?
|
19
19
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# ==========================================================================
|
5
5
|
|
6
6
|
module Lebowski
|
7
|
-
module
|
7
|
+
module RSpec
|
8
8
|
module Matchers
|
9
9
|
|
10
10
|
#
|
@@ -24,7 +24,7 @@ module Lebowski
|
|
24
24
|
# to try custom patterns before ultimately applying the default pattern
|
25
25
|
# checks
|
26
26
|
#
|
27
|
-
class Be < ::
|
27
|
+
class Be < ::RSpec::Matchers::BePredicate
|
28
28
|
|
29
29
|
def matches?(actual)
|
30
30
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# ==========================================================================
|
5
5
|
|
6
6
|
module Lebowski
|
7
|
-
module
|
7
|
+
module RSpec
|
8
8
|
module Matchers
|
9
9
|
|
10
10
|
#
|
@@ -17,7 +17,7 @@ module Lebowski
|
|
17
17
|
# to include custom pattern checks that are used before the default pattern
|
18
18
|
# checks are performed.
|
19
19
|
#
|
20
|
-
class Has < ::
|
20
|
+
class Has < ::RSpec::Matchers::Has
|
21
21
|
|
22
22
|
def matches?(actual)
|
23
23
|
support = HasPredicateWithPrefixHas.new(actual, @expected, *@args)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# ==========================================================================
|
5
5
|
|
6
6
|
module Lebowski
|
7
|
-
module
|
7
|
+
module RSpec
|
8
8
|
module Matchers
|
9
9
|
|
10
10
|
class HasObjectFunction < MatchSupporter
|
@@ -46,12 +46,12 @@ module Lebowski
|
|
46
46
|
return false if not invoked_method
|
47
47
|
|
48
48
|
operator = @args[@args.length - 1]
|
49
|
-
if operator.kind_of? Lebowski::
|
49
|
+
if operator.kind_of? Lebowski::RSpec::Operators::Operator
|
50
50
|
@result = operator.evaluate(ret_val)
|
51
51
|
return true
|
52
52
|
end
|
53
53
|
|
54
|
-
@result = Lebowski::
|
54
|
+
@result = Lebowski::RSpec::Util.match?(@args[@args.length - 1], ret_val)
|
55
55
|
|
56
56
|
return true
|
57
57
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# License: Licensed under MIT license (see License.txt)
|
4
4
|
# ==========================================================================
|
5
5
|
|
6
|
-
module
|
6
|
+
module RSpec
|
7
7
|
module Matchers
|
8
8
|
|
9
9
|
#
|
@@ -20,9 +20,9 @@ module Spec
|
|
20
20
|
# is a private method on Ruby objects and will cause the Be and Has
|
21
21
|
# matches to fail.
|
22
22
|
#
|
23
|
-
return Lebowski::
|
24
|
-
return Lebowski::
|
25
|
-
return Lebowski::
|
23
|
+
return Lebowski::RSpec::Matchers::Be.new(sym, *args) if sym.to_s =~ /^be_/
|
24
|
+
return Lebowski::RSpec::Matchers::Has.new(sym, *args) if sym.to_s =~ /^have_/
|
25
|
+
return Lebowski::RSpec::Operators::That.new(sym, *args) if sym.to_s =~ /^that_/
|
26
26
|
super
|
27
27
|
end
|
28
28
|
end
|