Sha256: 4c9131d88204f1fbe0c7e8c519ba1ecb13d1c5f5fa8d6f9fde4e0d3ec5bf4075
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe 'RubyKhan' do describe '.new' do before do stub_request(:get, 'http://www.KhanAcademy.org/api/v1/topic/probability'). to_return(body: fixture('probability.json')) end it "returns a KhanAcademy::Topic" do expect(KhanAcademy::Topic.new('probability')).to be_a KhanAcademy::Topic end end describe 'TopicTree' do before do stub_request(:get, 'http://www.KhanAcademy.org/api/v1/topictree'). to_return(body: fixture('topictree.json')) end it "returns a hash of topics" do all = KhanAcademy::TopicTree.new expect(a_request(:get, 'http://www.KhanAcademy.org/api/v1/topictree')).to have_been_made expect(all.topics['cs']).to eq "programming" end end describe 'new topic' do before do stub_request(:get, 'http://www.KhanAcademy.org/api/v1/topic/probability'). to_return(body: fixture('probability.json')) end it 'fetches a hash about the topic' do probability = KhanAcademy::Topic.new('probability') expect(a_request(:get, 'http://www.KhanAcademy.org/api/v1/topic/probability')).to have_been_made expect(probability.title).to eq "Probability and statistics" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubykhan-0.0.3 | spec/rubykhan_spec.rb |
rubykhan-0.0.2 | spec/rubykhan_spec.rb |