kookaburra 0.21.1 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -2
- data/README.markdown +19 -19
- data/VERSION +1 -1
- data/kookaburra.gemspec +7 -7
- data/lib/kookaburra/api_driver.rb +5 -8
- data/lib/kookaburra/assertion.rb +24 -0
- data/lib/kookaburra/configuration.rb +70 -0
- data/lib/kookaburra/dependency_accessor.rb +4 -1
- data/lib/kookaburra/given_driver.rb +13 -26
- data/lib/kookaburra/json_api_driver.rb +5 -4
- data/lib/kookaburra/test_helpers.rb +18 -17
- data/lib/kookaburra/ui_driver/ui_component/address_bar.rb +23 -0
- data/lib/kookaburra/ui_driver/ui_component.rb +19 -63
- data/lib/kookaburra/ui_driver.rb +17 -21
- data/lib/kookaburra.rb +29 -50
- data/spec/integration/test_a_rack_application_spec.rb +34 -30
- data/spec/kookaburra/api_driver_spec.rb +6 -4
- data/spec/kookaburra/configuration_spec.rb +18 -0
- data/spec/kookaburra/json_api_driver_spec.rb +12 -8
- data/spec/kookaburra/ui_driver/ui_component/address_bar_spec.rb +32 -0
- data/spec/kookaburra/ui_driver/ui_component_spec.rb +30 -64
- data/spec/kookaburra/ui_driver_spec.rb +7 -12
- data/spec/kookaburra_spec.rb +33 -29
- data/spec/support/shared_examples/it_can_make_assertions.rb +12 -0
- data/spec/support/shared_examples/it_has_a_dependency_accessor.rb +6 -9
- metadata +30 -41
- data/lib/kookaburra/null_browser.rb +0 -15
- data/spec/kookaburra/null_browser_spec.rb +0 -15
- data/spec/kookaburra/test_helpers_spec.rb +0 -48
data/spec/kookaburra_spec.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
require 'kookaburra'
|
2
2
|
|
3
3
|
describe Kookaburra do
|
4
|
+
let(:configuration) {
|
5
|
+
OpenStruct.new
|
6
|
+
}
|
7
|
+
|
8
|
+
let(:k) { Kookaburra.new(configuration) }
|
9
|
+
|
4
10
|
describe '#given' do
|
5
11
|
it 'returns an instance of the configured GivenDriver' do
|
6
12
|
my_given_driver_class = mock(Class)
|
7
|
-
my_given_driver_class.should_receive(:new)
|
8
|
-
|
9
|
-
:a_given_driver
|
10
|
-
|
11
|
-
|
12
|
-
k = Kookaburra.new(:given_driver_class => my_given_driver_class)
|
13
|
+
my_given_driver_class.should_receive(:new) \
|
14
|
+
.with(configuration) \
|
15
|
+
.and_return(:a_given_driver)
|
16
|
+
configuration.stub!(:given_driver_class => my_given_driver_class)
|
13
17
|
k.given.should == :a_given_driver
|
14
18
|
end
|
15
19
|
end
|
@@ -17,51 +21,51 @@ describe Kookaburra do
|
|
17
21
|
describe '#ui' do
|
18
22
|
it 'returns an instance of the configured UIDriver' do
|
19
23
|
my_ui_driver_class = mock(Class)
|
20
|
-
my_ui_driver_class.should_receive(:new)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
k = Kookaburra.new(:ui_driver_class => my_ui_driver_class,
|
26
|
-
:browser => :a_browser,
|
27
|
-
:server_error_detection => :server_error_detection)
|
24
|
+
my_ui_driver_class.should_receive(:new) \
|
25
|
+
.with(configuration) \
|
26
|
+
.and_return(:a_ui_driver)
|
27
|
+
configuration.stub!(:ui_driver_class => my_ui_driver_class)
|
28
28
|
k.ui.should == :a_ui_driver
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '#get_data' do
|
33
33
|
it 'returns a equivalent copy of the test data collection specified' do
|
34
|
-
k = Kookaburra.new
|
35
34
|
foos = {:spam => 'ham'}
|
36
|
-
mental_model
|
37
|
-
k.stub!(:mental_model => mental_model)
|
35
|
+
configuration.stub!(:mental_model => stub(:foos => foos))
|
38
36
|
k.get_data(:foos).should == foos
|
39
37
|
end
|
40
38
|
|
41
39
|
it 'does not return the same object that is the test data collection' do
|
42
|
-
k = Kookaburra.new
|
43
40
|
k.get_data(:foos).should_not === k.get_data(:foos)
|
44
41
|
end
|
45
42
|
|
46
43
|
it 'returns a frozen object' do
|
47
|
-
k = Kookaburra.new
|
48
44
|
k.get_data(:foos).should be_frozen
|
49
45
|
end
|
50
46
|
end
|
51
47
|
|
52
48
|
describe '.configuration' do
|
53
|
-
it 'returns
|
54
|
-
|
55
|
-
old_config = Kookaburra.configuration
|
56
|
-
Kookaburra.configuration = :test_configuration
|
57
|
-
Kookaburra.configuration.should == :test_configuration
|
58
|
-
ensure
|
59
|
-
Kookaburra.configuration = old_config
|
60
|
-
end
|
49
|
+
it 'returns a Kookaburra::Configuration instance' do
|
50
|
+
Kookaburra.configuration.should be_kind_of(Kookaburra::Configuration)
|
61
51
|
end
|
62
52
|
|
63
|
-
it '
|
64
|
-
Kookaburra.configuration
|
53
|
+
it 'always returns the same configuration' do
|
54
|
+
x = Kookaburra.configuration
|
55
|
+
y = Kookaburra.configuration
|
56
|
+
x.app_host = 'http://example.com'
|
57
|
+
y.app_host.should == 'http://example.com'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '.configure' do
|
62
|
+
it 'yields Kookaburra.configuration' do
|
63
|
+
configuration = mock('Kookaburra::Configuration')
|
64
|
+
configuration.should_receive(:foo=).with(:bar)
|
65
|
+
Kookaburra.stub!(:configuration => configuration)
|
66
|
+
Kookaburra.configure do |c|
|
67
|
+
c.foo = :bar
|
68
|
+
end
|
65
69
|
end
|
66
70
|
end
|
67
71
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
shared_examples_for :it_can_make_assertions do
|
2
|
+
describe '#assert' do
|
3
|
+
it 'returns true if the condition is truthy' do
|
4
|
+
subject.send(:assert, true, "Shouldn't see this message").should == true
|
5
|
+
end
|
6
|
+
|
7
|
+
it 'raises a Kookaburra::AssertionFailed exception if the condition is not truthy' do
|
8
|
+
lambda { subject.send(:assert, false, "False isn't true, dummy.") } \
|
9
|
+
.should raise_error(Kookaburra::AssertionFailed, "False isn't true, dummy.")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,24 +1,21 @@
|
|
1
1
|
shared_examples_for :it_has_a_dependency_accessor do |accessor_name|
|
2
2
|
describe accessor_name.to_s do
|
3
|
-
it "returns the #{accessor_name} object
|
4
|
-
|
5
|
-
|
3
|
+
it "returns the #{accessor_name} object as assigned" do
|
4
|
+
subject.send("#{accessor_name}=", :thing)
|
5
|
+
subject.send(accessor_name).should == :thing
|
6
6
|
end
|
7
7
|
|
8
8
|
context "when the #{accessor_name} object is not set" do
|
9
9
|
it 'raises a StandardError' do
|
10
|
-
|
11
|
-
lambda { component.send(accessor_name) } \
|
10
|
+
lambda { subject.send(accessor_name) } \
|
12
11
|
.should raise_error(StandardError)
|
13
12
|
end
|
14
13
|
|
15
14
|
it "explains that the #{accessor_name} was not set on initialiation" do
|
16
|
-
subject_class.stub!(:name => 'Foo')
|
17
|
-
component = subject_class.new
|
18
15
|
begin
|
19
|
-
|
16
|
+
subject.send(accessor_name)
|
20
17
|
rescue StandardError => e
|
21
|
-
e.message.should == "No #{accessor_name} object was set on
|
18
|
+
e.message.should == "No #{accessor_name} object was set on #{subject.class.name} initialization."
|
22
19
|
end
|
23
20
|
end
|
24
21
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kookaburra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 71
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 22
|
9
|
+
- 0
|
10
|
+
version: 0.22.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Wilger
|
@@ -29,26 +29,12 @@ dependencies:
|
|
29
29
|
segments:
|
30
30
|
- 0
|
31
31
|
version: "0"
|
32
|
-
name:
|
32
|
+
name: i18n
|
33
33
|
prerelease: false
|
34
34
|
type: :runtime
|
35
35
|
requirement: *id001
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
46
|
-
name: i18n
|
47
|
-
prerelease: false
|
48
|
-
type: :runtime
|
49
|
-
requirement: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
38
|
none: false
|
53
39
|
requirements:
|
54
40
|
- - ">="
|
@@ -61,9 +47,9 @@ dependencies:
|
|
61
47
|
name: activesupport
|
62
48
|
prerelease: false
|
63
49
|
type: :runtime
|
64
|
-
requirement: *
|
50
|
+
requirement: *id002
|
65
51
|
- !ruby/object:Gem::Dependency
|
66
|
-
version_requirements: &
|
52
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
67
53
|
none: false
|
68
54
|
requirements:
|
69
55
|
- - ">="
|
@@ -75,9 +61,9 @@ dependencies:
|
|
75
61
|
name: patron
|
76
62
|
prerelease: false
|
77
63
|
type: :runtime
|
78
|
-
requirement: *
|
64
|
+
requirement: *id003
|
79
65
|
- !ruby/object:Gem::Dependency
|
80
|
-
version_requirements: &
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
81
67
|
none: false
|
82
68
|
requirements:
|
83
69
|
- - ">="
|
@@ -89,9 +75,9 @@ dependencies:
|
|
89
75
|
name: rspec
|
90
76
|
prerelease: false
|
91
77
|
type: :development
|
92
|
-
requirement: *
|
78
|
+
requirement: *id004
|
93
79
|
- !ruby/object:Gem::Dependency
|
94
|
-
version_requirements: &
|
80
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
95
81
|
none: false
|
96
82
|
requirements:
|
97
83
|
- - ">="
|
@@ -103,9 +89,9 @@ dependencies:
|
|
103
89
|
name: capybara
|
104
90
|
prerelease: false
|
105
91
|
type: :development
|
106
|
-
requirement: *
|
92
|
+
requirement: *id005
|
107
93
|
- !ruby/object:Gem::Dependency
|
108
|
-
version_requirements: &
|
94
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
109
95
|
none: false
|
110
96
|
requirements:
|
111
97
|
- - ">="
|
@@ -117,9 +103,9 @@ dependencies:
|
|
117
103
|
name: yard
|
118
104
|
prerelease: false
|
119
105
|
type: :development
|
120
|
-
requirement: *
|
106
|
+
requirement: *id006
|
121
107
|
- !ruby/object:Gem::Dependency
|
122
|
-
version_requirements: &
|
108
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
123
109
|
none: false
|
124
110
|
requirements:
|
125
111
|
- - ~>
|
@@ -132,9 +118,9 @@ dependencies:
|
|
132
118
|
name: redcarpet
|
133
119
|
prerelease: false
|
134
120
|
type: :development
|
135
|
-
requirement: *
|
121
|
+
requirement: *id007
|
136
122
|
- !ruby/object:Gem::Dependency
|
137
|
-
version_requirements: &
|
123
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
138
124
|
none: false
|
139
125
|
requirements:
|
140
126
|
- - ">="
|
@@ -146,9 +132,9 @@ dependencies:
|
|
146
132
|
name: jeweler
|
147
133
|
prerelease: false
|
148
134
|
type: :development
|
149
|
-
requirement: *
|
135
|
+
requirement: *id008
|
150
136
|
- !ruby/object:Gem::Dependency
|
151
|
-
version_requirements: &
|
137
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
152
138
|
none: false
|
153
139
|
requirements:
|
154
140
|
- - ">="
|
@@ -160,9 +146,9 @@ dependencies:
|
|
160
146
|
name: rcov
|
161
147
|
prerelease: false
|
162
148
|
type: :development
|
163
|
-
requirement: *
|
149
|
+
requirement: *id009
|
164
150
|
- !ruby/object:Gem::Dependency
|
165
|
-
version_requirements: &
|
151
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
166
152
|
none: false
|
167
153
|
requirements:
|
168
154
|
- - ">="
|
@@ -174,9 +160,9 @@ dependencies:
|
|
174
160
|
name: reek
|
175
161
|
prerelease: false
|
176
162
|
type: :development
|
177
|
-
requirement: *
|
163
|
+
requirement: *id010
|
178
164
|
- !ruby/object:Gem::Dependency
|
179
|
-
version_requirements: &
|
165
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
180
166
|
none: false
|
181
167
|
requirements:
|
182
168
|
- - ">="
|
@@ -188,7 +174,7 @@ dependencies:
|
|
188
174
|
name: sinatra
|
189
175
|
prerelease: false
|
190
176
|
type: :development
|
191
|
-
requirement: *
|
177
|
+
requirement: *id011
|
192
178
|
description: Cucumber + Capybara = Kookaburra? It made sense at the time.
|
193
179
|
email: johnwilger@gmail.com
|
194
180
|
executables: []
|
@@ -212,24 +198,27 @@ files:
|
|
212
198
|
- kookaburra.gemspec
|
213
199
|
- lib/kookaburra.rb
|
214
200
|
- lib/kookaburra/api_driver.rb
|
201
|
+
- lib/kookaburra/assertion.rb
|
202
|
+
- lib/kookaburra/configuration.rb
|
215
203
|
- lib/kookaburra/dependency_accessor.rb
|
216
204
|
- lib/kookaburra/exceptions.rb
|
217
205
|
- lib/kookaburra/given_driver.rb
|
218
206
|
- lib/kookaburra/json_api_driver.rb
|
219
207
|
- lib/kookaburra/mental_model.rb
|
220
|
-
- lib/kookaburra/null_browser.rb
|
221
208
|
- lib/kookaburra/test_helpers.rb
|
222
209
|
- lib/kookaburra/ui_driver.rb
|
223
210
|
- lib/kookaburra/ui_driver/ui_component.rb
|
211
|
+
- lib/kookaburra/ui_driver/ui_component/address_bar.rb
|
224
212
|
- spec/integration/test_a_rack_application_spec.rb
|
225
213
|
- spec/kookaburra/api_driver_spec.rb
|
214
|
+
- spec/kookaburra/configuration_spec.rb
|
226
215
|
- spec/kookaburra/json_api_driver_spec.rb
|
227
216
|
- spec/kookaburra/mental_model_spec.rb
|
228
|
-
- spec/kookaburra/
|
229
|
-
- spec/kookaburra/test_helpers_spec.rb
|
217
|
+
- spec/kookaburra/ui_driver/ui_component/address_bar_spec.rb
|
230
218
|
- spec/kookaburra/ui_driver/ui_component_spec.rb
|
231
219
|
- spec/kookaburra/ui_driver_spec.rb
|
232
220
|
- spec/kookaburra_spec.rb
|
221
|
+
- spec/support/shared_examples/it_can_make_assertions.rb
|
233
222
|
- spec/support/shared_examples/it_has_a_dependency_accessor.rb
|
234
223
|
homepage: http://github.com/projectdx/kookaburra
|
235
224
|
licenses:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'basic_object'
|
2
|
-
require 'kookaburra/exceptions'
|
3
|
-
|
4
|
-
class Kookaburra
|
5
|
-
# If you don't specify a browser in your {Kookaburra#configuration} but you
|
6
|
-
# try to access one in your {Kookaburra::UIDriver}, you'll get this instead.
|
7
|
-
# It gives a slightly better error message than complaining about calling
|
8
|
-
# stuff on `nil`.
|
9
|
-
class NullBrowser < BasicObject
|
10
|
-
def method_missing(*args)
|
11
|
-
raise NullBrowserError,
|
12
|
-
"You did not provide a :browser to the Kookaburra configuration, but you tried to use one anyway."
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'kookaburra/null_browser'
|
2
|
-
|
3
|
-
describe Kookaburra::NullBrowser do
|
4
|
-
it 'is a BasicObject' do
|
5
|
-
pending "Not sure how to test this, since a BasicObject doesn't implement #kind_of?, etc." do
|
6
|
-
subject.kind_of?(BasicObject).should == true
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'raises a NullBrowserError when any methods are called on it' do
|
11
|
-
lambda { subject.app }.should raise_error(
|
12
|
-
Kookaburra::NullBrowserError,
|
13
|
-
"You did not provide a :browser to the Kookaburra configuration, but you tried to use one anyway.")
|
14
|
-
end
|
15
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'kookaburra/test_helpers'
|
2
|
-
|
3
|
-
describe Kookaburra::TestHelpers do
|
4
|
-
let(:includer) do
|
5
|
-
klass = Class.new do
|
6
|
-
include Kookaburra::TestHelpers
|
7
|
-
end
|
8
|
-
klass.new
|
9
|
-
end
|
10
|
-
|
11
|
-
before(:each) do
|
12
|
-
Kookaburra.stub!(:configuration => {
|
13
|
-
:api_driver_class => :my_api_driver,
|
14
|
-
:given_driver_class => :my_given_driver,
|
15
|
-
:ui_driver_class => :my_ui_driver,
|
16
|
-
:browser => :a_browser_object,
|
17
|
-
:server_error_detection => :my_server_error_detection
|
18
|
-
})
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#k' do
|
22
|
-
it 'returns a configured instance of Kookaburra' do
|
23
|
-
Kookaburra.should_receive(:new) \
|
24
|
-
.with(Kookaburra.configuration) \
|
25
|
-
.and_return(:a_kookaburra_object)
|
26
|
-
includer.k.should == :a_kookaburra_object
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'memoizes the return value' do
|
30
|
-
Kookaburra.should_receive(:new).once.and_return(Object.new)
|
31
|
-
includer.k.should === includer.k
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#given' do
|
36
|
-
it 'returns the GivenDriver from the Kookaburra instance' do
|
37
|
-
Kookaburra.stub!(:new => stub('Kookaburra', :given => :given_driver_instance))
|
38
|
-
includer.given.should == :given_driver_instance
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#ui' do
|
43
|
-
it 'returns the UIDriver from the Kookaburra instance' do
|
44
|
-
Kookaburra.stub!(:new => stub('Kookaburra', :ui => :ui_driver_instance))
|
45
|
-
includer.ui.should == :ui_driver_instance
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|