summaryrefslogtreecommitdiff
path: root/spec/controllers/api
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-06-15 01:18:38 -0600
committermo khan <mo@mokhan.ca>2014-06-15 01:18:38 -0600
commita928d4da0df37aed3b2c09127cab3e673cf871a3 (patch)
tree559f45aa469d932dec99759d13d6729fb86f4d18 /spec/controllers/api
parent33bce064d7904324d0df59c6fe234a37c89caa14 (diff)
move new backbone page into my/cakes.
Diffstat (limited to 'spec/controllers/api')
-rw-r--r--spec/controllers/api/v1/cakes_controller_spec.rb23
-rw-r--r--spec/controllers/api/v1/creations_controller_spec.rb20
2 files changed, 23 insertions, 20 deletions
diff --git a/spec/controllers/api/v1/cakes_controller_spec.rb b/spec/controllers/api/v1/cakes_controller_spec.rb
new file mode 100644
index 00000000..e6551472
--- /dev/null
+++ b/spec/controllers/api/v1/cakes_controller_spec.rb
@@ -0,0 +1,23 @@
+require "rails_helper"
+
+describe Api::V1::CakesController do
+ context "when signed in" do
+ let(:user) { create(:user) }
+ let!(:my_cake) { create(:creation) }
+ let!(:other_cake) { create(:creation) }
+
+ before :each do
+ request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials(user.authentication_token)
+ user.creations << my_cake
+ get :index, :format => :json
+ end
+
+ it "should return all of my cakes" do
+ assigns(:cakes).should include(my_cake)
+ end
+
+ it "should not return any other cakes" do
+ assigns(:cakes).should_not include(other_cake)
+ end
+ end
+end
diff --git a/spec/controllers/api/v1/creations_controller_spec.rb b/spec/controllers/api/v1/creations_controller_spec.rb
deleted file mode 100644
index 48174e04..00000000
--- a/spec/controllers/api/v1/creations_controller_spec.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require "rails_helper"
-
-describe Api::V1::CreationsController do
- context "when signed in" do
- let(:creation) { create(:creation) }
- let(:user) { create(:user) }
- let(:repository) { double }
-
- before :each do
- request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Token.encode_credentials(user.authentication_token)
- CreationRepository.any_instance.stub(:visible_creations).and_return([creation])
-
- get :index, :format => :json
- end
-
- it "should return all viewable creations" do
- assigns(:creations).should include(creation)
- end
- end
-end