Sha256: 3929ebed0868ebabf96d2b0c06086652af08cccf47de235e6ee70abd5c73ed51
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require 'spec_helper' describe DiscourseApi::API::Categories do subject { DiscourseApi::Client.new("http://localhost:3000", "test_d7fd0429940", "test_user" )} describe "#categories" do before do stub_get("http://localhost:3000/categories.json?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("categories.json"), headers: { content_type: "application/json" }) end it "requests the correct resource" do subject.categories expect(a_get("http://localhost:3000/categories.json?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made end it "returns the requested categories" do categories = subject.categories expect(categories).to be_an Array expect(categories.first).to be_a Hash end it "returns the requested categories with hash arg" do categories = subject.categories({}) expect(categories).to be_an Array expect(categories.first).to be_a Hash end end describe '#category_latest_topics' do before do stub_get("http://localhost:3000/category/category-slug/l/latest.json?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("category_latest_topics.json"), headers: { content_type: "application/json" }) end it "returns the latest topics in a category" do latest_topics = subject.category_latest_topics('category-slug') expect(latest_topics).to be_an Array end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse_api-0.4.0 | spec/discourse_api/api/categories_spec.rb |
discourse_api-0.3.6 | spec/discourse_api/api/categories_spec.rb |