lonely_coder 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,91 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Mailbox" do
4
+ it "tells you how full your mailbox is" do
5
+ VCR.use_cassette('loading_mailbox', :erb => {username: ENV['OKC_USERNAME'], password: ENV['OKC_PASSWORD']}) do
6
+ okc = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD'])
7
+ @mailbox = okc.mailbox
8
+ @mailbox.useage.should == {
9
+ current: 233,
10
+ max: 300
11
+ }
12
+ end
13
+ end
14
+
15
+ it "can access the first message, up to 30" do
16
+ VCR.use_cassette('loading_mailbox', :erb => {username: ENV['OKC_USERNAME'], password: ENV['OKC_PASSWORD']}) do
17
+ okc = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD'])
18
+ @mailbox = okc.mailbox
19
+ @mailbox.messages.count.should == 30
20
+ end
21
+ end
22
+
23
+ it "each message header is a header" do
24
+ VCR.use_cassette('loading_mailbox', :erb => {username: ENV['OKC_USERNAME'], password: ENV['OKC_PASSWORD']}) do
25
+ okc = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD'])
26
+ @mailbox = okc.mailbox
27
+ @mailbox.messages.all? {|m| m.is_a?(OKCupid::Mailbox::MessageSnippet)}.should == true
28
+ end
29
+ end
30
+ end
31
+
32
+ describe "Conversation" do
33
+ before(:each) do
34
+ VCR.use_cassette('loading_conversation') do
35
+ okc = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD'])
36
+ @conversation = okc.conversation_for('5887692615523576083')
37
+ end
38
+ end
39
+
40
+ it "has a from_profile_username" do
41
+ @conversation.from_profile_username.should == 'snowpea383'
42
+ end
43
+
44
+ it "contains a list of messages" do
45
+ @conversation.messages.count.should == 8
46
+ end
47
+
48
+ describe "each message" do
49
+ before(:each) do
50
+ @message = @conversation.messages.last
51
+ end
52
+
53
+ it "has a to_me" do
54
+ @message.to_me.should == true
55
+ end
56
+
57
+ it "has a from_me" do
58
+ @message.from_me.should == false
59
+ end
60
+ end
61
+ end
62
+
63
+ describe "MessageSnippet" do
64
+ before(:each) do
65
+ VCR.use_cassette('loading_mailbox', :erb => {username: ENV['OKC_USERNAME'], password: ENV['OKC_PASSWORD']}) do
66
+ okc = OKCupid.new(ENV['OKC_USERNAME'], ENV['OKC_PASSWORD'])
67
+ mailbox = okc.mailbox
68
+ @header = mailbox.messages.first
69
+ end
70
+ end
71
+
72
+ it "has a profile_username" do
73
+ @header.profile_username.should == 'teachforall'
74
+ end
75
+
76
+ it "has a profile_small_avatar_url" do
77
+ @header.profile_small_avatar_url.should == 'http://ak2.okccdn.com/php/load_okc_image.php/images/60x60/60x60/0x30/198x228/2/18256810077890846020.jpeg'
78
+ end
79
+
80
+ it "has a preview" do
81
+ @header.preview.should == 'No, I was there like a month ago. I live in EL so ...'
82
+ end
83
+
84
+ it "has a conversation_url" do
85
+ @header.conversation_url.should == '/messages?readmsg=true&threadid=9950201897626358080&folder=1'
86
+ end
87
+
88
+ it "has a last_date" do
89
+ @header.last_date.should == Date.new(2012, 03, 25)
90
+ end
91
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lonely_coder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-25 00:00:00.000000000 Z
12
+ date: 2012-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
@@ -55,6 +55,7 @@ files:
55
55
  - lib/lonely_coder.rb
56
56
  - lib/lonely_coder/authentication.rb
57
57
  - lib/lonely_coder/magic_constants.rb
58
+ - lib/lonely_coder/mailbox.rb
58
59
  - lib/lonely_coder/profile.rb
59
60
  - lib/lonely_coder/search.rb
60
61
  - lib/lonely_coder/search_pagination_parser.rb
@@ -63,6 +64,8 @@ files:
63
64
  - spec/cassettes/failed_authentication.yml
64
65
  - spec/cassettes/find_location.yml
65
66
  - spec/cassettes/load_profile_from_search.yml
67
+ - spec/cassettes/loading_conversation.yml
68
+ - spec/cassettes/loading_mailbox.yml
66
69
  - spec/cassettes/location_filter_looks_up_location_id.yml
67
70
  - spec/cassettes/paginate_search_results_by_10.yml
68
71
  - spec/cassettes/search_by_filters.yml
@@ -71,6 +74,7 @@ files:
71
74
  - spec/cassettes/successful_authentication.yml
72
75
  - spec/helper_spec.rb
73
76
  - spec/location_id_spec.rb
77
+ - spec/mailbox_spec.rb
74
78
  - spec/pagination_spec.rb
75
79
  - spec/paginator_spec.rb
76
80
  - spec/profile_spec.rb
@@ -106,6 +110,8 @@ test_files:
106
110
  - spec/cassettes/failed_authentication.yml
107
111
  - spec/cassettes/find_location.yml
108
112
  - spec/cassettes/load_profile_from_search.yml
113
+ - spec/cassettes/loading_conversation.yml
114
+ - spec/cassettes/loading_mailbox.yml
109
115
  - spec/cassettes/location_filter_looks_up_location_id.yml
110
116
  - spec/cassettes/paginate_search_results_by_10.yml
111
117
  - spec/cassettes/search_by_filters.yml
@@ -114,6 +120,7 @@ test_files:
114
120
  - spec/cassettes/successful_authentication.yml
115
121
  - spec/helper_spec.rb
116
122
  - spec/location_id_spec.rb
123
+ - spec/mailbox_spec.rb
117
124
  - spec/pagination_spec.rb
118
125
  - spec/paginator_spec.rb
119
126
  - spec/profile_spec.rb