FIX: roll up staff action wasn't working

This commit is contained in:
Régis Hanol
2014-11-27 01:12:23 +01:00
parent 3fd4fc679e
commit 4e735e8aab
2 changed files with 13 additions and 2 deletions

View File

@@ -165,9 +165,9 @@ class StaffActionLogger
})) }))
end end
def log_roll_up(subnets) def log_roll_up(subnets, opts={})
UserHistory.create(params(opts).merge({ UserHistory.create(params(opts).merge({
action: UserHistory.action[:roll_up], action: UserHistory.actions[:roll_up],
details: subnets.join(", ") details: subnets.join(", ")
})) }))
end end

View File

@@ -220,4 +220,15 @@ describe StaffActionLogger do
log_record.details.should == badge.name log_record.details.should == badge.name
end end
end end
describe 'log_roll_up' do
let(:subnets) { ["1.2.3.0/24", "42.42.42.0/24"] }
subject(:log_roll_up) { described_class.new(admin).log_roll_up(subnets) }
it 'creates a new UserHistory record' do
log_record = logger.log_roll_up(subnets)
log_record.should be_valid
log_record.details.should == subnets.join(", ")
end
end
end end