Sha256: ee69e3ec5ba93c054e4bc2e53142f1f35d4dad77cef48019e34df94d0c30734d
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 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 different 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
popularity-0.2.1 | spec/results_container_spec.rb |