Sha256: e4411bfdb185087be10516839f10a0278a40f3531fa846c6ab814038387fd23c

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'

module USaidWat
  module Service
    describe MockService do
      let (:service) { MockService.new }

      describe "#user" do
        it "returns a mock user" do
          expect(service.user("mipadi")).to respond_to(:comments)
        end
      end
    end

    describe USaidWat::Thing::User do
      let (:user) { MockService.new.user("mipadi") }

      describe "#comments" do
        it "should return an array of comments" do
          expect(user.comments(100)).to respond_to(:count)
          expect(user.comments(100)).to respond_to(:reject)
          expect(user.comments(100)).to respond_to(:empty?)
          expect(user.comments(100)).to respond_to(:each)
          expect(user.comments(100).count).to eq(100)
        end
      end
    end

    describe USaidWat::Thing::Comment do
      let (:comment) { MockService.new.user("mipadi").comments(100).first }

      describe "#subreddit" do
        it "should return a string denoting what subreddit it belongs to" do
          expect(comment.subreddit).to eq("wikipedia")
        end
      end

      describe "#body" do
        it "should return the comment's body" do
          expect(comment.body).to eq("Yep. My first experience with a Heisenbug occurred in a C++ program, and disappeared when I tried to print a variable with printf (only to reappear when that call was removed).")
        end
      end

      describe "#id" do
        it "should return an ID" do
          expect(comment.id).to eq("c79peed")
        end
      end

      describe "#link_id" do
        it "should return a link ID" do
          expect(comment.link_id).to eq("t3_142t4w")
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
usaidwat-1.6.1 spec/usaidwat/service_spec.rb
usaidwat-1.6.0 spec/usaidwat/service_spec.rb
usaidwat-1.5.1 spec/usaidwat/service_spec.rb
usaidwat-1.5.0 spec/usaidwat/service_spec.rb