parent
ae1fac0062
commit
eec0dc46a6
@ -1,3 +0,0 @@ |
|||||||
// Place all the styles related to the Api::Media controller here. |
|
||||||
// They will automatically be included in application.css. |
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
|
@ -1,16 +0,0 @@ |
|||||||
class StatusesController < ApplicationController |
|
||||||
before_action :authenticate_user! |
|
||||||
|
|
||||||
def create |
|
||||||
PostStatusService.new.(current_user.account, status_params[:text]) |
|
||||||
redirect_to root_path |
|
||||||
rescue ActiveRecord::RecordInvalid |
|
||||||
redirect_to root_path |
|
||||||
end |
|
||||||
|
|
||||||
private |
|
||||||
|
|
||||||
def status_params |
|
||||||
params.require(:status).permit(:text) |
|
||||||
end |
|
||||||
end |
|
@ -1,2 +0,0 @@ |
|||||||
module StatusesHelper |
|
||||||
end |
|
@ -1,24 +0,0 @@ |
|||||||
require 'rails_helper' |
|
||||||
|
|
||||||
RSpec.describe StatusesController, type: :controller do |
|
||||||
let(:user) { Fabricate(:user) } |
|
||||||
|
|
||||||
before do |
|
||||||
sign_in user, scope: :user |
|
||||||
end |
|
||||||
|
|
||||||
describe 'POST #create' do |
|
||||||
before do |
|
||||||
stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {}) |
|
||||||
post :create, params: { 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 |
|
@ -1,15 +1,5 @@ |
|||||||
require 'rails_helper' |
require 'rails_helper' |
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes |
|
||||||
# the Api::Accounts::LookupHelper. For example: |
|
||||||
# |
|
||||||
# describe Api::Accounts::LookupHelper do |
|
||||||
# describe "string concat" do |
|
||||||
# it "concats two strings with spaces" do |
|
||||||
# expect(helper.concat_strings("this","that")).to eq("this that") |
|
||||||
# end |
|
||||||
# end |
|
||||||
# end |
|
||||||
RSpec.describe Api::Accounts::LookupHelper, type: :helper do |
RSpec.describe Api::Accounts::LookupHelper, type: :helper do |
||||||
pending "add some examples to (or delete) #{__FILE__}" |
|
||||||
end |
end |
||||||
|
@ -1,15 +1,5 @@ |
|||||||
require 'rails_helper' |
require 'rails_helper' |
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes |
|
||||||
# the Api::MediaHelper. For example: |
|
||||||
# |
|
||||||
# describe Api::MediaHelper do |
|
||||||
# describe "string concat" do |
|
||||||
# it "concats two strings with spaces" do |
|
||||||
# expect(helper.concat_strings("this","that")).to eq("this that") |
|
||||||
# end |
|
||||||
# end |
|
||||||
# end |
|
||||||
RSpec.describe Api::MediaHelper, type: :helper do |
RSpec.describe Api::MediaHelper, type: :helper do |
||||||
pending "add some examples to (or delete) #{__FILE__}" |
|
||||||
end |
end |
||||||
|
@ -1,15 +0,0 @@ |
|||||||
require 'rails_helper' |
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes |
|
||||||
# the StatusesHelper. For example: |
|
||||||
# |
|
||||||
# describe StatusesHelper do |
|
||||||
# describe "string concat" do |
|
||||||
# it "concats two strings with spaces" do |
|
||||||
# expect(helper.concat_strings("this","that")).to eq("this that") |
|
||||||
# end |
|
||||||
# end |
|
||||||
# end |
|
||||||
RSpec.describe StatusesHelper, type: :helper do |
|
||||||
pending "add some examples to (or delete) #{__FILE__}" |
|
||||||
end |
|
Loading…
Reference in new issue