abongo 1.0.2 → 1.0.3

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.
@@ -159,6 +159,12 @@ class Abongo
159
159
  tests_and_alternatives
160
160
  end
161
161
 
162
+ def self.is_human?(identity = nil)
163
+ identity ||= Abongo.identity
164
+ participant = Abongo.participants.find_one(:identity => identity)
165
+ return !!(participant && participant["human"])
166
+ end
167
+
162
168
  def self.human!(identity = nil)
163
169
  identity ||= Abongo.identity
164
170
  begin
@@ -1,4 +1,4 @@
1
1
  class Abongo
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  MAJOR_VERSION = '1'
4
4
  end
@@ -281,6 +281,15 @@ class TestAbongo < Test::Unit::TestCase
281
281
  assert_equal(1, alternative['conversions'])
282
282
  end
283
283
 
284
+ def test_is_human
285
+ Abongo.identity = 'ident'
286
+ Abongo.options[:count_humans_only] = true
287
+ assert_equal("alt1", Abongo.test('test_test', ['alt1', 'alt2']))
288
+ assert !Abongo.is_human?
289
+ Abongo.human!
290
+ assert Abongo.is_human?
291
+ end
292
+
284
293
  def test_count_humans_only_without_conversion_before_marked_human
285
294
  Abongo.identity = 'ident'
286
295
  Abongo.options[:count_humans_only] = true
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 2
9
- version: 1.0.2
8
+ - 3
9
+ version: 1.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Fairley