Simplify user action make it more idiomatic

This commit is contained in:
Sam
2013-05-27 10:22:37 +10:00
parent 6046d33645
commit d84ae80074
4 changed files with 70 additions and 36 deletions

View 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