gnawrnip 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/example/spec/spec_helper.rb +1 -1
- data/gnawrnip.gemspec +1 -1
- data/lib/gnawrnip/developer.rb +49 -0
- data/lib/gnawrnip/image.rb +53 -0
- data/lib/gnawrnip/publisher.rb +11 -12
- data/lib/gnawrnip/screenshot.rb +7 -36
- data/lib/gnawrnip/step_screenshot.rb +41 -25
- data/lib/gnawrnip/version.rb +1 -1
- data/spec/gnawrnip/developer_spec.rb +66 -0
- data/spec/gnawrnip/image_spec.rb +48 -0
- data/spec/gnawrnip/photographer_spec.rb +1 -0
- data/spec/gnawrnip/rspec_spec.rb +1 -0
- data/spec/gnawrnip/screenshot_spec.rb +9 -65
- data/spec/gnawrnip/step_screenshot_spec.rb +8 -12
- metadata +23 -39
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6fe6dcc279e3f16ba816e4348d651588d0012594
|
4
|
+
data.tar.gz: 58614d16197b2f281539529b6c010f6cd609097d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9ad73dc09318b71443e7cf7003d1022edf4fe8095fa28cfdeefbbb22da327841f326d82ab77a0194a2d59b99e1368ccb6014d73b697729df19560460b1d77d8e
|
7
|
+
data.tar.gz: 1833ffb0f79761ca3e4eed6889e1d9c6570ddf750155bc9692f0445e216d311bdd310e012ef05e61f41f8c8ea335c7a4d477f4c1e57736caccf1a29b5e3289ba
|
data/example/spec/spec_helper.rb
CHANGED
data/gnawrnip.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency 'capybara', "~> 2.1"
|
22
|
-
spec.add_dependency 'turnip_formatter', '~> 0.2.
|
22
|
+
spec.add_dependency 'turnip_formatter', '~> 0.2.9'
|
23
23
|
spec.add_dependency 'oily_png'
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'gnawrnip/image'
|
2
|
+
|
3
|
+
module Gnawrnip
|
4
|
+
class Developer
|
5
|
+
def develop(file)
|
6
|
+
image = Image.new(file)
|
7
|
+
resize(image) if need_resize?
|
8
|
+
image
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def resize(image)
|
14
|
+
new_width, new_height = calculate_new_size(image.width, image.height)
|
15
|
+
|
16
|
+
return if [new_width, new_height] === [image.width, image.height]
|
17
|
+
|
18
|
+
image.resize(new_width, new_height)
|
19
|
+
end
|
20
|
+
|
21
|
+
def need_resize?
|
22
|
+
!Gnawrnip.max_frame_size.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Return new frame size (width and height).
|
27
|
+
# This size is keeping original aspect ratio.
|
28
|
+
#
|
29
|
+
# @return [Array] New width and height size. [width, height]
|
30
|
+
#
|
31
|
+
def calculate_new_size(width, height)
|
32
|
+
ratio = width.to_f / height.to_f
|
33
|
+
target = Gnawrnip.max_frame_size
|
34
|
+
|
35
|
+
return [width, height] if target > [width, height].max
|
36
|
+
|
37
|
+
if ratio < 1
|
38
|
+
new_width = target * ratio
|
39
|
+
new_height = target
|
40
|
+
else
|
41
|
+
new_width = target
|
42
|
+
new_height = target / ratio
|
43
|
+
end
|
44
|
+
|
45
|
+
return [new_width, new_height]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'oily_png'
|
2
|
+
|
3
|
+
module Gnawrnip
|
4
|
+
class Image
|
5
|
+
#
|
6
|
+
# @parma [File] Screenshot image file (png)
|
7
|
+
#
|
8
|
+
def initialize(file)
|
9
|
+
@file = file
|
10
|
+
analysis
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# @return [Fixnum] Width of image
|
15
|
+
#
|
16
|
+
def width
|
17
|
+
@dimension.width
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# @return [Fixnum] Height of image
|
22
|
+
#
|
23
|
+
def height
|
24
|
+
@dimension.height
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_base64
|
28
|
+
Base64.strict_encode64(File.read(@file.path))
|
29
|
+
end
|
30
|
+
|
31
|
+
def resize(width, height)
|
32
|
+
canvas.resample_bilinear(width, height).save(@file.path)
|
33
|
+
analysis
|
34
|
+
end
|
35
|
+
|
36
|
+
def close!
|
37
|
+
@file.close!
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
#
|
43
|
+
# Update dimension (OilyPNG::Dimension) of Image
|
44
|
+
#
|
45
|
+
def analysis
|
46
|
+
@dimension = canvas.dimension
|
47
|
+
end
|
48
|
+
|
49
|
+
def canvas
|
50
|
+
OilyPNG::Canvas.from_file(@file)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/gnawrnip/publisher.rb
CHANGED
@@ -4,27 +4,26 @@ module Gnawrnip
|
|
4
4
|
class Publisher
|
5
5
|
|
6
6
|
#
|
7
|
-
# @params [Array]
|
7
|
+
# @params [Array] images Array of Gnawrnip::Image
|
8
8
|
#
|
9
|
-
def animation(
|
10
|
-
|
9
|
+
def animation(images)
|
10
|
+
images.map { |image| image_tag(image) }.join
|
11
11
|
end
|
12
12
|
|
13
13
|
#
|
14
|
-
# @params [
|
14
|
+
# @params [Gnawrnip::Image] image
|
15
15
|
#
|
16
|
-
def single(
|
17
|
-
image_tag(
|
16
|
+
def single(image)
|
17
|
+
image_tag(image)
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def image_tag(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Base64.strict_encode64(File.read(path))
|
22
|
+
def image_tag(image, format = :png)
|
23
|
+
width = image.width
|
24
|
+
height = image.height
|
25
|
+
data = image.to_base64
|
26
|
+
%Q|<img width="#{width}" height="#{height}" src="data:image/#{format.to_s};base64,#{data}"/>|
|
28
27
|
end
|
29
28
|
end
|
30
29
|
end
|
data/lib/gnawrnip/screenshot.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'time'
|
3
3
|
require 'capybara'
|
4
|
-
require '
|
4
|
+
require 'gnawrnip/developer'
|
5
5
|
|
6
6
|
module Gnawrnip
|
7
7
|
class Screenshot
|
@@ -28,10 +28,7 @@ module Gnawrnip
|
|
28
28
|
start_time = Time.now
|
29
29
|
|
30
30
|
begin
|
31
|
-
|
32
|
-
session.save_screenshot(tempfile.path)
|
33
|
-
resize(tempfile.path) if need_resize?
|
34
|
-
tempfile
|
31
|
+
shot
|
35
32
|
rescue Capybara::NotSupportedByDriverError => e
|
36
33
|
raise e
|
37
34
|
rescue => e
|
@@ -47,39 +44,13 @@ module Gnawrnip
|
|
47
44
|
Capybara.current_session
|
48
45
|
end
|
49
46
|
|
50
|
-
def need_resize?
|
51
|
-
!Gnawrnip.max_frame_size.nil?
|
52
|
-
end
|
53
|
-
|
54
|
-
def resize(path)
|
55
|
-
image = OilyPNG::Canvas.from_file(path)
|
56
|
-
new_width, new_height = calculate_new_size(image.width, image.height)
|
57
|
-
|
58
|
-
image.resample_bilinear!(new_width, new_height)
|
59
|
-
image.save(path)
|
60
|
-
end
|
61
|
-
|
62
47
|
#
|
63
|
-
#
|
64
|
-
# This size is keeping original aspect ratio.
|
48
|
+
# @return [Gnawrnip::Image]
|
65
49
|
#
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
target = Gnawrnip.max_frame_size
|
71
|
-
|
72
|
-
return [width, height] if target > [width, height].max
|
73
|
-
|
74
|
-
if ratio < 1
|
75
|
-
new_width = target * ratio
|
76
|
-
new_height = target
|
77
|
-
else
|
78
|
-
new_width = target
|
79
|
-
new_height = target / ratio
|
80
|
-
end
|
81
|
-
|
82
|
-
return [new_width, new_height]
|
50
|
+
def shot
|
51
|
+
tempfile = Tempfile.new(['gnawrnip', '.png'])
|
52
|
+
session.save_screenshot(tempfile.path)
|
53
|
+
Developer.new.develop(tempfile)
|
83
54
|
end
|
84
55
|
end
|
85
56
|
end
|
@@ -6,16 +6,16 @@ module Gnawrnip
|
|
6
6
|
module StepScreenshot
|
7
7
|
class << self
|
8
8
|
#
|
9
|
-
# @param [Array]
|
9
|
+
# @param [Array] images array of Gnawrnip::Image
|
10
10
|
#
|
11
|
-
def build(
|
12
|
-
case
|
11
|
+
def build(images)
|
12
|
+
case images.length
|
13
13
|
when 0
|
14
14
|
''
|
15
15
|
when 1
|
16
|
-
single_image(
|
16
|
+
single_image(images.first)
|
17
17
|
else
|
18
|
-
animation_image(
|
18
|
+
animation_image(images)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -25,8 +25,10 @@ module Gnawrnip
|
|
25
25
|
<div class="nav">
|
26
26
|
<div class="pager"></div>
|
27
27
|
<div class="manipulate">
|
28
|
-
<
|
29
|
-
<
|
28
|
+
<i class="fa fa-2x fa-step-backward prev"></i>
|
29
|
+
<i class="fa fa-2x fa-play play"></i>
|
30
|
+
<i class="fa fa-2x fa-pause pause"></i>
|
31
|
+
<i class="fa fa-2x fa-step-forward next"></i>
|
30
32
|
</div>
|
31
33
|
</div>
|
32
34
|
<div class="slides">
|
@@ -49,43 +51,54 @@ end
|
|
49
51
|
|
50
52
|
module TurnipFormatter
|
51
53
|
Template.add_js_file('http://cdnjs.cloudflare.com/ajax/libs/jquery.cycle2/20130801/jquery.cycle2.min.js')
|
54
|
+
Template.add_css_file('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css')
|
52
55
|
|
53
56
|
Template.add_js(<<-EOS)
|
54
57
|
$(function() {
|
55
58
|
$('.screenshot.animation').each(function() {
|
56
59
|
var slide = $(this).find('.slides').cycle({
|
57
|
-
timeout:
|
58
|
-
autoHeight: "
|
60
|
+
timeout: #{Gnawrnip.frame_interval_ms},
|
61
|
+
autoHeight: "calc",
|
59
62
|
pager: $(this).find('div.nav .pager')
|
60
63
|
});
|
61
64
|
|
62
65
|
var nav = $(this).find('div.nav');
|
63
|
-
var playButton
|
64
|
-
var
|
65
|
-
|
66
|
-
var
|
67
|
-
|
68
|
-
|
66
|
+
var playButton = nav.find('.play');
|
67
|
+
var pauseButton = nav.find('.pause');
|
68
|
+
var prevButton = nav.find('.prev');
|
69
|
+
var nextButton = nav.find('.next');
|
70
|
+
|
71
|
+
var setPauseManipulate = function() {
|
72
|
+
playButton.show();
|
73
|
+
pauseButton.hide();
|
74
|
+
prevButton.show();
|
75
|
+
nextButton.show();
|
69
76
|
};
|
70
77
|
|
71
|
-
var
|
72
|
-
playButton.
|
73
|
-
|
78
|
+
var setPlayManipulate = function() {
|
79
|
+
playButton.hide();
|
80
|
+
pauseButton.show();
|
81
|
+
prevButton.hide();
|
82
|
+
nextButton.hide();
|
74
83
|
};
|
75
84
|
|
76
85
|
playButton.click(function() { slide.cycle('resume'); });
|
77
|
-
|
86
|
+
pauseButton.click(function() { slide.cycle('pause'); });
|
87
|
+
prevButton.click(function() { slide.cycle('prev'); });
|
88
|
+
nextButton.click(function() { slide.cycle('next'); });
|
89
|
+
|
90
|
+
setPlayManipulate();
|
78
91
|
|
79
92
|
slide.on('cycle-pager-activated', function(event, opts) {
|
80
93
|
slide.cycle('pause');
|
81
94
|
});
|
82
95
|
|
83
96
|
slide.on('cycle-paused', function(event, opts) {
|
84
|
-
|
97
|
+
setPauseManipulate();
|
85
98
|
});
|
86
99
|
|
87
100
|
slide.on('cycle-resumed', function(event, opts) {
|
88
|
-
|
101
|
+
setPlayManipulate();
|
89
102
|
});
|
90
103
|
});
|
91
104
|
});
|
@@ -122,13 +135,16 @@ module TurnipFormatter
|
|
122
135
|
}
|
123
136
|
|
124
137
|
.manipulate {
|
125
|
-
|
138
|
+
margin-bottom: 1em;
|
139
|
+
|
140
|
+
i {
|
126
141
|
color: black;
|
127
|
-
font-size: 30px;
|
128
142
|
cursor: pointer;
|
143
|
+
margin-left: 0.3em;
|
144
|
+
margin-right: 0.3em;
|
129
145
|
|
130
|
-
|
131
|
-
color:
|
146
|
+
&:hover {
|
147
|
+
color: #aa0000;
|
132
148
|
}
|
133
149
|
}
|
134
150
|
}
|
data/lib/gnawrnip/version.rb
CHANGED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gnawrnip/developer'
|
3
|
+
|
4
|
+
module Gnawrnip
|
5
|
+
describe Developer do
|
6
|
+
let(:developer) do
|
7
|
+
Developer.new
|
8
|
+
end
|
9
|
+
|
10
|
+
before do
|
11
|
+
Image.any_instance.stub(:analysis)
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'No given Gnawrnip.max_frame_size' do
|
15
|
+
describe '.develop' do
|
16
|
+
before do
|
17
|
+
Gnawrnip.max_frame_size = nil
|
18
|
+
Developer.should_not_receive(:resize)
|
19
|
+
end
|
20
|
+
|
21
|
+
it { developer.develop(nil) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'Given Gnawrnip.max_frame_size' do
|
26
|
+
context 'width larger than height.' do
|
27
|
+
describe '.develop' do
|
28
|
+
before do
|
29
|
+
Gnawrnip.max_frame_size = 300
|
30
|
+
Image.any_instance.stub(:width).and_return(640)
|
31
|
+
Image.any_instance.stub(:height).and_return(480)
|
32
|
+
Image.any_instance.should_receive(:resize).with(300, 225)
|
33
|
+
end
|
34
|
+
|
35
|
+
it { developer.develop(nil) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'height larger than width.' do
|
40
|
+
describe '.develop' do
|
41
|
+
before do
|
42
|
+
Gnawrnip.max_frame_size = 400
|
43
|
+
Image.any_instance.stub(:width).and_return(480)
|
44
|
+
Image.any_instance.stub(:height).and_return(640)
|
45
|
+
Image.any_instance.should_receive(:resize).with(300, 400)
|
46
|
+
end
|
47
|
+
|
48
|
+
it { developer.develop(nil) }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'Given max_frame_size larger than original.' do
|
53
|
+
describe '.develop' do
|
54
|
+
before do
|
55
|
+
Gnawrnip.max_frame_size = 1024
|
56
|
+
Image.any_instance.stub(:width).and_return(640)
|
57
|
+
Image.any_instance.stub(:height).and_return(480)
|
58
|
+
Image.any_instance.should_not_receive(:resize)
|
59
|
+
end
|
60
|
+
|
61
|
+
it { developer.develop(nil) }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'gnawrnip/image'
|
3
|
+
|
4
|
+
module Gnawrnip
|
5
|
+
describe Image do
|
6
|
+
before do
|
7
|
+
Image.any_instance.stub(:canvas).and_return(canvas)
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:image) do
|
11
|
+
Image.new(GnawrnipTest.image('gnawrnip/image'))
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'image size is 640x480' do
|
15
|
+
let(:canvas) do
|
16
|
+
double(dimension: dimension, save: nil)
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:dimension) do
|
20
|
+
double(width: 640, height: 480)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '.width' do
|
24
|
+
subject { image.width }
|
25
|
+
it { should eql 640 }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.height' do
|
29
|
+
subject { image.height }
|
30
|
+
it { should eql 480 }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.resize' do
|
34
|
+
let(:canvas) do
|
35
|
+
canvas = super()
|
36
|
+
canvas.should_receive(:resample_bilinear).with(320, 240).and_return(canvas)
|
37
|
+
canvas
|
38
|
+
end
|
39
|
+
|
40
|
+
before do
|
41
|
+
Image.any_instance.should_receive(:analysis).twice
|
42
|
+
end
|
43
|
+
|
44
|
+
it { image.resize(320, 240) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/gnawrnip/rspec_spec.rb
CHANGED
@@ -11,8 +11,9 @@ module Gnawrnip
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
it 'should raise Capybara::NotSupportByDriverError' do
|
15
|
+
expect { Screenshot.take }.to raise_error Capybara::NotSupportedByDriverError
|
16
|
+
end
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
@@ -30,81 +31,24 @@ module Gnawrnip
|
|
30
31
|
Time.stub(:now).and_return(now, now + 3)
|
31
32
|
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
it 'should raise Timeout Error' do
|
35
|
+
expect {
|
35
36
|
Capybara.using_wait_time 2 do
|
36
37
|
Screenshot.take
|
37
38
|
end
|
38
|
-
}
|
39
|
+
}.to raise_error Timeout::Error
|
39
40
|
end
|
40
|
-
|
41
|
-
it { should raise_error Timeout::Error }
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
|
-
context '
|
45
|
+
context 'success screenshot' do
|
47
46
|
describe '.take' do
|
48
|
-
subject { Screenshot.take.read }
|
49
|
-
|
50
|
-
context 'No given max frame size' do
|
51
|
-
before do
|
52
|
-
Gnawrnip.max_frame_size = nil
|
53
|
-
Screenshot.should_not_receive(:resize)
|
54
|
-
end
|
55
|
-
|
56
|
-
it { should == "screenshot" }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'Given Gnawrnip.max_frame_size' do
|
62
|
-
before do
|
63
|
-
OilyPNG::Canvas.stub(:from_file) { oily_png }
|
64
|
-
end
|
65
|
-
|
66
|
-
subject { Screenshot.take.read }
|
67
|
-
|
68
|
-
context 'width larger than height.' do
|
69
|
-
let(:oily_png) do
|
70
|
-
oily_png = double('oily_png', width: 640, height: 480, save: nil)
|
71
|
-
oily_png.should_receive(:resample_bilinear!).with(300, 225)
|
72
|
-
oily_png
|
73
|
-
end
|
74
|
-
|
75
|
-
before do
|
76
|
-
Gnawrnip.max_frame_size = 300
|
77
|
-
end
|
78
|
-
|
79
|
-
it { should == "screenshot" }
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'height larger than width.' do
|
83
|
-
let(:oily_png) do
|
84
|
-
oily_png = double('oily_png', width: 480, height: 640, save: nil)
|
85
|
-
oily_png.should_receive(:resample_bilinear!).with(300, 400)
|
86
|
-
oily_png
|
87
|
-
end
|
88
|
-
|
89
|
-
before do
|
90
|
-
Gnawrnip.max_frame_size = 400
|
91
|
-
end
|
92
|
-
|
93
|
-
it { should == "screenshot" }
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'Given max_frame_size larger than original.' do
|
97
|
-
let(:oily_png) do
|
98
|
-
oily_png = double('oily_png', width: 640, height: 480, save: nil)
|
99
|
-
oily_png.should_receive(:resample_bilinear!).with(640, 480)
|
100
|
-
oily_png
|
101
|
-
end
|
102
|
-
|
103
47
|
before do
|
104
|
-
|
48
|
+
Screenshot.should_receive(:shot).once
|
105
49
|
end
|
106
50
|
|
107
|
-
it {
|
51
|
+
it { Screenshot.take }
|
108
52
|
end
|
109
53
|
end
|
110
54
|
end
|
@@ -15,30 +15,26 @@ module Gnawrnip
|
|
15
15
|
context 'has multiple data' do
|
16
16
|
let(:data_list) do
|
17
17
|
[
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
double(to_base64: 'aiueo', width: 640, height: 480),
|
19
|
+
double(to_base64: '12345', width: 512, height: 200),
|
20
|
+
double(to_base64: 'abcde', width: 640, height: 320)
|
21
21
|
]
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should get image tag and source that base64 encoded' do
|
25
|
-
data1 = Base64.strict_encode64('aiueo')
|
26
|
-
data2 = Base64.strict_encode64('12345')
|
27
|
-
data3 = Base64.strict_encode64('abcde')
|
28
25
|
should include '<div class="screenshot animation">'
|
29
|
-
should include '<img src="data:image/png;base64,
|
30
|
-
should include '<img src="data:image/png;base64,
|
31
|
-
should include '<img src="data:image/png;base64,
|
26
|
+
should include '<img width="640" height="480" src="data:image/png;base64,aiueo"/>'
|
27
|
+
should include '<img width="512" height="200" src="data:image/png;base64,12345"/>'
|
28
|
+
should include '<img width="640" height="320" src="data:image/png;base64,abcde"/>'
|
32
29
|
should include '<div class="nav">'
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
36
33
|
context 'has single data' do
|
37
|
-
let(:data_list) { [
|
34
|
+
let(:data_list) { [ double(to_base64: 'abcde', width: 640, height: 480) ] }
|
38
35
|
it {
|
39
|
-
data = Base64.strict_encode64('aiueo')
|
40
36
|
should include '<div class="screenshot">'
|
41
|
-
should include '<img src="data:image/png;base64,
|
37
|
+
should include '<img width="640" height="480" src="data:image/png;base64,abcde"/></div>'
|
42
38
|
should_not include '<div class="nav">'
|
43
39
|
}
|
44
40
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gnawrnip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Wataru MIYAGUNI
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: capybara
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,39 +27,34 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: turnip_formatter
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.2.
|
33
|
+
version: 0.2.9
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.2.
|
40
|
+
version: 0.2.9
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: oily_png
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: bundler
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,49 +69,43 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rake
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: rspec
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: coveralls
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
description: Gnawrnip is a TurnipFormatter Add-on that provides put a screen shot
|
@@ -145,7 +130,9 @@ files:
|
|
145
130
|
- example/web.rb
|
146
131
|
- gnawrnip.gemspec
|
147
132
|
- lib/gnawrnip.rb
|
133
|
+
- lib/gnawrnip/developer.rb
|
148
134
|
- lib/gnawrnip/ext/capybara/session.rb
|
135
|
+
- lib/gnawrnip/image.rb
|
149
136
|
- lib/gnawrnip/no_screenshot.png
|
150
137
|
- lib/gnawrnip/photographer.rb
|
151
138
|
- lib/gnawrnip/publisher.rb
|
@@ -153,6 +140,8 @@ files:
|
|
153
140
|
- lib/gnawrnip/screenshot.rb
|
154
141
|
- lib/gnawrnip/step_screenshot.rb
|
155
142
|
- lib/gnawrnip/version.rb
|
143
|
+
- spec/gnawrnip/developer_spec.rb
|
144
|
+
- spec/gnawrnip/image_spec.rb
|
156
145
|
- spec/gnawrnip/photographer_spec.rb
|
157
146
|
- spec/gnawrnip/rspec_spec.rb
|
158
147
|
- spec/gnawrnip/screenshot_spec.rb
|
@@ -161,35 +150,30 @@ files:
|
|
161
150
|
homepage: https://github.com/gongo/gnawrnip
|
162
151
|
licenses:
|
163
152
|
- MIT
|
153
|
+
metadata: {}
|
164
154
|
post_install_message:
|
165
155
|
rdoc_options: []
|
166
156
|
require_paths:
|
167
157
|
- lib
|
168
158
|
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
159
|
requirements:
|
171
|
-
- -
|
160
|
+
- - '>='
|
172
161
|
- !ruby/object:Gem::Version
|
173
162
|
version: '0'
|
174
|
-
segments:
|
175
|
-
- 0
|
176
|
-
hash: 95231575692747815
|
177
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
-
none: false
|
179
164
|
requirements:
|
180
|
-
- -
|
165
|
+
- - '>='
|
181
166
|
- !ruby/object:Gem::Version
|
182
167
|
version: '0'
|
183
|
-
segments:
|
184
|
-
- 0
|
185
|
-
hash: 95231575692747815
|
186
168
|
requirements: []
|
187
169
|
rubyforge_project:
|
188
|
-
rubygems_version:
|
170
|
+
rubygems_version: 2.0.14
|
189
171
|
signing_key:
|
190
|
-
specification_version:
|
172
|
+
specification_version: 4
|
191
173
|
summary: Add-on for TurnipFormatter with Capybara
|
192
174
|
test_files:
|
175
|
+
- spec/gnawrnip/developer_spec.rb
|
176
|
+
- spec/gnawrnip/image_spec.rb
|
193
177
|
- spec/gnawrnip/photographer_spec.rb
|
194
178
|
- spec/gnawrnip/rspec_spec.rb
|
195
179
|
- spec/gnawrnip/screenshot_spec.rb
|