soapy_cake 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soapy_cake/admin_addedit.rb +6 -1
- data/lib/soapy_cake/version.rb +1 -1
- data/spec/lib/soapy_cake/admin_addedit_spec.rb +52 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f1b3eafd1d67264317255af0c6a0ec5a7bdf768
|
4
|
+
data.tar.gz: 060efd87807a74298141dc39000b59f029e06974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27b28c976de97f17fc8e15e3c2a8052d17855f3edc17fe07b1e116cb713f94fcfb2924fb18bd4ee014cfce5ebedecbfbdb6fe63e8ef5c2fe7330b00595f159de
|
7
|
+
data.tar.gz: f4242f62639da6318b213391528d4c6e7e43038567a4da2a8502c208348a04e8db0a84a608a7be5d84e10997cac1751ec9d6da1d2d85634d98141c6b7901b202
|
@@ -111,6 +111,10 @@ module SoapyCake
|
|
111
111
|
run Request.new(:admin, :addedit, :contact, opts)
|
112
112
|
end
|
113
113
|
|
114
|
+
def add_geo_targets(opts)
|
115
|
+
edit_geo_targets(opts.merge(add_edit_option: 'add'))
|
116
|
+
end
|
117
|
+
|
114
118
|
def edit_geo_targets(opts)
|
115
119
|
require_params(opts, %i(offer_contract_id allow_countries))
|
116
120
|
|
@@ -120,7 +124,8 @@ module SoapyCake
|
|
120
124
|
geo_targets_redirect_options(opts)
|
121
125
|
end
|
122
126
|
|
123
|
-
opts
|
127
|
+
opts[:add_edit_option] ||= 'replace'
|
128
|
+
opts[:set_targeting_to_geo] = true
|
124
129
|
|
125
130
|
run Request.new(:admin, :addedit, :geo_targets, opts)
|
126
131
|
end
|
data/lib/soapy_cake/version.rb
CHANGED
@@ -83,4 +83,56 @@ RSpec.describe SoapyCake::AdminAddedit do
|
|
83
83
|
admin_addedit.add_offer(offer_params.merge(tags: 'tag', tags_replace: true))
|
84
84
|
end
|
85
85
|
end
|
86
|
+
|
87
|
+
describe '#edit_geo_targets' do
|
88
|
+
let(:base_opts) do
|
89
|
+
{
|
90
|
+
offer_contract_id: 1,
|
91
|
+
allow_countries: true,
|
92
|
+
countries: %w(DE)
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'replaces the existing config by default' do
|
97
|
+
expect(SoapyCake::Request).to receive(:new)
|
98
|
+
.with(:admin, :addedit, :geo_targets,
|
99
|
+
hash_including(add_edit_option: 'replace'))
|
100
|
+
|
101
|
+
admin_addedit.edit_geo_targets(base_opts)
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'allows to override the add_edit_option' do
|
105
|
+
expect(SoapyCake::Request).to receive(:new)
|
106
|
+
.with(:admin, :addedit, :geo_targets,
|
107
|
+
hash_including(add_edit_option: 'add'))
|
108
|
+
|
109
|
+
admin_addedit.edit_geo_targets(base_opts.merge(add_edit_option: 'add'))
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'does not mutate the passed options' do
|
113
|
+
allow(SoapyCake::Request).to receive(:new)
|
114
|
+
|
115
|
+
opts_before = base_opts.dup
|
116
|
+
admin_addedit.edit_geo_targets(base_opts)
|
117
|
+
expect(base_opts).to eq(opts_before)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#add_geo_targets' do
|
122
|
+
let(:base_opts) do
|
123
|
+
{
|
124
|
+
offer_contract_id: 1,
|
125
|
+
allow_countries: true,
|
126
|
+
countries: %w(DE)
|
127
|
+
}
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'adds geo targets' do
|
131
|
+
expect(SoapyCake::Request).to receive(:new)
|
132
|
+
.with(:admin, :addedit, :geo_targets,
|
133
|
+
hash_including(add_edit_option: 'add'))
|
134
|
+
|
135
|
+
admin_addedit.add_geo_targets(base_opts)
|
136
|
+
end
|
137
|
+
end
|
86
138
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soapy_cake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ad2games GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|