friends 0.28 → 0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -0
- data/CHANGELOG.md +13 -0
- data/README.md +35 -5
- data/Rakefile +1 -1
- data/bin/friends +7 -379
- data/friends.gemspec +3 -1
- data/lib/friends/activity.rb +4 -4
- data/lib/friends/commands/add.rb +64 -0
- data/lib/friends/commands/clean.rb +9 -0
- data/lib/friends/commands/edit.rb +12 -0
- data/lib/friends/commands/graph.rb +56 -0
- data/lib/friends/commands/list.rb +143 -0
- data/lib/friends/commands/remove.rb +27 -0
- data/lib/friends/commands/rename.rb +30 -0
- data/lib/friends/commands/set.rb +14 -0
- data/lib/friends/commands/stats.rb +11 -0
- data/lib/friends/commands/suggest.rb +20 -0
- data/lib/friends/commands/update.rb +29 -0
- data/lib/friends/graph.rb +7 -7
- data/lib/friends/introvert.rb +23 -18
- data/lib/friends/version.rb +1 -1
- data/test/commands/add/activity_spec.rb +379 -0
- data/test/commands/add/friend_spec.rb +30 -0
- data/test/commands/add/location_spec.rb +30 -0
- data/test/commands/add/nickname_spec.rb +50 -0
- data/test/commands/add/tag_spec.rb +65 -0
- data/test/commands/clean_spec.rb +39 -0
- data/test/commands/graph_spec.rb +147 -0
- data/test/commands/help_spec.rb +45 -0
- data/test/commands/list/activities_spec.rb +136 -0
- data/test/commands/list/favorite/friends_spec.rb +77 -0
- data/test/commands/list/favorite/locations_spec.rb +82 -0
- data/test/commands/list/friends_spec.rb +76 -0
- data/test/commands/list/locations_spec.rb +35 -0
- data/test/commands/list/tags_spec.rb +58 -0
- data/test/commands/remove/nickname_spec.rb +63 -0
- data/test/commands/remove/tag_spec.rb +64 -0
- data/test/commands/rename/friend_spec.rb +55 -0
- data/test/commands/rename/location_spec.rb +43 -0
- data/test/commands/set/location_spec.rb +54 -0
- data/test/commands/stats_spec.rb +41 -0
- data/test/commands/suggest_spec.rb +86 -0
- data/test/commands/update_spec.rb +13 -0
- data/test/helper.rb +114 -0
- metadata +89 -15
- data/test/activity_spec.rb +0 -597
- data/test/friend_spec.rb +0 -241
- data/test/graph_spec.rb +0 -92
- data/test/introvert_spec.rb +0 -969
- data/test/location_spec.rb +0 -60
data/test/location_spec.rb
DELETED
@@ -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
|