kookaburra 1.3.0 → 1.3.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: 876b112f7d0a4bf348ff6eb5725b9acfba78231c
4
- data.tar.gz: 5c9e9eb1859eae92ceeff6bdd27fb97508b2dbe0
3
+ metadata.gz: 5cadefaae85409b2b4db57ce339eea29091d9a87
4
+ data.tar.gz: 14ca8365ce3aecd80dbf5a78a8e7581d1461dac1
5
5
  SHA512:
6
- metadata.gz: de33f1490e4bf1f0fbf8ebce836b63c5b0569da8e6a878377499c3b764bbc36fa5a8d57f534b79547e4ab89b965de8c5589ae037360e9d79763dab70804a4a70
7
- data.tar.gz: 46b70542699935c33958a1712618c0eddc772971f07482077aa2aad13e0a4651ba845fb31032085916157d0edc98e34450e40aa37a95e4ec6cdd4e1527063f65
6
+ metadata.gz: b4ca6636a527e1a6de7af7b92ac9c87be2ca3ab507b5327ed4513635a522a3e794aff3930720cfbde751ad7dbb0236e52e9e5697f7a1f57569006a4ad6d7d355
7
+ data.tar.gz: a2badf5f817a513f45c4955bdb3ea0b9a8139a08fd4826fba07d43be6a8d11a0d9c8c07eb6a296904c562c22b556c834a1edba366953f2aa122a2af8240821d4
data/Rakefile CHANGED
@@ -6,11 +6,9 @@ require 'rspec/core/rake_task'
6
6
  task :default => :spec
7
7
  RSpec::Core::RakeTask.new
8
8
 
9
- require 'reek/rake/task'
10
- Reek::Rake::Task.new do |t|
11
- t.fail_on_error = true
12
- t.verbose = false
13
- t.source_files = 'lib/**/*.rb'
9
+ desc 'Runs reek to detect code smells'
10
+ task :reek do
11
+ sh 'reek lib/**/*.rb'
14
12
  end
15
13
 
16
14
  require 'yard'
@@ -168,7 +168,7 @@ class Kookaburra
168
168
  def detect_server_error!
169
169
  return if @server_error_detection.nil?
170
170
  if @server_error_detection.call(browser)
171
- raise UnexpectedResponse, "Your server error detection function detected a server error. Looks like your applications is busted. :-("
171
+ raise UnexpectedResponse, "Server Error Detected:\n#{browser.text}"
172
172
  end
173
173
  end
174
174
 
@@ -1,3 +1,3 @@
1
1
  class Kookaburra
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
@@ -3,7 +3,7 @@ require 'kookaburra/ui_driver/ui_component/address_bar'
3
3
  describe Kookaburra::UIDriver::UIComponent::AddressBar do
4
4
  describe '#go_to' do
5
5
  let(:browser) {
6
- double('Capybara::Session').tap do |b|
6
+ double('Capybara::Session', text: '').tap do |b|
7
7
  b.should_receive(:visit).with('http://site.example.com')
8
8
  end
9
9
  }
@@ -3,55 +3,63 @@ require 'support/shared_examples/it_can_make_assertions'
3
3
  require 'support/shared_examples/it_can_have_ui_components'
4
4
 
5
5
  describe Kookaburra::UIDriver::UIComponent do
6
- let(:configuration) { double('Configuration', :browser => nil, :app_host => nil, :server_error_detection => nil) }
6
+ let(:browser) { double('Browser Driver') }
7
+ let(:app_host) { 'http://my.example.com' }
8
+ let(:server_error_detection) { ->(browser) { false } }
9
+
10
+ let(:configuration) {
11
+ double('Configuration', browser: browser, app_host: app_host,
12
+ server_error_detection: server_error_detection)
13
+ }
14
+
7
15
  let(:component) { Kookaburra::UIDriver::UIComponent.new(configuration) }
8
16
 
9
17
  it_behaves_like :it_can_have_ui_components, Kookaburra::UIDriver::UIComponent
10
18
 
11
19
  describe '#visible?' do
20
+ before(:each) do
21
+ def component.component_locator
22
+ '#my_component'
23
+ end
24
+ end
25
+
12
26
  it 'returns true if the component_locator is found in the DOM and is visible' do
13
- browser = double('Browser Driver')
14
27
  browser.should_receive(:has_css?) \
15
28
  .with('#my_component', :visible) \
16
29
  .and_return(true)
17
- configuration.stub(:browser => browser)
18
- def component.component_locator
19
- '#my_component'
20
- end
21
30
  component.visible?.should == true
22
31
  end
23
32
 
24
- it 'returns false if the component_locator id not found in the DOM' do
25
- browser = double('Browser Driver', :has_css? => false)
26
- configuration.stub(:browser => browser)
27
- server_error_detection = lambda { |browser|
28
- false
29
- }
30
- configuration.stub(:server_error_detection => server_error_detection)
31
- def component.component_locator
32
- '#my_component'
33
+ context 'when the component_locator is not found in the DOM' do
34
+ let(:browser) { double('Browser Driver', has_css?: false, text: '') }
35
+
36
+ context 'and a server error is not detected' do
37
+ it 'returns false' do
38
+ component.visible?.should == false
39
+ end
33
40
  end
34
- component.visible?.should == false
35
- end
36
41
 
37
- it 'raises UnexpectedResponse if the component_locator is not found and a server error is detected' do
38
- browser = double('Browser Driver', :has_css? => false)
39
- configuration.stub(:browser => browser)
40
- server_error_detection = lambda { |browser|
41
- true
42
- }
43
- configuration.stub(:server_error_detection => server_error_detection)
44
- def component.component_locator
45
- '#my_component'
42
+ context 'and a server error is detected' do
43
+ let(:server_error_detection) { ->(browser) { true } }
44
+
45
+ it 'raises UnexpectedResponse' do
46
+ lambda { component.visible? } \
47
+ .should raise_error(Kookaburra::UnexpectedResponse)
48
+ end
49
+
50
+ it 'adds the text of the HTTP response to the exception message' do
51
+ browser.stub(text: 'This is text from the HTTP response')
52
+ lambda { component.visible? } \
53
+ .should raise_error(Kookaburra::UnexpectedResponse,
54
+ "Server Error Detected:\n" \
55
+ + "This is text from the HTTP response")
56
+ end
46
57
  end
47
- lambda { component.visible? } \
48
- .should raise_error(Kookaburra::UnexpectedResponse)
49
58
  end
50
59
  end
51
60
 
52
61
  describe '#url' do
53
62
  it 'returns the app_host + #component_path' do
54
- configuration.stub(:app_host => 'http://my.example.com')
55
63
  def component.component_path
56
64
  '/foo/bar'
57
65
  end
@@ -81,10 +89,8 @@ describe Kookaburra::UIDriver::UIComponent do
81
89
 
82
90
  describe '#this_element' do
83
91
  it 'returns the HTML element representing this component' do
84
- browser = double('Browser Driver')
85
92
  element = double('Element')
86
93
 
87
- configuration.stub(browser: browser)
88
94
  def component.component_locator
89
95
  '#my_component'
90
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kookaburra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wilger
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-29 00:00:00.000000000 Z
13
+ date: 2014-05-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client