Sha256: 3eeba21db1d7d48ad18d0ff1a549ac2be51d71193f0cb056073e2afe50daae4b
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
require 'spec_helper' describe Popularity::RedditPost do context "non-reddit url" do use_vcr_cassette "reddit-post" subject { Popularity::RedditPost.new('http://google.com') } it "should be invalid" do expect(subject.valid?).to eq(false) end it "should have no resposne" do expect(subject.response).to eq(false) end end context "non-post url" do use_vcr_cassette "reddit-post" subject { Popularity::RedditPost.new('http://www.reddit.com/r/Fitness/comments/30wleu/me_and_my_wife_joined_the_gym_9_months_ago_we/cpwrwat') } it "should be invalid" do expect(subject.valid?).to eq(false) end it "should have no resposne" do expect(subject.response).to eq(false) end end context "reddit url" do use_vcr_cassette "reddit-post" subject { Popularity::RedditPost.new('http://www.reddit.com/r/funny/comments/2naq2t/every_time_my_brother_leaves_me_a_voicemail_he/') } it "should be valid" do expect(subject.valid?).to eq(true) end it "should have response" do expect(subject.response).to_not eq(false) end it "should have correct number of comments" do expect(36).to eq(subject.comments) end it "should have correct score" do expect(629).to eq(subject.score) end it "should have correct total" do expect(subject.total).to eq(subject.score + subject.comments) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
popularity-0.1.1 | spec/reddit_post_spec.rb |
popularity-0.1.0 | spec/reddit_post_spec.rb |
popularity-0.0.1 | spec/reddit_post_spec.rb |