2016-03-21 18:26:47 +01:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe StatusesController, type: :controller do
|
|
|
|
let(:user) { Fabricate(:user) }
|
|
|
|
|
|
|
|
before do
|
2016-08-17 17:56:23 +02:00
|
|
|
sign_in user, scope: :user
|
2016-03-21 18:26:47 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'POST #create' do
|
|
|
|
before do
|
|
|
|
stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
|
2016-08-17 17:56:23 +02:00
|
|
|
post :create, params: { status: { text: 'Hello world' } }
|
2016-03-21 18:26:47 +01:00
|
|
|
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
|