Created
October 16, 2012 13:18
-
-
Save jonpaul/3899230 to your computer and use it in GitHub Desktop.
from article sourcefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "GET profile" do | |
let(:player) { Dish::Player.new('simplebits') } | |
before do | |
VCR.insert_cassette 'base', :record => :new_episodes | |
end | |
after do | |
VCR.eject_cassette | |
end | |
it "must have a profile method" do | |
player.must_respond_to :profile | |
end | |
it "must parse the api response from JSON to Hash" do | |
player.profile.must_be_instance_of Hash | |
end | |
it "must get the right profile" do | |
player.profile["username"].must_equal "simplebits" | |
end | |
describe "dynamic attributes" do | |
before do | |
player.profile | |
end | |
it "must return the attribute value if present in profile" do | |
player.id.must_equal 1 | |
end | |
it "must raise method missing if attribute is not present" do | |
lambda { player.foo_attribute }.must_raise NoMethodError | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment