diff options
| author | mo khan <mo@mokhan.ca> | 2014-11-21 16:57:33 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-11-21 16:57:33 -0700 |
| commit | 1cd098e291367cebc52e5a09f3e2e6fb7646de4e (patch) | |
| tree | 248038c6a342358c7b0c21c0fa90258b2f0313d1 /spec/controllers/api | |
| parent | 51265f238e29b224a85510c96d944dbec0449683 (diff) | |
add specs for categories controller.
Diffstat (limited to 'spec/controllers/api')
| -rw-r--r-- | spec/controllers/api/v2/categories_controller_spec.rb | 26 |
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 |
