shareprogress 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a7ff16026620a0a3a79d334f2686ca529b5d63d9
4
+ data.tar.gz: 49943db011437445cb7043cbff330379502b1ec3
5
+ SHA512:
6
+ metadata.gz: e942769c2221619479cd1e6fa38d0623268b2a330a96bea62f7e6dc512caf243acc62259dceebc5b0e9f7777174d901bbddb5db37cc3b2fa18309d280e57122b
7
+ data.tar.gz: f08502dce4e30f60338a2598226dd263361b7c179861625326842ab5049ea400fb997895671d6a52d69e067807728663cd48273d7453a525fe1b202299236f59
data/.gems ADDED
@@ -0,0 +1,3 @@
1
+ cutest -v 1.2.2
2
+ requests -v 1.0.0
3
+ scrivener -v 1.0.0
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ .gs
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # shareprogress
2
+
3
+ The shareprogress library is designed to be a Ruby interface to the [ShareProgress](http://www.shareprogress.org/)
4
+ API. It provides a simple Plain Old Ruby Object interface to the API.
5
+
6
+ ##Installation
7
+
8
+ ```
9
+ $ gem install shareprogress
10
+ ```
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ task :test do
2
+ puts `cutest ./test/*.rb`
3
+ end
@@ -0,0 +1,47 @@
1
+ class NewButton < Scrivener
2
+ attr_accessor :key, :page_url, :button_template, :page_title
3
+ attr_accessor :auto_fill, :advanced_options, :variants
4
+
5
+ def validate
6
+ assert_present :key
7
+ assert_url :page_url
8
+
9
+ assert_member :button_template, %w{sp_em_small sp_em_large sp_tw_small
10
+ sp_tw_large sp_fb_small sp_fb_large}
11
+
12
+ assert_present :variants
13
+
14
+ if auto_fill
15
+ assert auto_fill == false || auto_fill == true, [:auto_fill, :not_boolean]
16
+ end
17
+
18
+ if advanced_options
19
+ if advanced_options["automatic_traffic_routing"]
20
+ assert advanced_options["automatic_traffic_routing"] == false ||
21
+ advanced_options["automatic_traffic_routing"] == true, [:automatic_traffic_routing, :not_boolean]
22
+ end
23
+
24
+ if advanced_options["buttons_optimize_actions"]
25
+ assert advanced_options["buttons_optimize_actions"] == false ||
26
+ advanced_options["buttons_optimize_actions"] == true, [:buttons_optimize_actions, :not_boolean]
27
+ end
28
+
29
+ if advanced_options["customize_params"]
30
+ cp = advanced_options["customize_params"]
31
+
32
+ assert !cp["param"].nil?, [:param, :not_present]
33
+ assert !cp["e"].nil?, [:e, :not_present]
34
+ assert !cp["f"].nil?, [:f, :not_present]
35
+ assert !cp["t"].nil?, [:t, :not_present]
36
+ assert !cp["o"].nil?, [:o, :not_present]
37
+ end
38
+
39
+ if advanced_options["id_pass"]
40
+ ip = advanced_options["id_pass"]
41
+
42
+ assert !ip["id"].nil?, [:id, :not_present]
43
+ assert !ip["passed"].nil?, [:passed, :not_present]
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,26 @@
1
+ class NewEmailVariants < Scrivener
2
+ attr_accessor :email, :button_template
3
+
4
+ def validate
5
+ assert_member :button_template, %w{sp_em_small sp_em_large}
6
+
7
+ if assert_present :email
8
+ email.each do |e|
9
+
10
+ if assert !e["email_subject"].nil?, [:email_subject, :nil]
11
+ assert !e["email_subject"].empty?, [:email_subject, :empty]
12
+ end
13
+
14
+ if assert !e["email_body"].nil?, [:email_body, :nil]
15
+
16
+ if assert !e["email_body"].empty?, [:email_body, :empty]
17
+ assert e["email_body"].include?("{LINK}"), [:email_body, :link_not_included]
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ class NewFacebookVariants < Scrivener
2
+ attr_accessor :facebook, :button_template
3
+
4
+ def validate
5
+ assert_member :button_template, %w{sp_fb_small sp_fb_large}
6
+
7
+ if assert_present :facebook
8
+ facebook.each do |f|
9
+
10
+ if assert !f["facebook_title"].nil?, [:facebook_title, :nil]
11
+ assert !f["facebook_title"].empty?, [:facebook_title, :empty]
12
+ end
13
+
14
+ if assert !f["facebook_description"].nil?, [:facebook_description, :nil]
15
+ assert !f["facebook_description"].empty?, [:facebook_description, :empty]
16
+ end
17
+
18
+ if assert !f["facebook_thumbnail"].nil?, [:facebook_thumbnail, :nil]
19
+ assert !f["facebook_thumbnail"].empty?, [:facebook_thumbnail, :empty]
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,21 @@
1
+ class NewTwitterVariants < Scrivener
2
+ attr_accessor :twitter, :button_template
3
+
4
+ def validate
5
+ assert_member :button_template, %w{sp_tw_small sp_tw_large}
6
+
7
+ if assert_present :twitter
8
+ twitter.each do |t|
9
+
10
+ if assert !t["twitter_message"].nil?, [:twitter_message, :nil]
11
+
12
+ if assert !t["twitter_message"].empty?, [:twitter_message, :empty]
13
+ assert t["twitter_message"].include?("{LINK}"), [:twitter_message, :link_not_included]
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,143 @@
1
+ require "scrivener"
2
+ require "requests"
3
+
4
+ require_relative "shareprogress/filters/new_button"
5
+ require_relative "shareprogress/filters/new_email_variants"
6
+ require_relative "shareprogress/filters/new_twitter_variants"
7
+ require_relative "shareprogress/filters/new_facebook_variants"
8
+
9
+ module ShareProgress
10
+ module Button
11
+ def self.request(method, payload)
12
+ case method
13
+ when "create"
14
+ url = "https://run.shareprogress.org/api/v1/buttons/update"
15
+ when "update"
16
+ # ...
17
+ end
18
+
19
+ response = Requests.request("POST", url,
20
+ data: JSON.dump(payload),
21
+ headers: { "Content-Type" => "application/json" }
22
+ )
23
+
24
+ return JSON.parse(response.body)
25
+ end
26
+
27
+ def self.create(data)
28
+ # Validates the input (a hash) to send a POST request to
29
+ # ShareProgress to create a share button. The result could be:
30
+ # a) A hash containing the information of the created button or,
31
+ # b) An Error message from ShareProgress (i.e. 'Bad API key').
32
+
33
+ # Arguments received:
34
+ # data: A hash containing all the info about the button. For example:
35
+ # {
36
+ # "key" => "123456",
37
+ # "page_url" => "http://sumofus.org/",
38
+ # "page_title" => "My button name",
39
+ # "auto_fill" => true,
40
+ # "button_template" => "sp_em_large",
41
+ # "variants" => {
42
+ # "email" => [
43
+ # {"email_subject" => "Email subject 1!",
44
+ # "email_body" => "Email body 1 {LINK}"},
45
+ # {"email_subject" => "Email subject 2!",
46
+ # "email_body" => "Email body 2 {LINK}"},
47
+ # {"email_subject" => "Email subject 3!",
48
+ # "email_body" => "Email body 3 {LINK}"}
49
+ # ]
50
+ # },
51
+ # "advanced_options" => {
52
+ # "automatic_traffic_routing" => true,
53
+ # "buttons_optimize_actions" => true,
54
+ # "customize_params" => {
55
+ # "param" => "param_to_use",
56
+ # "e" => "email_source",
57
+ # "f" => "facebook_source",
58
+ # "t" => "twitter_source",
59
+ # "o" => "dark_social_source"
60
+ # },
61
+ # "id_pass" => {
62
+ # "id" => "id",
63
+ # "passed" => "referrer_id"
64
+ # }
65
+ # }
66
+ # }
67
+
68
+ # Example of a successful response:
69
+ # {
70
+ # "id"=>12136,
71
+ # "page_url"=>"http://sumofus.org/",
72
+ # "page_title"=>"My button name",
73
+ # "button_template"=>"sp_em_large",
74
+ # "share_button_html"=>"<div class='sp_12136 sp_em_large' ></div>",
75
+ # "found_snippet"=>false,
76
+ # "is_active"=>false,
77
+ # "variants"=>{
78
+ # "facebook"=>[{
79
+ # "id"=>48542,
80
+ # "facebook_title"=>"SumOfUs",
81
+ # "facebook_description"=>"SumOfUs is a global movement of "\
82
+ # "consumers, investors, and workers all around the world, "\
83
+ # "standing together to hold corporations accountable for their "\
84
+ # "actions and forge a new, sustainable and just path for our "\
85
+ # "global economy. It's not going to be fast or easy. B",
86
+ # "facebook_thumbnail"=>"http://sumofus.org/wp-content/themes/pgm/"\
87
+ # "img/default-facebook.jpg"}],
88
+ # "email"=>[{
89
+ # "id"=>48539,
90
+ # "email_subject"=>"Email subject 1!",
91
+ # "email_body"=>"Email body 1 {LINK}"}, {
92
+ # "id"=>48540,
93
+ # "email_subject"=>"Email subject 2!",
94
+ # "email_body"=>"Email body 2 {LINK}"}, {
95
+ # "id"=>48541,
96
+ # "email_subject"=>"Email subject 3!",
97
+ # "email_body"=>"Email body 3 {LINK}"}],
98
+ # "twitter"=>[{
99
+ # "id"=>48543,
100
+ # "twitter_message"=>"SumOfUs {LINK}"}]},
101
+ # "advanced_options"=>{
102
+ # "automatic_traffic_routing"=>true,
103
+ # "buttons_optimize_actions"=>true,
104
+ # "customize_params"=>{
105
+ # "param"=>"param_to_use",
106
+ # "e"=>"email_source",
107
+ # "f"=>"facebook_source",
108
+ # "t"=>"twitter_source",
109
+ # "o"=>"dark_social_source"},
110
+ # "id_pass"=>{
111
+ # "id"=>"id",
112
+ # "passed"=>"referrer_id"}}
113
+ # }
114
+ button = NewButton.new(data)
115
+
116
+ unless button.valid?
117
+ return button.errors
118
+ end
119
+
120
+ button_variants = button.variants.merge(button_template: button.button_template)
121
+
122
+ if button.variants["email"]
123
+ variants = NewEmailVariants.new(button_variants)
124
+ elsif button.variants["twitter"]
125
+ variants = NewTwitterVariants.new(button_variants)
126
+ elsif button.variants["facebook"]
127
+ variants = NewFacebookVariants.new(button_variants)
128
+ end
129
+
130
+ unless variants.valid?
131
+ return variants.errors
132
+ end
133
+
134
+ # send request to ShareProgress to create a button
135
+ begin
136
+ request = request("create", button.attributes)
137
+ return request["response"][0]
138
+ rescue Requests::Error => e
139
+ return JSON.parse(e.response.body)["message"]
140
+ end
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "shareprogress"
3
+ s.version = "0.0.1"
4
+ s.summary = "Ruby gem to communicate with ShareProgress API"
5
+ s.description = s.summary
6
+ s.authors = ["Cecilia Rivero"]
7
+ s.email = ["contact@ceciliarivero.com"]
8
+ s.homepage = "https://github.com/ceciliarivero/shareprogress-rb"
9
+ s.license = "MIT"
10
+
11
+ s.files = `git ls-files`.split("\n")
12
+
13
+ s.add_runtime_dependency "requests", "~> 0"
14
+ s.add_runtime_dependency "scrivener", "~> 0"
15
+
16
+ s.add_development_dependency "cutest", "~> 0"
17
+ end
@@ -0,0 +1,314 @@
1
+ require "cutest"
2
+ require_relative "../lib/shareprogress"
3
+
4
+ # Monkeypath the communication with ShareProgress
5
+ module ShareProgress
6
+ module Button
7
+ def self.request(method, payload)
8
+ return {
9
+ "success"=>true,
10
+ "response"=>[{
11
+ "id"=>12136,
12
+ "page_url"=>"http://sumofus.org/",
13
+ "page_title"=>"My button name",
14
+ "button_template"=>"sp_em_large",
15
+ "share_button_html"=>"<div class='sp_12136 sp_em_large' ></div>",
16
+ "found_snippet"=>false,
17
+ "is_active"=>false,
18
+ "variants"=>{
19
+ "facebook"=>[{
20
+ "id"=>48542,
21
+ "facebook_title"=>"SumOfUs",
22
+ "facebook_description"=>"SumOfUs is a global movement of "\
23
+ "consumers, investors, and workers all around the world, standing "\
24
+ "together to hold corporations accountable for their actions and "\
25
+ "forge a new, sustainable and just path for our global economy. "\
26
+ "It's not going to be fast or easy. B",
27
+ "facebook_thumbnail"=>"http://sumofus.org/wp-content/themes/"\
28
+ "pgm/img/default-facebook.jpg"}],
29
+ "email"=>[{
30
+ "id"=>48539,
31
+ "email_subject"=>"Email subject 1!",
32
+ "email_body"=>"Email body 1 {LINK}"}, {
33
+ "id"=>48540,
34
+ "email_subject"=>"Email subject 2!",
35
+ "email_body"=>"Email body 2 {LINK}"}, {
36
+ "id"=>48541,
37
+ "email_subject"=>"Email subject 3!",
38
+ "email_body"=>"Email body 3 {LINK}"}],
39
+ "twitter"=>[{
40
+ "id"=>48543,
41
+ "twitter_message"=>"SumOfUs {LINK}"}]},
42
+ "advanced_options"=>{
43
+ "automatic_traffic_routing"=>true,
44
+ "buttons_optimize_actions"=>true,
45
+ "customize_params"=>{
46
+ "param"=>"param_to_use",
47
+ "e"=>"email_source",
48
+ "f"=>"facebook_source",
49
+ "t"=>"twitter_source",
50
+ "o"=>"dark_social_source"},
51
+ "id_pass"=>{
52
+ "id"=>"id",
53
+ "passed"=>"referrer_id"}}}],
54
+ "message"=>nil
55
+ }
56
+ end
57
+ end
58
+ end
59
+
60
+ setup do
61
+ {
62
+ "key" => "123456",
63
+ "page_url" => "http://sumofus.org/",
64
+ "page_title" => "My button name",
65
+ "auto_fill" => true,
66
+ "button_template" => "sp_em_large",
67
+ "variants" => {
68
+ "email" => [
69
+ {"email_subject" => "Email subject 1!",
70
+ "email_body" => "Email body 1 {LINK}"},
71
+ {"email_subject" => "Email subject 2!",
72
+ "email_body" => "Email body 2 {LINK}"},
73
+ {"email_subject" => "Email subject 3!",
74
+ "email_body" => "Email body 3 {LINK}"}
75
+ ]
76
+ },
77
+ "advanced_options" => {
78
+ "automatic_traffic_routing" => true,
79
+ "buttons_optimize_actions" => true,
80
+ "customize_params" => {
81
+ "param" => "param_to_use",
82
+ "e" => "email_source",
83
+ "f" => "facebook_source",
84
+ "t" => "twitter_source",
85
+ "o" => "dark_social_source"
86
+ },
87
+ "id_pass" => {
88
+ "id" => "id",
89
+ "passed" => "referrer_id"
90
+ }
91
+ }
92
+ }
93
+ end
94
+
95
+ scope do
96
+ # all
97
+ test "create button successfully" do |data|
98
+ result = ShareProgress::Button.create(data)
99
+
100
+ expected_result = {
101
+ "id"=>12136,
102
+ "page_url"=>"http://sumofus.org/",
103
+ "page_title"=>"My button name",
104
+ "button_template"=>"sp_em_large",
105
+ "share_button_html"=>"<div class='sp_12136 sp_em_large' ></div>",
106
+ "found_snippet"=>false,
107
+ "is_active"=>false,
108
+ "variants"=>{
109
+ "facebook"=>[{
110
+ "id"=>48542,
111
+ "facebook_title"=>"SumOfUs",
112
+ "facebook_description"=>"SumOfUs is a global movement of "\
113
+ "consumers, investors, and workers all around the world, "\
114
+ "standing together to hold corporations accountable for their "\
115
+ "actions and forge a new, sustainable and just path for our "\
116
+ "global economy. It's not going to be fast or easy. B",
117
+ "facebook_thumbnail"=>"http://sumofus.org/wp-content/themes/pgm/"\
118
+ "img/default-facebook.jpg"}],
119
+ "email"=>[{
120
+ "id"=>48539,
121
+ "email_subject"=>"Email subject 1!",
122
+ "email_body"=>"Email body 1 {LINK}"}, {
123
+ "id"=>48540,
124
+ "email_subject"=>"Email subject 2!",
125
+ "email_body"=>"Email body 2 {LINK}"}, {
126
+ "id"=>48541,
127
+ "email_subject"=>"Email subject 3!",
128
+ "email_body"=>"Email body 3 {LINK}"}],
129
+ "twitter"=>[{
130
+ "id"=>48543,
131
+ "twitter_message"=>"SumOfUs {LINK}"}]},
132
+ "advanced_options"=>{
133
+ "automatic_traffic_routing"=>true,
134
+ "buttons_optimize_actions"=>true,
135
+ "customize_params"=>{
136
+ "param"=>"param_to_use",
137
+ "e"=>"email_source",
138
+ "f"=>"facebook_source",
139
+ "t"=>"twitter_source",
140
+ "o"=>"dark_social_source"},
141
+ "id_pass"=>{
142
+ "id"=>"id",
143
+ "passed"=>"referrer_id"}}
144
+ }
145
+
146
+ assert result == expected_result
147
+ end
148
+
149
+ # key
150
+ test "create button with no key" do |data|
151
+ data["key"] = nil
152
+
153
+ result = ShareProgress::Button.create(data)
154
+
155
+ expected_result = {:key=>[:not_present]}
156
+
157
+ assert result == expected_result
158
+ end
159
+
160
+ # page_url
161
+ test "create button with no page_url" do |data|
162
+ data["page_url"] = nil
163
+
164
+ result = ShareProgress::Button.create(data)
165
+
166
+ expected_result = {:page_url=>[:not_url]}
167
+
168
+ assert result == expected_result
169
+ end
170
+
171
+ # button_template
172
+ test "create button with nil button_template" do |data|
173
+ data["button_template"] = nil
174
+
175
+ result = ShareProgress::Button.create(data)
176
+
177
+ expected_result = {:button_template=>[:not_valid]}
178
+
179
+ assert result == expected_result
180
+ end
181
+
182
+ test "create button with empty button_template" do |data|
183
+ data["button_template"] = nil
184
+
185
+ result = ShareProgress::Button.create(data)
186
+
187
+ expected_result = {:button_template=>[:not_valid]}
188
+
189
+ assert result == expected_result
190
+ end
191
+
192
+ test "create button with wrong button_template" do |data|
193
+ data["button_template"] = "wrong_button_template"
194
+
195
+ result = ShareProgress::Button.create(data)
196
+
197
+ expected_result = {:button_template=>[:not_valid]}
198
+
199
+ assert result == expected_result
200
+ end
201
+
202
+ # auto_fill
203
+ test "create button with not boolean auto_fill" do |data|
204
+ data["auto_fill"] = ""
205
+
206
+ result = ShareProgress::Button.create(data)
207
+
208
+ expected_result = {:auto_fill=>[:not_boolean]}
209
+
210
+ assert result == expected_result
211
+ end
212
+
213
+ # variants
214
+ test "create button with no variants" do |data|
215
+ data["variants"] = nil
216
+
217
+ result = ShareProgress::Button.create(data)
218
+
219
+ expected_result = {:variants=>[:not_present]}
220
+
221
+ assert result == expected_result
222
+ end
223
+
224
+ # advanced_options
225
+ test "create button with not boolean automatic_traffic_routing" do |data|
226
+ data["advanced_options"]["automatic_traffic_routing"] = ""
227
+
228
+ result = ShareProgress::Button.create(data)
229
+
230
+ expected_result = {:automatic_traffic_routing=>[:not_boolean]}
231
+
232
+ assert result == expected_result
233
+ end
234
+
235
+ test "create button with not boolean buttons_optimize_actions" do |data|
236
+ data["advanced_options"]["buttons_optimize_actions"] = ""
237
+
238
+ result = ShareProgress::Button.create(data)
239
+
240
+ expected_result = {:buttons_optimize_actions=>[:not_boolean]}
241
+
242
+ assert result == expected_result
243
+ end
244
+
245
+ test "create button with no param in customize_params" do |data|
246
+ data["advanced_options"]["customize_params"]["param"] = nil
247
+
248
+ result = ShareProgress::Button.create(data)
249
+
250
+ expected_result = {:param=>[:not_present]}
251
+
252
+ assert result == expected_result
253
+ end
254
+
255
+ test "create button with no e in customize_params" do |data|
256
+ data["advanced_options"]["customize_params"]["e"] = nil
257
+
258
+ result = ShareProgress::Button.create(data)
259
+
260
+ expected_result = {:e=>[:not_present]}
261
+
262
+ assert result == expected_result
263
+ end
264
+
265
+ test "create button with no f in customize_params" do |data|
266
+ data["advanced_options"]["customize_params"]["f"] = nil
267
+
268
+ result = ShareProgress::Button.create(data)
269
+
270
+ expected_result = {:f=>[:not_present]}
271
+
272
+ assert result == expected_result
273
+ end
274
+
275
+ test "create button with no t in customize_params" do |data|
276
+ data["advanced_options"]["customize_params"]["t"] = nil
277
+
278
+ result = ShareProgress::Button.create(data)
279
+
280
+ expected_result = {:t=>[:not_present]}
281
+
282
+ assert result == expected_result
283
+ end
284
+
285
+ test "create button with no o in customize_params" do |data|
286
+ data["advanced_options"]["customize_params"]["o"] = nil
287
+
288
+ result = ShareProgress::Button.create(data)
289
+
290
+ expected_result = {:o=>[:not_present]}
291
+
292
+ assert result == expected_result
293
+ end
294
+
295
+ test "create button with no id in id_pass" do |data|
296
+ data["advanced_options"]["id_pass"]["id"] = nil
297
+
298
+ result = ShareProgress::Button.create(data)
299
+
300
+ expected_result = {:id=>[:not_present]}
301
+
302
+ assert result == expected_result
303
+ end
304
+
305
+ test "create button with no passed in id_pass" do |data|
306
+ data["advanced_options"]["id_pass"]["passed"] = nil
307
+
308
+ result = ShareProgress::Button.create(data)
309
+
310
+ expected_result = {:passed=>[:not_present]}
311
+
312
+ assert result == expected_result
313
+ end
314
+ end