Sha256: e29f3751d7a30eeb8efda3e0c0d3a6e594d82419798dbc69254fe84e65c0483e

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe Popularity::RedditComment do
  context "non-reddit url" do
    use_vcr_cassette "reddit-comment"

    subject {
      Popularity::RedditComment.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-comment url" do
    use_vcr_cassette "reddit-comment"

    subject {
      Popularity::RedditComment.new('http://www.reddit.com/r/Fitness/comments/30wleu/me_and_my_wife_joined_the_gym_9_months_ago_we')
    }

    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-comment"

    subject {
      Popularity::RedditComment.new('http://www.reddit.com/r/Fitness/comments/30wleu/me_and_my_wife_joined_the_gym_9_months_ago_we/cpwrwat')
    }

    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 score" do
      expect(500).to eq(subject.score)
    end

    it "should have correct total" do
      expect(subject.total).to eq(subject.score)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
popularity-0.2.1 spec/reddit_comment_spec.rb
popularity-0.1.1 spec/reddit_comment_spec.rb
popularity-0.1.0 spec/reddit_comment_spec.rb
popularity-0.0.1 spec/reddit_comment_spec.rb