capybara-screenshot 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
data/capybara-screenshot.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.rubyforge_project = "capybara-screenshot"
|
16
16
|
|
17
17
|
s.add_dependency 'capybara', '>= 1.0'
|
18
|
-
s.add_development_dependency 'rspec', '~> 2.
|
18
|
+
s.add_development_dependency 'rspec', '~> 2.7'
|
19
19
|
s.add_development_dependency 'timecop'
|
20
20
|
|
21
21
|
s.files = `git ls-files`.split("\n")
|
data/lib/capybara-screenshot.rb
CHANGED
@@ -64,6 +64,10 @@ Capybara::Screenshot.class_eval do
|
|
64
64
|
driver.render(path)
|
65
65
|
end
|
66
66
|
|
67
|
+
register_driver(:rack_test) do |driver, path|
|
68
|
+
warn "Rack::Test capybara driver has no ability to output screen shots. Skipping."
|
69
|
+
end
|
70
|
+
|
67
71
|
register_driver(:selenium) do |driver, path|
|
68
72
|
driver.browser.save_screenshot(path)
|
69
73
|
end
|
@@ -85,6 +89,7 @@ Capybara::Screenshot.class_eval do
|
|
85
89
|
end
|
86
90
|
|
87
91
|
require 'capybara-screenshot/saver'
|
92
|
+
require 'capybara-screenshot/capybara'
|
88
93
|
|
89
94
|
# do nothing if Cucumber is not being used
|
90
95
|
if defined?(Cucumber::RbSupport::RbDsl)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Capybara
|
2
|
+
module DSL
|
3
|
+
# Adds class methods to Capybara module and gets mixed into
|
4
|
+
# the current scope during Cucumber and RSpec tests
|
5
|
+
|
6
|
+
def screen_shot_and_save_page
|
7
|
+
Capybara::Screenshot.screen_shot_and_save_page
|
8
|
+
end
|
9
|
+
|
10
|
+
def screen_shot_and_open_image
|
11
|
+
Capybara::Screenshot.screen_shot_and_open_image
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,20 +1,3 @@
|
|
1
|
-
module Capybara
|
2
|
-
module Screenshot
|
3
|
-
module Cucumber
|
4
|
-
|
5
|
-
def screen_shot_and_save_page
|
6
|
-
Capybara::Screenshot.screen_shot_and_save_page
|
7
|
-
end
|
8
|
-
|
9
|
-
def screen_shot_and_open_image
|
10
|
-
Capybara::Screenshot.screen_shot_and_open_image
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
World(Capybara::Screenshot::Cucumber)
|
17
|
-
|
18
1
|
After do |scenario|
|
19
2
|
if Capybara::Screenshot.autosave_on_failure && scenario.failed?
|
20
3
|
filename_prefix = Capybara::Screenshot.filename_prefix_for(:cucumber, scenario)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Capybara::Screenshot
|
2
|
+
describe Capybara do
|
3
|
+
|
4
|
+
it 'should add screen shot methods to the Capybara module' do
|
5
|
+
::Capybara.should respond_to(:screen_shot_and_save_page)
|
6
|
+
::Capybara.should respond_to(:screen_shot_and_open_image)
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'request type example', :type => :request do
|
10
|
+
it 'should have access to screen shot instance methods' do
|
11
|
+
self.should respond_to(:screen_shot_and_save_page)
|
12
|
+
self.should respond_to(:screen_shot_and_open_image)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-screenshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capybara
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '2.
|
37
|
+
version: '2.7'
|
38
38
|
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: '2.
|
45
|
+
version: '2.7'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: timecop
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,11 +76,13 @@ files:
|
|
76
76
|
- Rakefile
|
77
77
|
- capybara-screenshot.gemspec
|
78
78
|
- lib/capybara-screenshot.rb
|
79
|
+
- lib/capybara-screenshot/capybara.rb
|
79
80
|
- lib/capybara-screenshot/cucumber.rb
|
80
81
|
- lib/capybara-screenshot/minitest.rb
|
81
82
|
- lib/capybara-screenshot/rspec.rb
|
82
83
|
- lib/capybara-screenshot/saver.rb
|
83
84
|
- lib/capybara-screenshot/version.rb
|
85
|
+
- spec/capybara-screenshot/capybara_spec.rb
|
84
86
|
- spec/capybara-screenshot/saver_spec.rb
|
85
87
|
- spec/capybara-screenshot_spec.rb
|
86
88
|
- spec/spec_helper.rb
|
@@ -98,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
100
|
version: '0'
|
99
101
|
segments:
|
100
102
|
- 0
|
101
|
-
hash:
|
103
|
+
hash: -2061536587505827239
|
102
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
105
|
none: false
|
104
106
|
requirements:
|
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
version: '0'
|
108
110
|
segments:
|
109
111
|
- 0
|
110
|
-
hash:
|
112
|
+
hash: -2061536587505827239
|
111
113
|
requirements: []
|
112
114
|
rubyforge_project: capybara-screenshot
|
113
115
|
rubygems_version: 1.8.24
|
@@ -116,6 +118,7 @@ specification_version: 3
|
|
116
118
|
summary: Automatically create snapshots when Cucumber steps fail with Capybara and
|
117
119
|
Rails
|
118
120
|
test_files:
|
121
|
+
- spec/capybara-screenshot/capybara_spec.rb
|
119
122
|
- spec/capybara-screenshot/saver_spec.rb
|
120
123
|
- spec/capybara-screenshot_spec.rb
|
121
124
|
- spec/spec_helper.rb
|