reviewed 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -5
- data/lib/faraday/api_key.rb +14 -0
- data/lib/faraday/errors.rb +14 -0
- data/lib/reviewed/article.rb +3 -1
- data/lib/reviewed/award.rb +4 -0
- data/lib/reviewed/base.rb +23 -11
- data/lib/reviewed/client.rb +47 -26
- data/lib/reviewed/collection.rb +8 -8
- data/lib/reviewed/product.rb +2 -0
- data/lib/reviewed/request.rb +43 -0
- data/lib/reviewed/version.rb +1 -1
- data/lib/reviewed.rb +13 -20
- data/reviewed.gemspec +1 -0
- data/spec/article_spec.rb +21 -21
- data/spec/award_spec.rb +4 -0
- data/spec/base_spec.rb +23 -49
- data/spec/client_spec.rb +97 -27
- data/spec/collection_spec.rb +6 -4
- data/spec/faraday/api_key_spec.rb +42 -0
- data/spec/faraday/errors_spec.rb +73 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/does_not_have_any_matching_attachments.yml +601 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/finds_attachments_by_tag.yml +601 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/has_many_attachments.yml +601 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/returns_all_attachments.yml +601 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/attachments/returns_attachments_of_the_correct_class.yml +601 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/pages/has_many_pages.yml +601 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/products/has_many_products.yml +582 -0
- data/spec/fixtures/vcr/Reviewed_Article/associations/products/returns_products_of_the_correct_class.yml +601 -0
- data/spec/fixtures/vcr/Reviewed_Article/find_page/finds_a_page_with_a_matching_slug.yml +784 -0
- data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_a_product_of_the_correct_class.yml +1199 -0
- data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_nil_if_does_not_respond_to_products.yml +1199 -0
- data/spec/fixtures/vcr/Reviewed_Article/primary_product/returns_the_primary_product.yml +1199 -0
- data/spec/fixtures/vcr/Reviewed_Client/_perform/request_params/not_set/has_nil_query_params.yml +254 -0
- data/spec/fixtures/vcr/Reviewed_Client/_perform/request_params/set/merges_quest_params.yml +98 -0
- data/spec/fixtures/vcr/Reviewed_Collection/collection_data/fetches_the_first_page_by_default.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/collection_data/is_enumerable.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/next_page/fetches_the_next_page_of_results.yml +310 -0
- data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/indicates_if_the_page_number_is_out_of_bounds.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/indicates_whether_this_is_the_first_or_last_page.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_limit_value_max_per_page_.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_number_of_entries_on_the_current_page.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_offset.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_total_item_count.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/page_attributes_pagination_/returns_the_total_number_of_pages.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Collection/previous_page/fetches_the_previous_page_of_results.yml +490 -0
- data/spec/fixtures/vcr/Reviewed_Collection/previous_page/returns_nil_if_there_is_no_previous_page.yml +183 -0
- data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/does_not_have_any_matching_attachments.yml +116 -0
- data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/finds_attachments_by_tag.yml +116 -0
- data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/has_many_attachments.yml +119 -0
- data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/returns_all_attachments.yml +116 -0
- data/spec/fixtures/vcr/Reviewed_Product/associations/attachments/returns_attachments_of_the_correct_class.yml +119 -0
- data/spec/fixtures/vcr/Reviewed_Product/manufacturer_specs/has_many_manufacturer_specs.yml +116 -0
- data/spec/fixtures/vcr/Reviewed_Product/manufacturer_specs/returns_attachments_of_the_correct_class.yml +116 -0
- data/spec/fixtures/vcr/Reviewed_Request/_where/filters_collections_using_other_supported_options.yml +110 -0
- data/spec/fixtures/vcr/Reviewed_Request/_where/returns_a_collection.yml +254 -0
- data/spec/fixtures/vcr/Reviewed_Request/_where/returns_an_empty_set_if_no_matching_data_was_found.yml +86 -0
- data/spec/fixtures/vcr/Reviewed_Request/_where/returns_the_appropriate_page_of_results.yml +288 -0
- data/spec/fixtures/vcr/Reviewed_Request/collection_from_response/returns_a_collection_object.yml +254 -0
- data/spec/fixtures/vcr/Reviewed_Request/collection_from_response/returns_objects_of_the_correct_class.yml +254 -0
- data/spec/fixtures/vcr/Reviewed_Request/object_from_response/returns_an_object_of_the_correct_class.yml +601 -0
- data/spec/product_spec.rb +8 -6
- data/spec/request_spec.rb +117 -0
- data/spec/reviewed_spec.rb +5 -31
- data/spec/spec_helper.rb +6 -5
- data/spec/website_spec.rb +1 -2
- metadata +111 -40
- data/lib/faraday/global_params.rb +0 -21
- data/lib/reviewed/configurable.rb +0 -26
- data/lib/reviewed/utils.rb +0 -21
- data/spec/configurable_spec.rb +0 -44
- data/spec/faraday/global_params_spec.rb +0 -33
- data/spec/fixtures/vcr/article/attachments.yml +0 -1065
- data/spec/fixtures/vcr/article/find_page.yml +0 -383
- data/spec/fixtures/vcr/article/products.yml +0 -1065
- data/spec/fixtures/vcr/base/article/find.yml +0 -14825
- data/spec/fixtures/vcr/base/where_collection.yml +0 -1203
- data/spec/fixtures/vcr/collection/products.yml +0 -922
- data/spec/fixtures/vcr/faraday/global_params/request.yml +0 -109
- data/spec/fixtures/vcr/faraday/global_params/request_no_params.yml +0 -885
- data/spec/fixtures/vcr/faraday/global_params/request_params.yml +0 -405
- data/spec/fixtures/vcr/product/attachments.yml +0 -221
- data/spec/fixtures/vcr/product/manufacturer_specs.yml +0 -194
- data/spec/fixtures/vcr/utils/collection.yml +0 -644
- data/spec/fixtures/vcr/utils/object.yml +0 -7658
- data/spec/fixtures/vcr/utils.yml +0 -7961
- data/spec/utils_spec.rb +0 -33
data/spec/utils_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper.rb'
|
2
|
-
|
3
|
-
describe Reviewed::Utils do
|
4
|
-
|
5
|
-
class MockUtils < Reviewed::Base; end
|
6
|
-
|
7
|
-
describe 'object_from_response' do
|
8
|
-
use_vcr_cassette "utils/object"
|
9
|
-
|
10
|
-
let(:article_id) { '509d166d60de7db97c05ce71' }
|
11
|
-
|
12
|
-
it 'returns an object of the correct class' do
|
13
|
-
response = MockUtils.object_from_response(:get, "articles/#{article_id}")
|
14
|
-
response.should be_an_instance_of(MockUtils)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'collection_from_response' do
|
19
|
-
use_vcr_cassette "utils/collection"
|
20
|
-
|
21
|
-
it 'returns a collection object' do
|
22
|
-
collection = MockUtils.collection_from_response(:get, "articles")
|
23
|
-
collection.should be_an_instance_of(Reviewed::Collection)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'returns objects of the correct class' do
|
27
|
-
collection = MockUtils.collection_from_response(:get, "articles")
|
28
|
-
collection.items.each do |obj|
|
29
|
-
obj.should be_an_instance_of(MockUtils)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|