friends 0.28 → 0.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -4
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +2 -0
  5. data/CHANGELOG.md +13 -0
  6. data/README.md +35 -5
  7. data/Rakefile +1 -1
  8. data/bin/friends +7 -379
  9. data/friends.gemspec +3 -1
  10. data/lib/friends/activity.rb +4 -4
  11. data/lib/friends/commands/add.rb +64 -0
  12. data/lib/friends/commands/clean.rb +9 -0
  13. data/lib/friends/commands/edit.rb +12 -0
  14. data/lib/friends/commands/graph.rb +56 -0
  15. data/lib/friends/commands/list.rb +143 -0
  16. data/lib/friends/commands/remove.rb +27 -0
  17. data/lib/friends/commands/rename.rb +30 -0
  18. data/lib/friends/commands/set.rb +14 -0
  19. data/lib/friends/commands/stats.rb +11 -0
  20. data/lib/friends/commands/suggest.rb +20 -0
  21. data/lib/friends/commands/update.rb +29 -0
  22. data/lib/friends/graph.rb +7 -7
  23. data/lib/friends/introvert.rb +23 -18
  24. data/lib/friends/version.rb +1 -1
  25. data/test/commands/add/activity_spec.rb +379 -0
  26. data/test/commands/add/friend_spec.rb +30 -0
  27. data/test/commands/add/location_spec.rb +30 -0
  28. data/test/commands/add/nickname_spec.rb +50 -0
  29. data/test/commands/add/tag_spec.rb +65 -0
  30. data/test/commands/clean_spec.rb +39 -0
  31. data/test/commands/graph_spec.rb +147 -0
  32. data/test/commands/help_spec.rb +45 -0
  33. data/test/commands/list/activities_spec.rb +136 -0
  34. data/test/commands/list/favorite/friends_spec.rb +77 -0
  35. data/test/commands/list/favorite/locations_spec.rb +82 -0
  36. data/test/commands/list/friends_spec.rb +76 -0
  37. data/test/commands/list/locations_spec.rb +35 -0
  38. data/test/commands/list/tags_spec.rb +58 -0
  39. data/test/commands/remove/nickname_spec.rb +63 -0
  40. data/test/commands/remove/tag_spec.rb +64 -0
  41. data/test/commands/rename/friend_spec.rb +55 -0
  42. data/test/commands/rename/location_spec.rb +43 -0
  43. data/test/commands/set/location_spec.rb +54 -0
  44. data/test/commands/stats_spec.rb +41 -0
  45. data/test/commands/suggest_spec.rb +86 -0
  46. data/test/commands/update_spec.rb +13 -0
  47. data/test/helper.rb +114 -0
  48. metadata +89 -15
  49. data/test/activity_spec.rb +0 -597
  50. data/test/friend_spec.rb +0 -241
  51. data/test/graph_spec.rb +0 -92
  52. data/test/introvert_spec.rb +0 -969
  53. data/test/location_spec.rb +0 -60
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "./test/helper"
4
-
5
- describe Friends::Location do
6
- let(:location_name) { "Jacob Evelyn" }
7
- let(:loc) { Friends::Location.new(name: location_name) }
8
-
9
- describe ".deserialize" do
10
- subject { Friends::Location.deserialize(serialized_str) }
11
-
12
- describe "when string is well-formed" do
13
- let(:serialized_str) do
14
- "#{Friends::Location::SERIALIZATION_PREFIX}#{location_name}"
15
- end
16
-
17
- it "creates a location with the correct name" do
18
- subject.name.must_equal location_name
19
- end
20
- end
21
-
22
- describe "when string is malformed" do
23
- let(:serialized_str) { "" }
24
-
25
- it { proc { subject }.must_raise Serializable::SerializationError }
26
- end
27
- end
28
-
29
- describe "#new" do
30
- subject { loc }
31
-
32
- it { subject.name.must_equal location_name }
33
- end
34
-
35
- describe "#serialize" do
36
- subject { loc.serialize }
37
-
38
- it do
39
- subject.must_equal(
40
- "#{Friends::Location::SERIALIZATION_PREFIX}#{location_name}"
41
- )
42
- end
43
- end
44
-
45
- describe "#regex_for_name" do
46
- subject { loc.regex_for_name }
47
-
48
- it "generates an appropriate regex" do
49
- (!!(subject =~ location_name)).must_equal true
50
- end
51
- end
52
-
53
- describe "#<=>" do
54
- it "sorts alphabetically" do
55
- algeria = Friends::Location.new(name: "Algeria")
56
- zimbabwe = Friends::Location.new(name: "Zimbabwe")
57
- [zimbabwe, algeria].sort.must_equal [algeria, zimbabwe]
58
- end
59
- end
60
- end