mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
26 lines
698 B
Ruby
26 lines
698 B
Ruby
require 'spec_helper'
|
|
|
|
describe UserActionsController do
|
|
context 'index' do
|
|
|
|
it 'fails if username is not specified' do
|
|
expect { xhr :get, :index }.to raise_error
|
|
end
|
|
|
|
it 'renders list correctly' do
|
|
ActiveRecord::Base.observers.enable :all
|
|
post = Fabricate(:post)
|
|
|
|
xhr :get, :index, username: post.user.username
|
|
|
|
expect(response.status).to eq(200)
|
|
parsed = JSON.parse(response.body)
|
|
actions = parsed["user_actions"]
|
|
expect(actions.length).to eq(1)
|
|
action = actions[0]
|
|
expect(action["acting_name"]).to eq(post.user.name)
|
|
expect(action["email"]).to eq(nil)
|
|
expect(action["post_number"]).to eq(1)
|
|
end
|
|
end
|
|
end
|