friends 0.16 → 0.17

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.
@@ -0,0 +1,58 @@
1
+ require "./test/helper"
2
+
3
+ describe Friends::Location do
4
+ let(:location_name) { "Jacob Evelyn" }
5
+ let(:loc) { Friends::Location.new(name: location_name) }
6
+
7
+ describe ".deserialize" do
8
+ subject { Friends::Location.deserialize(serialized_str) }
9
+
10
+ describe "when string is well-formed" do
11
+ let(:serialized_str) do
12
+ "#{Friends::Location::SERIALIZATION_PREFIX}#{location_name}"
13
+ end
14
+
15
+ it "creates a location with the correct name" do
16
+ subject.name.must_equal location_name
17
+ end
18
+ end
19
+
20
+ describe "when string is malformed" do
21
+ let(:serialized_str) { "" }
22
+
23
+ it { proc { subject }.must_raise Serializable::SerializationError }
24
+ end
25
+ end
26
+
27
+ describe "#new" do
28
+ subject { loc }
29
+
30
+ it { subject.name.must_equal location_name }
31
+ end
32
+
33
+ describe "#serialize" do
34
+ subject { loc.serialize }
35
+
36
+ it do
37
+ subject.must_equal(
38
+ "#{Friends::Location::SERIALIZATION_PREFIX}#{location_name}"
39
+ )
40
+ end
41
+ end
42
+
43
+ describe "#regex_for_name" do
44
+ subject { loc.regex_for_name }
45
+
46
+ it "generates an appropriate regex" do
47
+ (!!(subject =~ location_name)).must_equal true
48
+ end
49
+ end
50
+
51
+ describe "#<=>" do
52
+ it "sorts alphabetically" do
53
+ algeria = Friends::Location.new(name: "Algeria")
54
+ zimbabwe = Friends::Location.new(name: "Zimbabwe")
55
+ [zimbabwe, algeria].sort.must_equal [algeria, zimbabwe]
56
+ end
57
+ end
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friends
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.16'
4
+ version: '0.17'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Evelyn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic
@@ -193,12 +193,15 @@ files:
193
193
  - lib/friends/friend.rb
194
194
  - lib/friends/friends_error.rb
195
195
  - lib/friends/introvert.rb
196
+ - lib/friends/location.rb
197
+ - lib/friends/regex_builder.rb
196
198
  - lib/friends/serializable.rb
197
199
  - lib/friends/version.rb
198
200
  - test/activity_spec.rb
199
201
  - test/friend_spec.rb
200
202
  - test/helper.rb
201
203
  - test/introvert_spec.rb
204
+ - test/location_spec.rb
202
205
  - test/tmp/.keep
203
206
  homepage: https://github.com/JacobEvelyn/friends
204
207
  licenses:
@@ -229,4 +232,5 @@ test_files:
229
232
  - test/friend_spec.rb
230
233
  - test/helper.rb
231
234
  - test/introvert_spec.rb
235
+ - test/location_spec.rb
232
236
  - test/tmp/.keep