Sha256: 5b4ea377108bd3152769d218f2a520a87a3509c1a39bdc16726815d50e0a3511
Contents?: true
Size: 1.5 KB
Versions: 19
Compression:
Stored size: 1.5 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe "FeedbackPage" do before :all do @first_page_test_regex = FEEDBACK_FIRST_PAGE_TEST_REGEX @second_page_test_regex = FEEDBACK_SECOND_PAGE_TEST_REGEX @last_page_test_regex = FEEDBACK_LAST_PAGE_TEST_REGEX @first_page = AmazonSellerCentral::FeedbackPage.load_first_page @second_page = @first_page.next_page @last_page = @second_page.next_page end it_should_behave_like "all pages" it "transforms itself into a collection of Feedback objects" do feedback = @first_page.feedbacks feedback.first.comments.should == "Item as described. Quick delivery." feedback.last.comments.should == "quick delivery. product arrived in perfect condition. good experience." end describe "ClassMethods" do it "loads the first page of feedback data" do page = AmazonSellerCentral::FeedbackPage.load_first_page page.should be_kind_of(AmazonSellerCentral::FeedbackPage) page.body.should =~ @first_page_test_regex end it "loads all feedback pages" do pages = AmazonSellerCentral::FeedbackPage.load_all_pages pages.size.should == 3 pages.first.body.should =~ @first_page_test_regex pages.last.body.should =~ @last_page_test_regex end it "passes a page to a block when given" do last_seen = nil AmazonSellerCentral::FeedbackPage.each_page do |page| last_seen = page end last_seen.body.should =~ @last_page_test_regex end end end
Version data entries
19 entries across 19 versions & 1 rubygems