Sha256: 7134bc64c33c13caf0eb1ce62edb0ff236fcace8981dff3bf0c8b489d02dce70
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
require 'spec_helper' describe RapGenius::Annotation do let(:annotation) { described_class.new(id: "1234") } subject { annotation } before do RapGenius::Annotation.any_instance.stubs(:fetch). returns( File.read(File.expand_path("../support/annotation.html", __FILE__)) ) end describe ".find" do subject { described_class.find("9999") } its(:id) { should eq "9999"} it "should fetch the document to get annotation details" do subject.expects(:fetch).once.returns( File.read(File.expand_path("../support/annotation.html", __FILE__)) ) subject.explanation end end its(:id) { should eq "1234" } its(:url) { should eq "http://rapgenius.com/1234" } describe "#lyric" do subject { annotation.lyric } it "only calls fetch the first time" do annotation.expects(:fetch).once.returns( File.read(File.expand_path("../support/annotation.html", __FILE__)) ) 2.times { annotation.lyric } end it { should eq "You gon' get this rain like it's May weather," } end describe "#explanation" do subject { annotation.explanation } it "only calls fetch the first time" do annotation.expects(:fetch).once.returns( File.read(File.expand_path("../support/annotation.html", __FILE__)) ) 2.times { annotation.explanation } end it { should include "making it rain" } end its(:song) { should be_a RapGenius::Song } its("song.url") { should eq "http://rapgenius.com/Big-sean-control-lyrics" } context "with additional parameters passed into the constructor" do let(:annotation) { described_class.new(id: "5678", lyric: "foo") } its(:id) { should eq "5678" } its(:lyric) { should eq "foo" } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rapgenius-0.0.2 | spec/annotation_spec.rb |
rapgenius-0.0.1 | spec/annotation_spec.rb |