tagcrumbs 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +79 -56
- data/README.rdoc +9 -1
- data/Rakefile +2 -1
- data/TODO.txt +0 -7
- data/config/website.yml +2 -0
- data/examples/filter_new.rb +7 -3
- data/examples/placemark_new_suggestions.rb +4 -2
- data/examples/request_authorization.rb +1 -1
- data/examples/tagcrumbs_find.rb +3 -3
- data/examples/user.rb +1 -1
- data/lib/console.rb +14 -0
- data/lib/tagcrumbs.rb +41 -14
- data/lib/tagcrumbs/cli.rb +1 -1
- data/lib/tagcrumbs/config_store.rb +3 -3
- data/lib/tagcrumbs/core_extensions.rb +19 -0
- data/lib/tagcrumbs/parsers/json_parser.rb +7 -3
- data/lib/tagcrumbs/proxy.rb +6 -3
- data/lib/tagcrumbs/requestor.rb +22 -5
- data/lib/tagcrumbs/resources/{array.rb → collection.rb} +8 -7
- data/lib/tagcrumbs/resources/models/access_token.rb +8 -0
- data/lib/tagcrumbs/resources/models/accessors.rb +17 -3
- data/lib/tagcrumbs/resources/models/activity.rb +1 -0
- data/lib/tagcrumbs/resources/models/application.rb +9 -0
- data/lib/tagcrumbs/resources/models/comment.rb +2 -0
- data/lib/tagcrumbs/resources/models/email_recommendation.rb +17 -0
- data/lib/tagcrumbs/resources/models/favorite.rb +2 -1
- data/lib/tagcrumbs/resources/models/filter.rb +2 -2
- data/lib/tagcrumbs/resources/models/flag.rb +3 -0
- data/lib/tagcrumbs/resources/models/model.rb +8 -7
- data/lib/tagcrumbs/resources/models/paragraph.rb +8 -0
- data/lib/tagcrumbs/resources/models/picture.rb +4 -4
- data/lib/tagcrumbs/resources/models/place.rb +3 -3
- data/lib/tagcrumbs/resources/models/placemark.rb +3 -2
- data/lib/tagcrumbs/resources/models/profile.rb +0 -1
- data/lib/tagcrumbs/resources/models/profile_link.rb +1 -1
- data/lib/tagcrumbs/resources/models/root.rb +3 -3
- data/lib/tagcrumbs/resources/models/settings.rb +2 -1
- data/lib/tagcrumbs/resources/models/tagcrumb.rb +4 -12
- data/lib/tagcrumbs/resources/models/user.rb +27 -6
- data/lib/tagcrumbs/resources/models/user_recommendation.rb +1 -1
- data/lib/tagcrumbs/resources/resource.rb +4 -4
- data/script/console +8 -3
- data/spec/fixtures_external/README.rdoc +15 -0
- data/spec/fixtures_external/json/access_token.json +11 -0
- data/spec/{fixtures → fixtures_external/json}/activity.json +32 -25
- data/spec/{fixtures → fixtures_external/json}/address.json +22 -25
- data/spec/fixtures_external/json/application.json +13 -0
- data/spec/{fixtures → fixtures_external/json}/city.json +2 -11
- data/spec/{fixtures → fixtures_external/json}/comment.json +51 -44
- data/spec/{fixtures → fixtures_external/json}/country.json +1 -4
- data/spec/fixtures_external/json/email_recommendation.json +286 -0
- data/spec/{fixtures → fixtures_external/json}/fanship.json +30 -30
- data/spec/{fixtures → fixtures_external/json}/favorite.json +45 -47
- data/spec/{fixtures → fixtures_external/json}/filter.json +30 -42
- data/spec/{fixtures → fixtures_external/json}/friendship.json +30 -30
- data/spec/fixtures_external/json/geoname.json +18 -0
- data/spec/{fixtures → fixtures_external/json}/link.json +41 -44
- data/spec/{fixtures → fixtures_external/json}/location.json +21 -31
- data/spec/fixtures_external/json/paragraph.json +12 -0
- data/spec/fixtures_external/json/picture.json +129 -0
- data/spec/fixtures_external/json/picture_upload.json +9 -0
- data/spec/{fixtures → fixtures_external/json}/placemark.json +136 -142
- data/spec/fixtures_external/json/placemarks.json +851 -0
- data/spec/{fixtures → fixtures_external/json}/profile.json +65 -94
- data/spec/fixtures_external/json/profile_link.json +123 -0
- data/spec/{fixtures → fixtures_external/json}/root.json +17 -21
- data/spec/{fixtures → fixtures_external/json}/settings.json +26 -19
- data/spec/{fixtures → fixtures_external/json}/state.json +2 -8
- data/spec/{fixtures → fixtures_external/json}/subscription.json +41 -44
- data/spec/fixtures_external/json/suggestions.json +302 -0
- data/spec/{fixtures → fixtures_external/json}/tag.json +0 -0
- data/spec/{fixtures → fixtures_external/json}/user.json +44 -20
- data/spec/{fixtures → fixtures_external/json}/user_recommendation.json +52 -55
- data/spec/fixtures_external/json/validation_errors.json +6 -0
- data/spec/fixtures_external/kml/network_link.kml +24 -0
- data/spec/fixtures_external/kml/tagcrumbs.kml +64 -0
- data/spec/fixtures_external/rdf/placemark.rdf +56 -0
- data/spec/fixtures_external/rss/tagcrumbs.rss +24 -0
- data/spec/fixtures_external/xml/access_token.xml +5 -0
- data/spec/fixtures_external/xml/activity.xml +62 -0
- data/spec/fixtures_external/xml/address.xml +51 -0
- data/spec/fixtures_external/xml/application.xml +5 -0
- data/spec/fixtures_external/xml/city.xml +27 -0
- data/spec/fixtures_external/xml/comment.xml +81 -0
- data/spec/fixtures_external/xml/country.xml +10 -0
- data/spec/fixtures_external/xml/email_recommendation.xml +78 -0
- data/spec/fixtures_external/xml/fanship.xml +49 -0
- data/spec/fixtures_external/xml/favorite.xml +97 -0
- data/spec/fixtures_external/xml/filter.xml +68 -0
- data/spec/fixtures_external/xml/friendship.xml +49 -0
- data/spec/fixtures_external/xml/geoname.xml +6 -0
- data/spec/fixtures_external/xml/link.xml +78 -0
- data/spec/fixtures_external/xml/location.xml +58 -0
- data/spec/fixtures_external/xml/paragraph.xml +8 -0
- data/spec/fixtures_external/xml/picture.xml +36 -0
- data/spec/fixtures_external/xml/picture_upload.xml +153 -0
- data/spec/fixtures_external/xml/placemark.xml +54 -0
- data/spec/fixtures_external/xml/placemarks.xml +336 -0
- data/spec/fixtures_external/xml/profile.xml +77 -0
- data/spec/fixtures_external/xml/profile_link.xml +34 -0
- data/spec/fixtures_external/xml/root.xml +12 -0
- data/spec/fixtures_external/xml/settings.xml +42 -0
- data/spec/fixtures_external/xml/state.xml +19 -0
- data/spec/fixtures_external/xml/subscription.xml +76 -0
- data/spec/fixtures_external/xml/suggestions.xml +106 -0
- data/spec/{fixtures → fixtures_external/xml}/tag.xml +2 -2
- data/spec/fixtures_external/xml/user.xml +37 -0
- data/spec/fixtures_external/xml/user_recommendation.xml +94 -0
- data/spec/fixtures_external/xml/validation_errors.xml +5 -0
- data/spec/spec_helper.rb +12 -2
- data/spec/tagcrumbs/requestor_spec.rb +2 -2
- data/spec/tagcrumbs/resources/array_spec.rb +38 -38
- data/spec/tagcrumbs/resources/models/access_token_spec.rb +16 -0
- data/spec/tagcrumbs/resources/models/accessors_spec.rb +2 -2
- data/spec/tagcrumbs/resources/models/activity_spec.rb +5 -1
- data/spec/tagcrumbs/resources/models/address_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/application_spec.rb +17 -0
- data/spec/tagcrumbs/resources/models/city_spec.rb +2 -5
- data/spec/tagcrumbs/resources/models/comment_spec.rb +8 -2
- data/spec/tagcrumbs/resources/models/country_spec.rb +2 -4
- data/spec/tagcrumbs/resources/models/email_recommendation_spec.rb +31 -0
- data/spec/tagcrumbs/resources/models/fanship_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/favorite_spec.rb +5 -1
- data/spec/tagcrumbs/resources/models/filter_spec.rb +3 -4
- data/spec/tagcrumbs/resources/models/friendship_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/geoname_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/link_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/location_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/model_spec.rb +20 -3
- data/spec/tagcrumbs/resources/models/paragraph_spec.rb +21 -0
- data/spec/tagcrumbs/resources/models/picture_spec.rb +13 -21
- data/spec/tagcrumbs/resources/models/place_spec.rb +3 -3
- data/spec/tagcrumbs/resources/models/placemark_spec.rb +11 -9
- data/spec/tagcrumbs/resources/models/profile_link_spec.rb +6 -12
- data/spec/tagcrumbs/resources/models/profile_spec.rb +5 -12
- data/spec/tagcrumbs/resources/models/root_spec.rb +15 -19
- data/spec/tagcrumbs/resources/models/settings_spec.rb +3 -1
- data/spec/tagcrumbs/resources/models/state_spec.rb +2 -5
- data/spec/tagcrumbs/resources/models/subscription_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/suggestions_spec.rb +7 -7
- data/spec/tagcrumbs/resources/models/tag_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/tagcrumb_spec.rb +3 -11
- data/spec/tagcrumbs/resources/models/user_recommendation_spec.rb +1 -1
- data/spec/tagcrumbs/resources/models/user_spec.rb +35 -27
- data/spec/tagcrumbs/resources/resource_spec.rb +3 -3
- data/spec/tagcrumbs_spec.rb +7 -7
- data/tagcrumbs.gemspec +2 -2
- metadata +82 -58
- data/examples/tagcrumbs_search.rb +0 -7
- data/lib/tagcrumbs/validations.rb +0 -301
- data/spec/fixtures/activity.xml +0 -66
- data/spec/fixtures/address.xml +0 -58
- data/spec/fixtures/city.xml +0 -34
- data/spec/fixtures/comment.xml +0 -87
- data/spec/fixtures/country.xml +0 -13
- data/spec/fixtures/fanship.xml +0 -54
- data/spec/fixtures/favorite.xml +0 -109
- data/spec/fixtures/filter.xml +0 -80
- data/spec/fixtures/friendship.xml +0 -54
- data/spec/fixtures/geoname.json +0 -18
- data/spec/fixtures/geoname.xml +0 -6
- data/spec/fixtures/link.xml +0 -88
- data/spec/fixtures/location.xml +0 -71
- data/spec/fixtures/picture.json +0 -154
- data/spec/fixtures/picture.xml +0 -49
- data/spec/fixtures/placemark.xml +0 -58
- data/spec/fixtures/placemarks.json +0 -887
- data/spec/fixtures/placemarks.xml +0 -348
- data/spec/fixtures/profile.xml +0 -100
- data/spec/fixtures/profile_link.json +0 -156
- data/spec/fixtures/profile_link.xml +0 -49
- data/spec/fixtures/root.xml +0 -14
- data/spec/fixtures/settings.xml +0 -45
- data/spec/fixtures/state.xml +0 -23
- data/spec/fixtures/subscription.xml +0 -86
- data/spec/fixtures/suggestions.json +0 -1877
- data/spec/fixtures/suggestions.xml +0 -724
- data/spec/fixtures/user.xml +0 -31
- data/spec/fixtures/user_recommendation.xml +0 -106
- data/spec/fixtures/validation_errors.json +0 -5
- data/spec/fixtures/validation_errors.xml +0 -5
- data/spec/tagcrumbs/validations_spec.rb +0 -27
data/spec/spec_helper.rb
CHANGED
@@ -31,7 +31,17 @@ end
|
|
31
31
|
|
32
32
|
def fixture_file(filename, format = nil)
|
33
33
|
return '' if filename == ''
|
34
|
+
|
34
35
|
file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
|
36
|
+
|
37
|
+
file_path += ".#{format}" if format
|
38
|
+
File.read(file_path)
|
39
|
+
end
|
40
|
+
|
41
|
+
def external_fixture_file(filename, format)
|
42
|
+
return '' if filename == ''
|
43
|
+
|
44
|
+
file_path = File.expand_path(File.dirname(__FILE__) + "/fixtures_external/#{format}/" + filename)
|
35
45
|
file_path += ".#{format}" if format
|
36
46
|
File.read(file_path)
|
37
47
|
end
|
@@ -61,8 +71,8 @@ def fakeweb_url(url, format=nil)
|
|
61
71
|
u
|
62
72
|
end
|
63
73
|
|
64
|
-
def stub_get(url, filename, status=nil)
|
65
|
-
options = {:string =>
|
74
|
+
def stub_get(url, filename, format, status=nil)
|
75
|
+
options = {:string => external_fixture_file(filename, format)}
|
66
76
|
options.merge!({:status => status}) unless status.nil?
|
67
77
|
|
68
78
|
FakeWeb.register_uri(:get, fakeweb_url(url), options)
|
@@ -50,8 +50,8 @@ describe Tagcrumbs::Requestor do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should have default headers" do
|
53
|
-
@requestor.send(:default_headers, :xml).should == {"Content-Type"=>"application/xml", "Accept"=>"application/xml, text/xml"}
|
54
|
-
@requestor.send(:default_headers, :json).should == {"Content-Type"=>"application/json", "Accept"=>"application/json, text/json"}
|
53
|
+
@requestor.send(:default_headers, :xml).should == {"Content-Type"=>"application/xml", "Accept"=>"application/xml, text/xml", 'Accept-Encoding' => 'gzip, deflate'}
|
54
|
+
@requestor.send(:default_headers, :json).should == {"Content-Type"=>"application/json", "Accept"=>"application/json, text/json", 'Accept-Encoding' => 'gzip, deflate'}
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should raise an error on invalid format on default headers" do
|
@@ -1,62 +1,62 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
2
|
|
3
|
-
describe Tagcrumbs::
|
3
|
+
describe Tagcrumbs::Collection do
|
4
4
|
before(:each) do
|
5
|
-
@
|
5
|
+
@collection = Tagcrumbs::Collection.new
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should reset" do
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
9
|
+
@collection.properties = {1 => 2}
|
10
|
+
@collection.resource_url = 'test.de'
|
11
|
+
@collection.loaded = true
|
12
|
+
@collection.array = [1,2,3]
|
13
13
|
|
14
|
-
@
|
14
|
+
@collection.reset!
|
15
15
|
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
16
|
+
@collection.properties.should == {}
|
17
|
+
@collection.resource_url.should be_nil
|
18
|
+
@collection.loaded.should be_false
|
19
|
+
@collection.array.should == []
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should set properties and typecast" do
|
23
|
-
@
|
23
|
+
@collection.properties = {'xlink:href' => 'array_url', 'page' => '5', 'total_entries' => '20'}
|
24
24
|
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
25
|
+
@collection.resource_url.should == 'array_url'
|
26
|
+
@collection.properties[:page].should == '5'
|
27
|
+
@collection.page.should == 5
|
28
|
+
@collection.properties[:total_entries].should == '20'
|
29
|
+
@collection.total_entries.should == 20
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should delegate missing methods to the array" do
|
33
|
-
@
|
33
|
+
@collection.size.should == 0
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should initialize from document" do
|
37
|
-
@
|
37
|
+
@collection.initialize_from_document(external_fixture_file('placemarks', :xml))
|
38
38
|
|
39
|
-
@
|
40
|
-
@
|
41
|
-
@
|
39
|
+
@collection.resource_url.should == 'http://www.tagcrumbs.com/sascha/tagcrumbs.xml'
|
40
|
+
@collection.loaded.should == true
|
41
|
+
@collection.properties.should be_present
|
42
42
|
|
43
|
-
@
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@
|
48
|
-
@
|
49
|
-
@
|
50
|
-
@
|
43
|
+
@collection.properties[:page].should == '1'
|
44
|
+
@collection.page.should == 1
|
45
|
+
@collection.properties[:per_page].should == '10'
|
46
|
+
@collection.per_page.should == 10
|
47
|
+
@collection.properties[:pages].should == '21'
|
48
|
+
@collection.pages.should == 21
|
49
|
+
@collection.properties[:total_entries].should == '206'
|
50
|
+
@collection.total_entries.should == 206
|
51
51
|
|
52
|
-
@
|
53
|
-
@
|
54
|
-
@
|
55
|
-
@
|
52
|
+
@collection.properties[:sort].should == 'date'
|
53
|
+
@collection.sort.should == 'date'
|
54
|
+
@collection.properties[:order].should == 'desc'
|
55
|
+
@collection.order.should == 'desc'
|
56
56
|
|
57
|
-
@
|
58
|
-
@
|
59
|
-
@
|
60
|
-
@
|
57
|
+
@collection.size.should == 3
|
58
|
+
@collection[0].should be_an_instance_of(Tagcrumbs::Placemark)
|
59
|
+
@collection[1].should be_an_instance_of(Tagcrumbs::Placemark)
|
60
|
+
@collection[2].should be_an_instance_of(Tagcrumbs::Placemark)
|
61
61
|
end
|
62
62
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
|
3
|
+
describe Tagcrumbs::AccessToken do
|
4
|
+
it "should create from a document" do
|
5
|
+
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
+
token = Tagcrumbs::AccessToken.new_from_document(external_fixture_file("access_token", format), format)
|
7
|
+
|
8
|
+
token.resource_url.should be_blank
|
9
|
+
token.new_record.should be_false
|
10
|
+
token.loaded.should be_true
|
11
|
+
|
12
|
+
token.token.should == "TOKEN"
|
13
|
+
token.secret.should == "SECRET"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -74,7 +74,7 @@ describe Tagcrumbs::Accessors do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should have a create url" do
|
77
|
-
stub_get('/you', 'user
|
77
|
+
stub_get('/you', 'user', :xml, [200])
|
78
78
|
|
79
79
|
lambda {
|
80
80
|
@model.create_url
|
@@ -91,7 +91,7 @@ describe Tagcrumbs::Accessors do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should create a has_many_url method" do
|
94
|
-
stub_get('/you', 'user
|
94
|
+
stub_get('/you', 'user', :xml, [200])
|
95
95
|
|
96
96
|
Tagcrumbs.current_user.tagcrumbs_url.should == tagcrumbs_url('/sascha/tagcrumbs.xml')
|
97
97
|
end
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Activity do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
activity = Tagcrumbs::Activity.new_from_document(
|
6
|
+
activity = Tagcrumbs::Activity.new_from_document(external_fixture_file("activity", format), format)
|
7
7
|
|
8
8
|
activity.resource_url.should == tagcrumbs_url('/sascha/activities/460', format)
|
9
9
|
activity.new_record.should be_false
|
@@ -28,6 +28,10 @@ describe Tagcrumbs::Activity do
|
|
28
28
|
activity.secondary_subject.resource_url.should == tagcrumbs_url('/sascha/placemarks/placemark-name', format)
|
29
29
|
activity.secondary_subject.name.should == 'PLACEMARK NAME'
|
30
30
|
|
31
|
+
activity.application.class.should == Tagcrumbs::Application
|
32
|
+
activity.application.loaded?.should be_true
|
33
|
+
activity.application.name.should == "Tagcrumbs Gem"
|
34
|
+
activity.application.url.should == "http://www.tagcrumbs.com"
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Address do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
address = Tagcrumbs::Address.new_from_document(
|
6
|
+
address = Tagcrumbs::Address.new_from_document(external_fixture_file("address", format), format)
|
7
7
|
|
8
8
|
address.resource_url.should == tagcrumbs_url('/sascha/placemarks/placemark-name/address', format)
|
9
9
|
address.new_record.should be_false
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
|
3
|
+
describe Tagcrumbs::Application do
|
4
|
+
it "should create from a document" do
|
5
|
+
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
+
application = Tagcrumbs::Application.new_from_document(external_fixture_file("application", format), format)
|
7
|
+
|
8
|
+
application.resource_url.should == tagcrumbs_url('/applications/3', format)
|
9
|
+
application.new_record.should be_false
|
10
|
+
application.loaded.should be_true
|
11
|
+
|
12
|
+
application.name.should == "Tagcrumbs Gem"
|
13
|
+
application.url.should == "http://www.tagcrumbs.com"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -3,28 +3,25 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::City do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
city = Tagcrumbs::City.new_from_document(
|
6
|
+
city = Tagcrumbs::City.new_from_document(external_fixture_file("city", format), format)
|
7
7
|
|
8
8
|
city.resource_url.should == tagcrumbs_url('/places/germany/states/land-baden-w%C3%BCrttemberg/cities/stuttgart', format)
|
9
9
|
city.name.should == 'Stuttgart'
|
10
|
-
city.permalink.should == 'stuttgart'
|
11
10
|
|
12
11
|
city.state.resource_url.should == tagcrumbs_url('/places/germany/states/land-baden-w%C3%BCrttemberg', format)
|
13
12
|
city.state.new_record.should be_false
|
14
13
|
city.state.loaded.should be_true
|
15
14
|
|
16
15
|
city.state.name.should == 'Land Baden-Württemberg'
|
17
|
-
city.state.permalink.should == 'land-baden-württemberg'
|
18
16
|
|
19
17
|
city.state.country.name.should == 'Deutschland'
|
20
18
|
|
21
|
-
city.state.country.permalink.should == 'germany'
|
22
19
|
|
23
20
|
city.state.country.geoname.class.should == Tagcrumbs::Geoname
|
24
21
|
city.state.country.geoname.loaded?.should be_true
|
25
22
|
city.state.country.geoname.resource_url.should == "http://www.geonames.org/2921044"
|
26
23
|
|
27
|
-
city.state.country.states.class.should == Tagcrumbs::
|
24
|
+
city.state.country.states.class.should == Tagcrumbs::Collection
|
28
25
|
city.state.country.states.loaded?.should be_false
|
29
26
|
city.state.country.states.resource_url.should == tagcrumbs_url('/places/germany/states', format)
|
30
27
|
|
@@ -2,8 +2,9 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
2
2
|
|
3
3
|
describe Tagcrumbs::Comment do
|
4
4
|
it "should create from a document" do
|
5
|
-
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
|
5
|
+
#Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
+
[:json].each do |format|
|
7
|
+
comment = Tagcrumbs::Comment.new_from_document(external_fixture_file("comment", format), format)
|
7
8
|
|
8
9
|
comment.resource_url.should == tagcrumbs_url('/sascha/comments/84', format)
|
9
10
|
comment.new_record.should be_false
|
@@ -17,6 +18,11 @@ describe Tagcrumbs::Comment do
|
|
17
18
|
comment.tagcrumb.class.should == Tagcrumbs::Placemark
|
18
19
|
comment.tagcrumb.loaded?.should be_true
|
19
20
|
comment.tagcrumb.resource_url.should == tagcrumbs_url('/sascha/placemarks/placemark-name', format)
|
21
|
+
|
22
|
+
comment.application.class.should == Tagcrumbs::Application
|
23
|
+
comment.application.loaded?.should be_true
|
24
|
+
comment.application.name.should == "Tagcrumbs Gem"
|
25
|
+
comment.application.url.should == "http://www.tagcrumbs.com"
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
@@ -3,21 +3,19 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Country do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
country = Tagcrumbs::Country.new_from_document(
|
6
|
+
country = Tagcrumbs::Country.new_from_document(external_fixture_file("country", format), format)
|
7
7
|
|
8
8
|
country.resource_url.should == tagcrumbs_url('/places/germany', format)
|
9
9
|
country.new_record.should be_false
|
10
10
|
country.loaded.should be_true
|
11
11
|
|
12
12
|
country.name.should == 'Deutschland'
|
13
|
-
|
14
|
-
country.permalink.should == 'germany'
|
15
13
|
|
16
14
|
country.geoname.class.should == Tagcrumbs::Geoname
|
17
15
|
country.geoname.loaded?.should be_true
|
18
16
|
country.geoname.resource_url.should == "http://www.geonames.org/2921044"
|
19
17
|
|
20
|
-
country.states.class.should == Tagcrumbs::
|
18
|
+
country.states.class.should == Tagcrumbs::Collection
|
21
19
|
country.states.loaded?.should be_false
|
22
20
|
country.states.resource_url.should == tagcrumbs_url('/places/germany/states', format)
|
23
21
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
|
3
|
+
describe Tagcrumbs::EmailRecommendation do
|
4
|
+
it "should create from a document" do
|
5
|
+
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
+
user_recommendation = Tagcrumbs::EmailRecommendation.new_from_document(external_fixture_file("email_recommendation", format), format)
|
7
|
+
|
8
|
+
user_recommendation.resource_url.should == tagcrumbs_url('/sascha/recommendations/70', format)
|
9
|
+
user_recommendation.new_record.should be_false
|
10
|
+
user_recommendation.loaded.should be_true
|
11
|
+
|
12
|
+
user_recommendation.message.should == "MESSAGE"
|
13
|
+
user_recommendation.recipient_email.should == "email@address.com"
|
14
|
+
user_recommendation.created_at.should be_an_instance_of(Time)
|
15
|
+
user_recommendation.updated_at.should be_an_instance_of(Time)
|
16
|
+
|
17
|
+
# has one associations
|
18
|
+
user_recommendation.tagcrumb.class.should == Tagcrumbs::Placemark
|
19
|
+
user_recommendation.tagcrumb.loaded?.should be_true
|
20
|
+
user_recommendation.tagcrumb.resource_url.should == tagcrumbs_url('/sascha/placemarks/placemark-name', format)
|
21
|
+
user_recommendation.tagcrumb.name.should == 'PLACEMARK NAME'
|
22
|
+
|
23
|
+
user_recommendation.user.class.should == Tagcrumbs::User
|
24
|
+
user_recommendation.user.loaded?.should be_true
|
25
|
+
user_recommendation.user.resource_url.should == tagcrumbs_url('/sascha', format)
|
26
|
+
user_recommendation.user.username.should == 'sascha'
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Fanship do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
fanship = Tagcrumbs::Fanship.new_from_document(
|
6
|
+
fanship = Tagcrumbs::Fanship.new_from_document(external_fixture_file("fanship", format), format)
|
7
7
|
|
8
8
|
fanship.resource_url.should == tagcrumbs_url('/sascha/fans/peter', format)
|
9
9
|
fanship.new_record.should be_false
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Favorite do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
favorite = Tagcrumbs::Favorite.new_from_document(
|
6
|
+
favorite = Tagcrumbs::Favorite.new_from_document(external_fixture_file("favorite", format), format)
|
7
7
|
|
8
8
|
favorite.resource_url.should == tagcrumbs_url('/sascha/favorites/1002145', format)
|
9
9
|
favorite.new_record.should be_false
|
@@ -23,6 +23,10 @@ describe Tagcrumbs::Favorite do
|
|
23
23
|
favorite.user.resource_url.should == tagcrumbs_url('/sascha', format)
|
24
24
|
favorite.user.username.should == 'sascha'
|
25
25
|
|
26
|
+
favorite.application.class.should == Tagcrumbs::Application
|
27
|
+
favorite.application.loaded?.should be_true
|
28
|
+
favorite.application.name.should == "Tagcrumbs Gem"
|
29
|
+
favorite.application.url.should == "http://www.tagcrumbs.com"
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
@@ -3,14 +3,13 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Filter do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
filter = Tagcrumbs::Filter.new_from_document(
|
6
|
+
filter = Tagcrumbs::Filter.new_from_document(external_fixture_file("filter", format), format)
|
7
7
|
|
8
8
|
filter.resource_url.should == tagcrumbs_url('/sascha/filters/filter-name', format)
|
9
9
|
filter.new_record.should be_false
|
10
10
|
filter.loaded.should be_true
|
11
11
|
|
12
12
|
filter.name.should == "FILTER NAME"
|
13
|
-
filter.permalink.should == 'filter-name'
|
14
13
|
filter.private.should be_false
|
15
14
|
filter.tagcrumb_type.should be_nil
|
16
15
|
|
@@ -19,7 +18,7 @@ describe Tagcrumbs::Filter do
|
|
19
18
|
filter.since.should be_an_instance_of(Time)
|
20
19
|
filter.until.should be_an_instance_of(Time)
|
21
20
|
filter.from.should == 'everybody'
|
22
|
-
filter.
|
21
|
+
filter.range.should be_nil
|
23
22
|
|
24
23
|
filter.created_at.should be_an_instance_of(Time)
|
25
24
|
filter.updated_at.should be_an_instance_of(Time)
|
@@ -34,7 +33,7 @@ describe Tagcrumbs::Filter do
|
|
34
33
|
filter.city.loaded?.should be_true
|
35
34
|
filter.city.name.should == 'Berlin'
|
36
35
|
|
37
|
-
filter.tagcrumbs.class.should == Tagcrumbs::
|
36
|
+
filter.tagcrumbs.class.should == Tagcrumbs::Collection
|
38
37
|
filter.tagcrumbs.loaded?.should be_false
|
39
38
|
filter.tagcrumbs.resource_url.should == tagcrumbs_url('/sascha/filters/filter-name/tagcrumbs', format)
|
40
39
|
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Friendship do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
friendship = Tagcrumbs::Friendship.new_from_document(
|
6
|
+
friendship = Tagcrumbs::Friendship.new_from_document(external_fixture_file("friendship", format), format)
|
7
7
|
|
8
8
|
friendship.resource_url.should == tagcrumbs_url('/sascha/friends/peter', format)
|
9
9
|
friendship.new_record.should be_false
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Geoname do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
geoname = Tagcrumbs::Geoname.new_from_document(
|
6
|
+
geoname = Tagcrumbs::Geoname.new_from_document(external_fixture_file("geoname", format), format)
|
7
7
|
|
8
8
|
geoname.resource_url.should == "http://www.geonames.org/2921044"
|
9
9
|
geoname.new_record.should be_false
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Link do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
link = Tagcrumbs::Link.new_from_document(
|
6
|
+
link = Tagcrumbs::Link.new_from_document(external_fixture_file("link", format), format)
|
7
7
|
|
8
8
|
link.resource_url.should == tagcrumbs_url('/sascha/links/1000104', format)
|
9
9
|
link.new_record.should be_false
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe Tagcrumbs::Location do
|
4
4
|
it "should create from a document" do
|
5
5
|
Tagcrumbs.supported_formats.keys.each do |format|
|
6
|
-
location = Tagcrumbs::Location.new_from_document(
|
6
|
+
location = Tagcrumbs::Location.new_from_document(external_fixture_file("location", format), format)
|
7
7
|
|
8
8
|
location.resource_url.should == tagcrumbs_url('/location', format)
|
9
9
|
location.new_record.should be_false
|