adyen-skinbuilder 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/CHANGELOG.md +13 -1
- data/Gemfile.lock +3 -3
- data/bin/adyen-skinbuilder +1 -1
- data/lib/adyen-skinbuilder/helper/adyen.rb +3 -0
- data/lib/adyen-skinbuilder/helper/render.rb +2 -2
- data/lib/adyen-skinbuilder/server.rb +63 -53
- data/lib/adyen-skinbuilder/server/views/index.html.erb +19 -10
- data/lib/adyen-skinbuilder/server/views/layout.html.erb +6 -5
- data/lib/adyen-skinbuilder/version.rb +1 -1
- data/spec/lib/adyen-skinbuilder/server_spec.rb +97 -93
- metadata +4 -4
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,10 +4,21 @@
|
|
4
4
|
* multiple user, assets upload, hosted system
|
5
5
|
|
6
6
|
## Todo
|
7
|
-
* beautify index page, add 'new', 'edit'
|
7
|
+
* beautify index page, add 'new', 'edit'
|
8
8
|
* add locale support
|
9
9
|
* add more functions to binary to get a proper CLI tool (or move to adyen-admin??)
|
10
10
|
* more helper e.g. cutom fields
|
11
|
+
* auto concatinate multiple .js files
|
12
|
+
* auto concatinate multiple .css files
|
13
|
+
* auto build example PaymentMethod skeleton
|
14
|
+
* support new CSS selectors
|
15
|
+
|
16
|
+
## v0.3.1
|
17
|
+
* feature: see remote version
|
18
|
+
* feature: read skin code from skin.yaml file
|
19
|
+
* fix skincode name
|
20
|
+
* fix relative skin path
|
21
|
+
* fix non existing link to setup remote admin
|
11
22
|
* auto re-login when session timed out
|
12
23
|
|
13
24
|
## v0.3.0
|
@@ -15,6 +26,7 @@
|
|
15
26
|
* show local / remote skins, option to sync
|
16
27
|
* add skin upload -> 'adyen-admin'
|
17
28
|
* add skin export
|
29
|
+
* added action 'download'
|
18
30
|
* gemify
|
19
31
|
* add custom skin path
|
20
32
|
* add order_data
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
adyen-skinbuilder (0.3.
|
4
|
+
adyen-skinbuilder (0.3.1)
|
5
5
|
adyen-admin
|
6
6
|
sinatra
|
7
7
|
sinatra-contrib
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
|
-
adyen-admin (0.0.
|
13
|
+
adyen-admin (0.0.12)
|
14
14
|
mechanize
|
15
15
|
rubyzip
|
16
16
|
backports (2.5.1)
|
@@ -24,7 +24,7 @@ GEM
|
|
24
24
|
thor (~> 0.14.6)
|
25
25
|
guard-rspec (0.7.0)
|
26
26
|
guard (>= 0.10.0)
|
27
|
-
mechanize (2.
|
27
|
+
mechanize (2.4)
|
28
28
|
domain_name (~> 0.5, >= 0.5.1)
|
29
29
|
mime-types (~> 1.17, >= 1.17.2)
|
30
30
|
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
data/bin/adyen-skinbuilder
CHANGED
@@ -17,13 +17,13 @@ module Adyen
|
|
17
17
|
|
18
18
|
# renders a file from the inc folder of the skin
|
19
19
|
def render_file(file)
|
20
|
-
file =
|
20
|
+
file = File.join(@skin.path, "inc/#{file}.txt")
|
21
21
|
File.read(file) if File.exists?(file)
|
22
22
|
end
|
23
23
|
|
24
24
|
# render an erb partial inline
|
25
25
|
def render_partial(file, locals = {})
|
26
|
-
views = locals.delete(:views) ||
|
26
|
+
views = locals.delete(:views) || @skin.path
|
27
27
|
erb "_#{file}.html".to_sym, :layout => false, :views => views, :locals => locals
|
28
28
|
end
|
29
29
|
end
|
@@ -25,6 +25,7 @@ module Adyen
|
|
25
25
|
|
26
26
|
def skins_directory
|
27
27
|
@@skins_directory ||= begin
|
28
|
+
# check if it's a skin, if so use dirname
|
28
29
|
Adyen::Admin::Skin.new(:path => settings.skins_directory)
|
29
30
|
File.dirname(settings.skins_directory)
|
30
31
|
rescue ArgumentError
|
@@ -32,41 +33,33 @@ module Adyen
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
def
|
36
|
-
File.join(
|
37
|
-
end
|
38
|
-
|
39
|
-
def skin_file(skin_code)
|
40
|
-
skin_path(skin_code, "skin.html").tap do |file|
|
36
|
+
def skin_file(skin, filename = "skin.html")
|
37
|
+
File.join(skin.path, filename).tap do |file|
|
41
38
|
if !File.exists?("#{file}.erb")
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def store(output)
|
48
|
-
output.scan(/<!-- ### inc\/([a-z]+) -->(.+?)<!-- ### -->/m) do |name, content|
|
49
|
-
file = skin_path @skin_code, "/inc/#{name}.txt"
|
50
|
-
`mkdir -p #{File.dirname(file)}`
|
51
|
-
File.open(file, "w") do |f|
|
52
|
-
f.write content.strip
|
39
|
+
return File.join(settings.views, filename)
|
53
40
|
end
|
54
41
|
end
|
55
42
|
end
|
56
43
|
|
57
44
|
def adyen_login
|
58
|
-
if settings.adyen_admin_cfg && !Adyen::Admin.authenticated?
|
59
|
-
cfg = settings.adyen_admin_cfg
|
45
|
+
if (cfg = settings.adyen_admin_cfg) && !Adyen::Admin.authenticated?
|
60
46
|
Adyen::Admin.login(cfg[:accountname], cfg[:username], cfg[:password])
|
61
47
|
end
|
62
48
|
end
|
63
49
|
|
50
|
+
def render_skin(skin)
|
51
|
+
erb(skin_file(skin).to_sym, {
|
52
|
+
:views => '/',
|
53
|
+
:layout => File.join(settings.views, "layout.html").to_sym
|
54
|
+
})
|
55
|
+
end
|
56
|
+
|
64
57
|
helpers Helper::Render, Helper::Adyen
|
65
58
|
|
66
59
|
get '/sf/:skin_code/*' do |skin_code, path|
|
67
|
-
if (file =
|
60
|
+
if (skin = Adyen::Admin::Skin.find(skin_code)) && (file = File.join(skin.path, path)) && File.exists?(file)
|
68
61
|
send_file file
|
69
|
-
elsif (file =
|
62
|
+
elsif (file = File.join(skins_directory, "base", path)) && File.exists?(file)
|
70
63
|
send_file file
|
71
64
|
end
|
72
65
|
end
|
@@ -83,46 +76,63 @@ module Adyen
|
|
83
76
|
get '/favicon.ico' do
|
84
77
|
end
|
85
78
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
:views => '/',
|
92
|
-
:layout => File.join(settings.views, "layout.html").to_sym
|
93
|
-
}).tap do |output|
|
94
|
-
if @skin = Adyen::Admin::Skin.new(:path => skin_path(skin_code))
|
95
|
-
if params[:compile]
|
96
|
-
store(output)
|
97
|
-
send_file(@skin.compile) && return
|
98
|
-
elsif params[:upload]
|
99
|
-
store(output)
|
100
|
-
adyen_login
|
101
|
-
@skin.upload
|
102
|
-
end
|
103
|
-
end
|
79
|
+
get '/:skin_code/upload' do |skin_code|
|
80
|
+
if @skin = Adyen::Admin::Skin.find(skin_code)
|
81
|
+
output = render_skin @skin
|
82
|
+
@skin.compile(output)
|
83
|
+
@skin.upload
|
104
84
|
end
|
85
|
+
redirect '/sync'
|
105
86
|
end
|
106
87
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
# index page
|
111
|
-
get '/' do
|
112
|
-
Adyen::Admin::Skin.default_path = skin_path
|
113
|
-
if params[:sync]
|
114
|
-
Adyen::Admin::Skin.purge_cache
|
115
|
-
adyen_login
|
116
|
-
@@skin_cache = Adyen::Admin::Skin.all
|
117
|
-
end
|
118
|
-
if params[:download] && (@skin = Adyen::Admin::Skin.find(params[:download]))
|
88
|
+
get '/:skin_code/download' do |skin_code|
|
89
|
+
if @skin = Adyen::Admin::Skin.find(skin_code)
|
119
90
|
@skin.download.tap do |zip_file|
|
120
91
|
@skin.decompile(zip_file)
|
121
|
-
`cp #{skin_file(@skin
|
92
|
+
`cp #{skin_file(@skin)}.erb #{@skin.path}`
|
122
93
|
`rm -f #{zip_file}`
|
123
94
|
end
|
124
95
|
end
|
125
|
-
|
96
|
+
redirect '/'
|
97
|
+
end
|
98
|
+
|
99
|
+
get '/:skin_code/update' do |skin_code|
|
100
|
+
if @skin = Adyen::Admin::Skin.find(skin_code)
|
101
|
+
@skin.update
|
102
|
+
end
|
103
|
+
redirect '/sync'
|
104
|
+
end
|
105
|
+
|
106
|
+
get '/:skin_code/compile' do |skin_code|
|
107
|
+
if @skin = Adyen::Admin::Skin.find(skin_code)
|
108
|
+
output = render_skin @skin
|
109
|
+
@skin.compile(output)
|
110
|
+
send_file(@skin.compress)
|
111
|
+
else
|
112
|
+
redirect '/'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
get '/sync' do
|
117
|
+
Adyen::Admin::Skin.default_path = skins_directory
|
118
|
+
Adyen::Admin::Skin.purge_cache
|
119
|
+
adyen_login
|
120
|
+
redirect '/'
|
121
|
+
end
|
122
|
+
|
123
|
+
# skin page
|
124
|
+
get '/:skin_code' do |skin_code|
|
125
|
+
if @skin = Adyen::Admin::Skin.find(skin_code)
|
126
|
+
render_skin @skin
|
127
|
+
else
|
128
|
+
redirect '/'
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# index page
|
133
|
+
get '/' do
|
134
|
+
Adyen::Admin::Skin.default_path = skins_directory
|
135
|
+
@skins = Adyen::Admin::Skin.all
|
126
136
|
@adyen_admin_cfg = settings.adyen_admin_cfg
|
127
137
|
|
128
138
|
erb 'index.html'.to_sym, :layout => false
|
@@ -63,17 +63,17 @@
|
|
63
63
|
<h1>Adyen Skins</h1>
|
64
64
|
|
65
65
|
<% unless @adyen_admin_cfg %>
|
66
|
-
<div class="warning">No Adyen Admin config found. Please create a <i>.adyenrc</i> with credentials, see <a href="">more details see here</a></div>
|
66
|
+
<div class="warning">No Adyen Admin config found. Please create a <i>.adyenrc</i> with credentials, see <a href="https://github.com/priithaamer/adyen-skinbuilder#interacting-with-remote-adyen-admin">more details see here</a></div>
|
67
67
|
<% end %>
|
68
68
|
|
69
|
-
Skins found in <i><%=
|
69
|
+
Skins found in <i><%= skins_directory %></i>
|
70
70
|
<br>
|
71
71
|
|
72
72
|
<table>
|
73
73
|
<tr>
|
74
74
|
<th>Status</th>
|
75
75
|
<th>Name</th>
|
76
|
-
<th>
|
76
|
+
<th>Versions</th>
|
77
77
|
<th>Action</th>
|
78
78
|
<th>Remote</th>
|
79
79
|
</tr>
|
@@ -84,17 +84,26 @@
|
|
84
84
|
<%= "R" unless skin.frozen? %>
|
85
85
|
<%= "L" if skin.path %>
|
86
86
|
</td>
|
87
|
-
<td><img src="https://ca-test.adyen.com/ca/img/icons/layout_content.png"
|
88
|
-
<td><%= skin.code %></td>
|
87
|
+
<td><a href="/<%= skin.code %>"><img src="https://ca-test.adyen.com/ca/img/icons/layout_content.png" border="0"><%= skin.name || skin.code %></a></td>
|
89
88
|
<td>
|
90
|
-
<% if
|
89
|
+
<% if !skin.frozen? %>
|
90
|
+
<%= skin.version %>
|
91
|
+
-
|
92
|
+
<%= skin.version_test %>
|
93
|
+
-
|
94
|
+
<%= skin.version_live %>
|
95
|
+
<% end %>
|
96
|
+
</td>
|
97
|
+
<td>
|
98
|
+
<% if Adyen::Admin.authenticated? && !skin.frozen? %>
|
91
99
|
<% if skin.path %>
|
92
|
-
<a href="/<%=
|
100
|
+
<a href="/<%= skin.code %>/upload">upload</a>
|
93
101
|
<% else %>
|
94
|
-
<a href="
|
102
|
+
<a href="/<%= skin.code %>/download">download</a>
|
95
103
|
<% end %>
|
104
|
+
<a href="/<%= skin.code %>/update">update</a>
|
96
105
|
<% else %>
|
97
|
-
<a href="/<%=
|
106
|
+
<a href="/<%= skin.code %>/compile">compile</a>
|
98
107
|
<% end %>
|
99
108
|
</td>
|
100
109
|
<td>
|
@@ -109,7 +118,7 @@
|
|
109
118
|
</table>
|
110
119
|
|
111
120
|
<% if @adyen_admin_cfg %>
|
112
|
-
<a href="
|
121
|
+
<a href="/sync">Sync with remote Adyen Admin<a>
|
113
122
|
<% end %>
|
114
123
|
</div>
|
115
124
|
</div>
|
@@ -1,17 +1,18 @@
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
3
3
|
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title><%= @skin.code %> - Adyen-Skinbuilder</title>
|
5
6
|
|
6
7
|
<link rel="stylesheet" media="screen" type="text/css" href="/hpp/css/reset.css" />
|
7
8
|
|
8
|
-
<link rel="stylesheet" media="screen" type="text/css" href="/sf/<%= @
|
9
|
-
<link rel="stylesheet" media="print" type="text/css" href="/sf/<%= @
|
9
|
+
<link rel="stylesheet" media="screen" type="text/css" href="/sf/<%= @skin.code %>/css/screen.css" />
|
10
|
+
<link rel="stylesheet" media="print" type="text/css" href="/sf/<%= @skin.code %>/css/print.css" />
|
10
11
|
|
11
12
|
<script type="text/javascript" src="/hpp/js/default.js"></script>
|
12
|
-
<script type="text/javascript" src="/sf/<%= @
|
13
|
+
<script type="text/javascript" src="/sf/<%= @skin.code %>/js/custom.js"></script>
|
13
14
|
<!--[if lt IE 7]>
|
14
|
-
<link rel="stylesheet" type="text/css" href="/sf/<%= @
|
15
|
+
<link rel="stylesheet" type="text/css" href="/sf/<%= @skin.code %>/css/screen_ie6.css" />
|
15
16
|
<![endif]-->
|
16
17
|
</head>
|
17
18
|
<body>
|
@@ -6,7 +6,7 @@ describe 'SkinBuilder server' do
|
|
6
6
|
include Rack::Test::Methods
|
7
7
|
|
8
8
|
let(:skins_directory) { File.expand_path(File.join(File.dirname(__FILE__), '../../fixtures/skins')) }
|
9
|
-
let(:skin_code) { "
|
9
|
+
let(:skin_code) { "DV3tf95f" }
|
10
10
|
|
11
11
|
def app
|
12
12
|
Adyen::SkinBuilder::Server.tap do |app|
|
@@ -16,13 +16,15 @@ describe 'SkinBuilder server' do
|
|
16
16
|
|
17
17
|
before do
|
18
18
|
Adyen::Admin.stub(:login)
|
19
|
+
Adyen::Admin::Skin.purge_cache
|
20
|
+
Adyen::Admin::Skin.default_path = skins_directory
|
19
21
|
end
|
20
22
|
|
21
23
|
describe 'assets' do
|
22
24
|
let(:file) { '/css/screen.css' }
|
23
25
|
|
24
26
|
before(:each) do
|
25
|
-
get "/sf"
|
27
|
+
get File.join( "/sf", skin_code, file)
|
26
28
|
end
|
27
29
|
|
28
30
|
it 'responds with 200 status' do
|
@@ -34,7 +36,7 @@ describe 'SkinBuilder server' do
|
|
34
36
|
end
|
35
37
|
|
36
38
|
it 'returns file content' do
|
37
|
-
last_response.body.should == File.read(skins_directory
|
39
|
+
last_response.body.should == File.read(File.join(skins_directory, skin_code, file))
|
38
40
|
end
|
39
41
|
|
40
42
|
context 'file not available, falls back to base' do
|
@@ -54,130 +56,132 @@ describe 'SkinBuilder server' do
|
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
describe 'GET
|
58
|
-
|
59
|
+
describe 'GET' do
|
60
|
+
describe '/' do
|
61
|
+
let(:path) { '/' }
|
62
|
+
|
59
63
|
before(:each) do
|
60
64
|
get path
|
61
65
|
end
|
62
66
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
it 'responds with 200 status' do
|
67
|
-
last_response.status.should == 200
|
68
|
-
end
|
67
|
+
it 'responds with 200 status' do
|
68
|
+
last_response.status.should == 200
|
69
|
+
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
it 'returns adyen skeleton in HTML format' do
|
72
|
+
last_response.headers.fetch('Content-Type').should == 'text/html;charset=utf-8'
|
73
|
+
end
|
73
74
|
|
74
|
-
|
75
|
-
|
76
|
-
|
75
|
+
it 'returns skins_directory' do
|
76
|
+
last_response.body.should include(skins_directory)
|
77
|
+
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
end
|
79
|
+
it 'returns avilable skins' do
|
80
|
+
last_response.body.should include(skin_code)
|
81
81
|
end
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
-
|
84
|
+
describe "/:skin_code" do
|
85
|
+
let(:path) { "/#{skin_code}" }
|
85
86
|
|
86
|
-
|
87
|
-
|
88
|
-
|
87
|
+
before(:each) do
|
88
|
+
get path
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'responds with 200 status' do
|
92
|
+
last_response.status.should == 200
|
93
|
+
end
|
89
94
|
|
90
|
-
|
91
|
-
|
92
|
-
|
95
|
+
it 'returns adyen skeleton in HTML format' do
|
96
|
+
last_response.headers.fetch('Content-Type').should == 'text/html;charset=utf-8'
|
97
|
+
end
|
93
98
|
|
94
|
-
|
95
|
-
|
96
|
-
|
99
|
+
it 'returns adyen form' do
|
100
|
+
last_response.body.should include('<form id="pageform" action="" method="post" onsubmit="return formValidate(this);">')
|
101
|
+
end
|
97
102
|
|
98
|
-
|
99
|
-
|
100
|
-
end
|
103
|
+
it 'returns order data' do
|
104
|
+
last_response.body.should include(File.read(File.join(skins_directory, skin_code, 'inc/order_data.txt')))
|
101
105
|
end
|
102
106
|
end
|
103
107
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
+
describe "/compile" do
|
109
|
+
let(:skin_code) { "JH0815" }
|
110
|
+
let(:path) { "/#{skin_code}/compile" }
|
111
|
+
let(:skin_dir) { File.join(skins_directory, skin_code) }
|
108
112
|
|
109
|
-
|
110
|
-
|
111
|
-
|
113
|
+
before do
|
114
|
+
get path
|
115
|
+
end
|
112
116
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
+
after do
|
118
|
+
FileUtils.rm_rf( skin_dir + '/inc')
|
119
|
+
`rm #{skin_code}.zip`
|
120
|
+
end
|
117
121
|
|
118
|
-
|
119
|
-
|
120
|
-
|
122
|
+
it 'writes cheader' do
|
123
|
+
File.read( skin_dir + '/inc/cheader.txt').should == "<!-- ### inc/cheader_[locale].txt or inc/cheader.txt (fallback) ### -->"
|
124
|
+
end
|
121
125
|
|
122
|
-
|
123
|
-
|
124
|
-
|
126
|
+
it 'writes pmheader' do
|
127
|
+
File.read( skin_dir + '/inc/pmheader.txt').should == "<!-- ### inc/pmheader_[locale].txt or inc/pmheader.txt (fallback) ### -->"
|
128
|
+
end
|
125
129
|
|
126
|
-
|
127
|
-
|
128
|
-
|
130
|
+
it 'writes pmfooter' do
|
131
|
+
File.read( skin_dir + '/inc/pmfooter.txt').should == "<!-- ### inc/pmfooter_[locale].txt or inc/pmfooter.txt (fallback) ### -->\n\n <!-- ### inc/customfields_[locale].txt or inc/customfields.txt (fallback) ### -->"
|
132
|
+
end
|
129
133
|
|
130
|
-
|
131
|
-
|
132
|
-
|
134
|
+
it 'writes cfooter' do
|
135
|
+
File.read( skin_dir + '/inc/cfooter.txt').should == "<!-- ### inc/cfooter_[locale].txt or inc/cfooter.txt (fallback) ### -->"
|
136
|
+
end
|
133
137
|
|
134
|
-
|
135
|
-
|
136
|
-
end
|
138
|
+
it "returns zip file" do
|
139
|
+
last_response.headers["Content-Type"].should == "application/zip"
|
137
140
|
end
|
141
|
+
end
|
138
142
|
|
139
|
-
|
140
|
-
|
141
|
-
|
143
|
+
describe "/upload" do
|
144
|
+
let(:path) { "/#{skin_code}/upload" }
|
145
|
+
let!(:skin) { Adyen::Admin::Skin.new(:path => File.join(skins_directory, skin_code)) }
|
146
|
+
let(:skin_dir) { File.join(skins_directory, skin_code) }
|
142
147
|
|
143
|
-
|
144
|
-
|
145
|
-
|
148
|
+
after do
|
149
|
+
`rm -rf #{skin_dir}/inc/*er.txt`
|
150
|
+
end
|
146
151
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
end
|
152
|
+
it "calls upload on skin" do
|
153
|
+
Adyen::Admin::Skin.should_receive(:find).and_return(skin)
|
154
|
+
skin.should_receive(:upload)
|
155
|
+
get path
|
152
156
|
end
|
157
|
+
end
|
153
158
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
159
|
+
describe "/download" do
|
160
|
+
let(:skin_code) { "vQW0fEo8" }
|
161
|
+
let(:path) { "/#{skin_code}/download" }
|
162
|
+
let(:skin) { Adyen::Admin::Skin.new(:code => skin_code) }
|
158
163
|
|
159
|
-
|
160
|
-
|
161
|
-
|
164
|
+
before do
|
165
|
+
`cp spec/fixtures/example.zip spec/fixtures/#{skin_code}.zip`
|
166
|
+
end
|
162
167
|
|
163
|
-
|
164
|
-
|
165
|
-
|
168
|
+
after do
|
169
|
+
`rm -rf #{skin.path}`
|
170
|
+
end
|
166
171
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
172
|
+
it "call download on skin" do
|
173
|
+
Adyen::Admin::Skin.should_receive(:find).and_return(skin)
|
174
|
+
skin.should_receive(:download).and_return("spec/fixtures/#{skin_code}.zip")
|
175
|
+
get path
|
176
|
+
File.should be_exists("spec/fixtures/skins/#{skin_code}/skin.html.erb")
|
177
|
+
end
|
173
178
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
179
|
+
# it "copies skin template" do
|
180
|
+
# Adyen::Admin::Skin.should_receive(:find).and_return(skin)
|
181
|
+
# skin.should_receive(:download).and_return("spec/fixtures/#{skin_code}.zip")
|
182
|
+
# get path
|
178
183
|
|
179
|
-
|
180
|
-
end
|
184
|
+
# end
|
181
185
|
end
|
182
186
|
end
|
183
187
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adyen-skinbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Priit Haamer
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-04-
|
19
|
+
date: 2012-04-27 00:00:00 +03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|