summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/api/v2/categories_controller_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/api/v2/categories_controller_spec.rb b/spec/controllers/api/v2/categories_controller_spec.rb
new file mode 100644
index 00000000..5a913145
--- /dev/null
+++ b/spec/controllers/api/v2/categories_controller_spec.rb
@@ -0,0 +1,26 @@
+require 'rails_helper'
+
+module Api
+ module V2
+ describe CategoriesController do
+ describe "#index" do
+ let!(:category) { create(:category) }
+
+ it 'loads all the categories' do
+ xhr :get, :index
+ expect(assigns(:categories)).to match_array([category])
+ end
+ end
+
+ describe "#show" do
+ let!(:other_category) { create(:category) }
+ let!(:category) { create(:category) }
+
+ it 'loads the specified category' do
+ xhr :get, :show, id: category.id
+ expect(assigns(:category)).to eql(category)
+ end
+ end
+ end
+ end
+end