summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2017-09-03 15:16:43 -0600
committermo <mo.khan@gmail.com>2017-09-03 15:16:43 -0600
commitdceee11f9b6b2a1d8ce151a94743f765d4f72b5a (patch)
treef12fc6dccedb47ae5fb6a413275f55665beeffeb /spec
parent2fe8923b80b89f336c960d59c267776235ef91e5 (diff)
remove disqus
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/cakes_controller_spec.rb69
-rw-r--r--spec/controllers/comments_controller_spec.rb20
-rw-r--r--spec/helpers/application_helper_spec.rb18
-rw-r--r--spec/routing/comments_routing_spec.rb7
4 files changed, 0 insertions, 114 deletions
diff --git a/spec/controllers/cakes_controller_spec.rb b/spec/controllers/cakes_controller_spec.rb
deleted file mode 100644
index c1f80789..00000000
--- a/spec/controllers/cakes_controller_spec.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'rails_helper'
-
-describe CakesController do
- let(:user) { create(:user) }
-
- describe "#index" do
- let!(:cakes) { create(:category, slug: "cakes") }
- let!(:cookies) { create(:category, slug: "cookies") }
-
- it "returns all published cakes" do
- cake = create(:published_cake, category: cakes)
- cookie = create(:published_cake, category: cookies)
- unpublished_cake = create(:cake, category: cakes)
- get :index
- expect(assigns(:cakes)).to match_array([cake, cookie])
- end
-
- it "returns all cakes in the category" do
- cookie = create(:published_cake, name: "cookie", category: cookies)
- get :index, category: cookie.category.slug
- expect(assigns(:cakes)).to match_array([cookie])
- end
-
- it "returns all cakes matching the search query" do
- cake = create(:published_cake, name: "cake", category: cakes)
- get :index, q: cake.name[0..2]
- expect(assigns(:cakes)).to match_array([cake])
- end
-
- it "returns all cakes tagged with the tag" do
- cake = create(:published_cake, name: "cake", category: cakes)
- cake.tag_list = "cakes"
- cake.save!
-
- get :index, tags: "cakes"
- expect(assigns(:cakes)).to match_array([cake])
- end
-
- describe "sorting" do
- let!(:old_cake) { create(:published_cake, name: 'old', created_at: 2.days.ago) }
- let!(:new_cake) { create(:published_cake, name: 'new', created_at: 1.day.ago) }
-
- it 'returns oldest cakes first' do
- get :index, sort: "oldest"
- expect(assigns(:cakes).to_a).to eql([ old_cake, new_cake ])
- end
-
- it 'returns newest cakes first' do
- get :index, sort: "newest"
- expect(assigns(:cakes).to_a).to eql([ new_cake, old_cake ])
- end
- end
- end
-
- describe "#show" do
- let(:cake) { create(:cake, user: user) }
- let(:photo) { create(:photo, imageable: cake) }
-
- it "loads the cake" do
- get :show, id: cake.id
- expect(assigns(:creation)).to eql(cake)
- end
-
- it 'loads the selected image' do
- get :show, id: cake.id, photo_id: photo.id
- expect(assigns(:primary_image)).to eql(photo)
- end
- end
-end
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb
deleted file mode 100644
index 55acf20d..00000000
--- a/spec/controllers/comments_controller_spec.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require "rails_helper"
-
-describe CommentsController do
- context "#create" do
- let(:creation) { create(:creation) }
- let(:user) { create(:user) }
-
- before :each do
- http_login(user)
- end
-
- it "creates a new comment" do
- post :create, id: 1207743539, url: "http://localhost:3000/creations/#{creation.to_param}", comment: { id: 1207743539, text: 'very nice' }
- comment = Comment.last
- expect(comment.disqus_id).to eql(1207743539)
- expect(comment.creation).to eql(creation)
- expect(comment.text).to eql('very nice')
- end
- end
-end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 10efd8aa..b547f93f 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -1,22 +1,4 @@
require "rails_helper"
describe ApplicationHelper do
- describe "#disqus_auth" do
- let(:user) { create(:user) }
- let(:secret) { 'secret' }
-
- let(:expected) do
- data = { id: user.id, username: user.name, email: user.email, url: "https://test.host/profiles/#{user.to_param}" }.to_json
- message = Base64.encode64(data).gsub("\n", "")
- timestamp = Time.now.to_i
- signature = OpenSSL::HMAC.hexdigest('sha1', secret, "#{message} #{timestamp}")
- "#{message} #{signature} #{timestamp}"
- end
-
- before { ENV['DISQUS_SECRET_KEY'] = secret }
-
- it "should generate a single sign on token" do
- expect(helper.disqus_auth(user)).to eql(expected)
- end
- end
end
diff --git a/spec/routing/comments_routing_spec.rb b/spec/routing/comments_routing_spec.rb
deleted file mode 100644
index 36ce7511..00000000
--- a/spec/routing/comments_routing_spec.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require "rails_helper"
-
-describe "/comments" do
- it "routes to the create action" do
- expect({ :post => '/comments' }).to route_to(controller: 'comments', action: 'create')
- end
-end