about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-21 18:26:47 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-21 18:26:47 +0100
commitf14f462eaf8dcf272db54cd513bf7ffe7dc6a6e3 (patch)
tree2275619996f64b55369e4f35cd228eb52dc48601 /spec/controllers
parentc28971c70c3d5caf18a5e931ff345534f1e4cece (diff)
Adding Turbolinks, adding status posting form on homepage
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/statuses_controller_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/statuses_controller_spec.rb b/spec/controllers/statuses_controller_spec.rb
new file mode 100644
index 000000000..05566a30e
--- /dev/null
+++ b/spec/controllers/statuses_controller_spec.rb
@@ -0,0 +1,24 @@
+require 'rails_helper'
+
+RSpec.describe StatusesController, type: :controller do
+  let(:user) { Fabricate(:user) }
+
+  before do
+    sign_in :user, user
+  end
+
+  describe 'POST #create' do
+    before do
+      stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
+      post :create, status: { text: 'Hello world' }
+    end
+
+    it 'redirects back to homepage' do
+      expect(response).to redirect_to(root_path)
+    end
+
+    it 'creates a new status' do
+      expect(user.account.statuses.count).to eq 1
+    end
+  end
+end