Sha256: 8f990d64dd242a9766b3c25095818548a159414972b9d6352ef48a426fb22c0f
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
require 'spec_helper' describe Popularity::ResultsContainer do context "same results" do use_vcr_cassette "result-container-test" subject { Popularity::ResultsContainer.new } it "should add first result" do subject.add_result Popularity::Facebook.new("http://google.com") expect(1).to equal(subject.results.size) subject.add_result Popularity::Facebook.new("http://facebook.com") expect(2).to equal(subject.results.size) end end context "same results" do use_vcr_cassette "result-container-test" subject { Popularity::ResultsContainer.new } it "should reject differnt types" do subject.add_result Popularity::Facebook.new("http://google.com") expect(1).to equal(subject.results.size) expect{ subject.add_result(Popularity::Twitter.new("http://google.com")) } .to raise_error(TypeError) end end context "adding results" do use_vcr_cassette "result-container-test" subject { Popularity::ResultsContainer.new } it "should add methods together" do subject.add_result Popularity::Facebook.new("http://google.com") subject.add_result Popularity::Facebook.new("http://yahoo.com") expect(subject.results.collect(&:shares).reduce(:+)).to eq(subject.shares) end it "should add methods together" do subject.add_result Popularity::Facebook.new("http://google.com") subject.add_result Popularity::Facebook.new("http://yahoo.com") expect(subject.results.collect(&:shares).reduce(:+)).to eq(subject.shares) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
popularity-0.1.1 | spec/results_container_spec.rb |
popularity-0.1.0 | spec/results_container_spec.rb |
popularity-0.0.1 | spec/results_container_spec.rb |