|
28 | 28 | end |
29 | 29 | end |
30 | 30 |
|
| 31 | + describe "#categories_full" do |
| 32 | + before do |
| 33 | + stub_get("#{host}/categories.json") |
| 34 | + .to_return(body: fixture("categories.json"), headers: { content_type: "application/json" }) |
| 35 | + end |
| 36 | + |
| 37 | + it "requests the correct resource" do |
| 38 | + subject.categories |
| 39 | + expect(a_get("#{host}/categories.json")).to have_been_made |
| 40 | + end |
| 41 | + |
| 42 | + it "returns the entire categories response" do |
| 43 | + categories = subject.categories_full |
| 44 | + expect(categories).to be_a Hash |
| 45 | + expect(categories).to have_key 'category_list' |
| 46 | + expect(categories).to have_key 'featured_users' |
| 47 | + end |
| 48 | + end |
| 49 | + |
31 | 50 | describe '#category_latest_topics' do |
32 | 51 | before do |
33 | 52 | stub_get("#{host}/c/category-slug/l/latest.json") |
|
40 | 59 | end |
41 | 60 | end |
42 | 61 |
|
| 62 | + describe '#category_latest_topics_full' do |
| 63 | + before do |
| 64 | + stub_get("#{host}/c/category-slug/l/latest.json") |
| 65 | + .to_return(body: fixture("category_latest_topics.json"), headers: { content_type: "application/json" }) |
| 66 | + end |
| 67 | + |
| 68 | + it "returns the entire latest topics in a category response" do |
| 69 | + latest_topics = subject.category_latest_topics_full(category_slug: 'category-slug') |
| 70 | + expect(latest_topics).to be_a Hash |
| 71 | + expect(latest_topics).to have_key 'topic_list' |
| 72 | + expect(latest_topics).to have_key 'users' |
| 73 | + end |
| 74 | + end |
| 75 | + |
43 | 76 | describe '#category_top_topics' do |
44 | 77 | before do |
45 | 78 | stub_get("#{host}/c/category-slug/l/top.json") |
|
55 | 88 | end |
56 | 89 | end |
57 | 90 |
|
| 91 | + describe '#category_top_topics_full' do |
| 92 | + before do |
| 93 | + stub_get("#{host}/c/category-slug/l/top.json") |
| 94 | + .to_return( |
| 95 | + body: fixture("category_topics.json"), |
| 96 | + headers: { content_type: "application/json" } |
| 97 | + ) |
| 98 | + end |
| 99 | + |
| 100 | + it "returns the entire top topics in a category response" do |
| 101 | + topics = subject.category_top_topics_full('category-slug') |
| 102 | + expect(topics).to be_a Hash |
| 103 | + expect(topics).to have_key 'topic_list' |
| 104 | + expect(topics).to have_key 'users' |
| 105 | + end |
| 106 | + end |
| 107 | + |
58 | 108 | describe '#category_new_topics' do |
59 | 109 | before do |
60 | 110 | stub_get("#{host}/c/category-slug/l/new.json") |
|
70 | 120 | end |
71 | 121 | end |
72 | 122 |
|
| 123 | + describe '#category_new_topics_full' do |
| 124 | + before do |
| 125 | + stub_get("#{host}/c/category-slug/l/new.json") |
| 126 | + .to_return( |
| 127 | + body: fixture("category_topics.json"), |
| 128 | + headers: { content_type: "application/json" } |
| 129 | + ) |
| 130 | + end |
| 131 | + |
| 132 | + it "returns the new topics in a category" do |
| 133 | + topics = subject.category_new_topics_full('category-slug') |
| 134 | + expect(topics).to be_a Hash |
| 135 | + expect(topics).to have_key 'topic_list' |
| 136 | + expect(topics).to have_key 'users' |
| 137 | + end |
| 138 | + end |
| 139 | + |
73 | 140 | describe '#category_new_category' do |
74 | 141 | before do |
75 | 142 | stub_post("#{host}/categories") |
|
0 commit comments