mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 14:11:16 +08:00
Simplify user action make it more idiomatic
This commit is contained in:
22
spec/controllers/user_actions_controller_spec.rb
Normal file
22
spec/controllers/user_actions_controller_spec.rb
Normal file
@ -0,0 +1,22 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe UserActionsController do
|
||||
context 'index' do
|
||||
|
||||
it 'renders list correctly' do
|
||||
ActiveRecord::Base.observers.enable :all
|
||||
post = Fabricate(:post)
|
||||
|
||||
xhr :get, :index, username: post.user.username
|
||||
|
||||
response.status.should == 200
|
||||
parsed = JSON.parse(response.body)
|
||||
actions = parsed["user_actions"]
|
||||
actions.length.should == 1
|
||||
action = actions[0]
|
||||
action["acting_name"].should == post.user.name
|
||||
action["email"].should be_nil
|
||||
action["post_number"].should == "1"
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user