spec/app_spec.rb in apprank-0.0.1 vs spec/app_spec.rb in apprank-1.0.0

- old
+ new

@@ -3,27 +3,54 @@ describe App do describe "when you load the data" do it "should get data" do - app, expected, data = create_fake_app + data = JSON.load(SpecHelper.data) + app = Apprank::App.new(data['feed']['entry'][0]) - app.name.should == expected[:name] - app.icon_urls.should == expected[:icon_urls] - app.summary.should == expected[:summary] - app.price.should == expected[:price] - app.rights.should == expected[:rights] - app.display_name.should == expected[:title] - app.link.should == expected[:link] - app.preview.should == expected[:preview] - app.itunes_url.should == expected[:itunes_url] - app.developer.should == expected[:developer] - app.category.should == expected[:category] + expected = { + name: "Color Switch", + icon_urls: { + small: "http://is3.mzstatic.com/image/thumb/Purple69/v4/d4/70/15/d4701594-2c52-185f-766f-45fd4eab0f75/mzl.ytgnpnrv.png/53x53bb-85.png", + medium: "http://is5.mzstatic.com/image/thumb/Purple69/v4/d4/70/15/d4701594-2c52-185f-766f-45fd4eab0f75/mzl.ytgnpnrv.png/75x75bb-85.png", + large: "http://is4.mzstatic.com/image/thumb/Purple69/v4/d4/70/15/d4701594-2c52-185f-766f-45fd4eab0f75/mzl.ytgnpnrv.png/100x100bb-85.png", + }, + summary: "Tap the ball carefully through each obstacle and your ball will switch color with some powerups.\nYou must follow the color pattern on each obstacle to cross it ! \n\nBe careful not to pass through the wrong color, or you’ll have to start again.", + price: { + amount: 0.0, + currency: "USD" + }, + rights: "© 2016 Fortafy Games", + title: "Color Switch - Samuel Ratumaitavuki", + link: "https://itunes.apple.com/us/app/color-switch/id1053533457?mt=8&uo=2", + itunes_url: "https://itunes.apple.com/us/app/color-switch/id1053533457?mt=8&uo=2", + itunes_id: "1053533457", + bundle_id: "com.fortafygames.colorswitch", + artist: { + name: "Samuel Ratumaitavuki", + url: "https://itunes.apple.com/us/developer/samuel-ratumaitavuki/id1053533456?mt=8&uo=2" + }, + category: { + name: "Games", + url: "https://itunes.apple.com/us/genre/ios-games/id6014?mt=8&uo=2" + }, + } - date_diff = app.release_date - expected[:release_date] - date_diff.abs.should <= 1 + expect(app.name).to eq(expected[:name]) + expect(app.icon_urls).to eq(expected[:icon_urls]) + expect(app.summary).to eq(expected[:summary]) + expect(app.price).to eq(expected[:price]) + expect(app.rights).to eq(expected[:rights]) + expect(app.title).to eq(expected[:title]) + expect(app.link).to eq(expected[:link]) + expect(app.itunes_url).to eq(expected[:itunes_url]) + expect(app.itunes_id).to eq(expected[:itunes_id]) + expect(app.bundle_id).to eq(expected[:bundle_id]) + expect(app.artist).to eq(expected[:artist]) + expect(app.category).to eq(expected[:category]) + expect(app.release_date).to be_a(Time) - app.itunes_id.should == expected[:itunes_id] end end end