DG MS removed unused fb_status model and respective specs, fixtures.
This commit is contained in:
parent
d32d47b790
commit
b17ae0bf38
6 changed files with 18 additions and 172 deletions
21
Gemfile.lock
21
Gemfile.lock
|
|
@ -98,6 +98,7 @@ GEM
|
||||||
activesupport (= 3.0.1)
|
activesupport (= 3.0.1)
|
||||||
activesupport (3.0.1)
|
activesupport (3.0.1)
|
||||||
addressable (2.2.2)
|
addressable (2.2.2)
|
||||||
|
archive-tar-minitar (0.5.2)
|
||||||
arel (1.0.1)
|
arel (1.0.1)
|
||||||
activesupport (~> 3.0.0)
|
activesupport (~> 3.0.0)
|
||||||
aws (2.3.22)
|
aws (2.3.22)
|
||||||
|
|
@ -184,7 +185,8 @@ GEM
|
||||||
launchy (0.3.7)
|
launchy (0.3.7)
|
||||||
configuration (>= 0.0.5)
|
configuration (>= 0.0.5)
|
||||||
rake (>= 0.8.1)
|
rake (>= 0.8.1)
|
||||||
linecache (0.43)
|
linecache19 (0.5.11)
|
||||||
|
ruby_core_source (>= 0.1.4)
|
||||||
mail (2.2.7)
|
mail (2.2.7)
|
||||||
activesupport (>= 2.3.6)
|
activesupport (>= 2.3.6)
|
||||||
mime-types
|
mime-types
|
||||||
|
|
@ -259,11 +261,16 @@ GEM
|
||||||
rspec-expectations (~> 2.0.1)
|
rspec-expectations (~> 2.0.1)
|
||||||
rspec-rails (2.0.1)
|
rspec-rails (2.0.1)
|
||||||
rspec (~> 2.0.0)
|
rspec (~> 2.0.0)
|
||||||
ruby-debug (0.10.3)
|
ruby-debug-base19 (0.11.24)
|
||||||
columnize (>= 0.1)
|
columnize (>= 0.3.1)
|
||||||
ruby-debug-base (~> 0.10.3.0)
|
linecache19 (>= 0.5.11)
|
||||||
ruby-debug-base (0.10.3)
|
ruby_core_source (>= 0.1.4)
|
||||||
linecache (>= 0.3)
|
ruby-debug19 (0.11.6)
|
||||||
|
columnize (>= 0.3.1)
|
||||||
|
linecache19 (>= 0.5.11)
|
||||||
|
ruby-debug-base19 (>= 0.11.19)
|
||||||
|
ruby_core_source (0.1.4)
|
||||||
|
archive-tar-minitar (>= 0.5.2)
|
||||||
rubyzip (0.9.4)
|
rubyzip (0.9.4)
|
||||||
selenium-webdriver (0.0.29)
|
selenium-webdriver (0.0.29)
|
||||||
childprocess (>= 0.0.7)
|
childprocess (>= 0.0.7)
|
||||||
|
|
@ -324,7 +331,7 @@ DEPENDENCIES
|
||||||
roxml!
|
roxml!
|
||||||
rspec (>= 2.0.0)
|
rspec (>= 2.0.0)
|
||||||
rspec-rails (>= 2.0.0)
|
rspec-rails (>= 2.0.0)
|
||||||
ruby-debug
|
ruby-debug19
|
||||||
sprinkle!
|
sprinkle!
|
||||||
thin
|
thin
|
||||||
webmock
|
webmock
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
# Copyright (c) 2010, Diaspora Inc. This file is
|
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
# the COPYRIGHT file.
|
|
||||||
|
|
||||||
|
|
||||||
class FbStatus
|
|
||||||
include MongoMapper::Document
|
|
||||||
|
|
||||||
key :graph_id, String
|
|
||||||
key :author_id, String
|
|
||||||
key :author_name, String
|
|
||||||
key :message, String
|
|
||||||
key :updated_time, Time
|
|
||||||
|
|
||||||
timestamps!
|
|
||||||
|
|
||||||
validates_presence_of :graph_id,:author_id,:author_name,:message,:updated_time
|
|
||||||
|
|
||||||
def self.from_api(hash)
|
|
||||||
#just keeping them in memory for now
|
|
||||||
self.new(
|
|
||||||
:graph_id => hash['id'],
|
|
||||||
:author_id => hash['from']['id'],
|
|
||||||
:author_name => hash['from']['name'],
|
|
||||||
:message => hash['message'],
|
|
||||||
:updated_time => Time.parse(hash['updated_time'])
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -71,10 +71,3 @@ end
|
||||||
|
|
||||||
Factory.define(:comment) {}
|
Factory.define(:comment) {}
|
||||||
|
|
||||||
Factory.define :fb_status do |s|
|
|
||||||
s.graph_id "367501354973"
|
|
||||||
s.author_name "Bret Taylor"
|
|
||||||
s.author_id "220439"
|
|
||||||
s.message "Pigs run from our house in fear. Tonight, I am wrapping the pork tenderloin in bacon and putting pancetta in the corn."
|
|
||||||
s.updated_time Time.parse "2010-03-06T02:57:48+0000"
|
|
||||||
end
|
|
||||||
|
|
|
||||||
79
spec/fixtures/fb_status
vendored
79
spec/fixtures/fb_status
vendored
|
|
@ -1,79 +0,0 @@
|
||||||
{
|
|
||||||
"id": "367501354973",
|
|
||||||
"from": {
|
|
||||||
"name": "Bret Taylor",
|
|
||||||
"id": "220439"
|
|
||||||
},
|
|
||||||
"message": "Pigs run from our house in fear. Tonight, I am wrapping the pork tenderloin in bacon and putting pancetta in the corn.",
|
|
||||||
"updated_time": "2010-03-06T02:57:48+0000",
|
|
||||||
"likes": {
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"id": "29906278",
|
|
||||||
"name": "Ross Miller"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"comments": {
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"id": "367501354973_12216733",
|
|
||||||
"from": {
|
|
||||||
"name": "Doug Edwards",
|
|
||||||
"id": "628675309"
|
|
||||||
},
|
|
||||||
"message": "Make sure you don't, as they say, go whole hog...\nhttp://www.youtube.com/watch?v=U4wTFuaV8VQ",
|
|
||||||
"created_time": "2010-03-06T03:24:46+0000"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "367501354973_12249673",
|
|
||||||
"from": {
|
|
||||||
"name": "Tom Taylor",
|
|
||||||
"id": "1249191863"
|
|
||||||
},
|
|
||||||
"message": "Are you and Karen gonna, as they say, pig out?",
|
|
||||||
"created_time": "2010-03-06T21:05:21+0000"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "367501354973_12249857",
|
|
||||||
"from": {
|
|
||||||
"name": "Sheila Taylor",
|
|
||||||
"id": "1315606682"
|
|
||||||
},
|
|
||||||
"message": "how did it turn out? Sounds nummy!\n",
|
|
||||||
"created_time": "2010-03-06T21:10:30+0000"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "367501354973_12250973",
|
|
||||||
"from": {
|
|
||||||
"name": "Bret Taylor",
|
|
||||||
"id": "220439"
|
|
||||||
},
|
|
||||||
"message": "Mom: turned out well. Sauce was good as well: pan sauce with mustard, balsamic, onion, and maple syrup. Surprisingly good in the end, and not too sweet, which was my concern. ",
|
|
||||||
"created_time": "2010-03-06T21:44:53+0000"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "367501354973_12251276",
|
|
||||||
"from": {
|
|
||||||
"name": "Sheila Taylor",
|
|
||||||
"id": "1315606682"
|
|
||||||
},
|
|
||||||
"message": "Sounds delicious! I probably would have skipped the maple syrup, but I am not married to a Canadian :)\n\nSheila Taylor\n(925) 818-7795\nP.O. Box 938\nGlen Ellen, CA 95442\nwww.winecountrytrekking.com",
|
|
||||||
"created_time": "2010-03-06T21:55:12+0000"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "367501354973_12264435",
|
|
||||||
"from": {
|
|
||||||
"name": "Amelia Ann Arapoff",
|
|
||||||
"id": "1580390378"
|
|
||||||
},
|
|
||||||
"message": "Bacon is always in our refrigerator, in case of need, somehow there is always need.",
|
|
||||||
"created_time": "2010-03-07T05:11:52+0000"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"paging": {
|
|
||||||
"previous": "https://graph.facebook.com/367501354973/comments?access_token=2227470867%7C2.wNlupL2HPsOtrlYFBF56NA__.3600.1285354800-100001548997697%7C8lZ_pdgNDvSHYS4o1OkqhdQu6mA&limit=25&since=2010-03-07T05%3A11%3A52%2B0000",
|
|
||||||
"next": "https://graph.facebook.com/367501354973/comments?access_token=2227470867%7C2.wNlupL2HPsOtrlYFBF56NA__.3600.1285354800-100001548997697%7C8lZ_pdgNDvSHYS4o1OkqhdQu6mA&limit=25&until=2010-03-06T03%3A24%3A45%2B0000"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -42,13 +42,11 @@ describe 'user encryption' do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'encryption' do
|
describe 'encryption' do
|
||||||
before do
|
|
||||||
@string = File.open(File.dirname(__FILE__) + '/../fixtures/fb_status').read
|
|
||||||
end
|
|
||||||
it 'should encrypt a string' do
|
it 'should encrypt a string' do
|
||||||
ciphertext = @user.encrypt @string
|
string = "Secretsauce"
|
||||||
ciphertext.include?(@string).should be false
|
ciphertext = @user.encrypt string
|
||||||
@user.decrypt(ciphertext).should == @string
|
ciphertext.include?(string).should be false
|
||||||
|
@user.decrypt(ciphertext).should == string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
# Copyright (c) 2010, Diaspora Inc. This file is
|
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
# the COPYRIGHT file.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require File.join(Rails.root,'spec/spec_helper')
|
|
||||||
|
|
||||||
|
|
||||||
describe FbStatus do
|
|
||||||
|
|
||||||
let(:fb_status) { Factory.create :fb_status }
|
|
||||||
|
|
||||||
it 'is valid' do
|
|
||||||
fb_status.should be_valid
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#from_api' do
|
|
||||||
let!(:json_string) {File.open(File.dirname(__FILE__) + '/../fixtures/fb_status').read}
|
|
||||||
let!(:json_object) { JSON.parse(json_string) }
|
|
||||||
let!(:status_from_json) {FbStatus.from_api(json_object)}
|
|
||||||
|
|
||||||
it 'has graph_id' do
|
|
||||||
status_from_json.graph_id.should == json_object['id']
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'has author_id' do
|
|
||||||
status_from_json.author_id.should == json_object['from']['id']
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'has author_name' do
|
|
||||||
status_from_json.author_name.should == json_object['from']['name']
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'has message' do
|
|
||||||
status_from_json.message.should == json_object['message']
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'has author_name' do
|
|
||||||
status_from_json.updated_time.should == Time.parse(json_object['updated_time'])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
Loading…
Reference in a new issue