discourse/spec/models/user_history_spec.rb
Luciano Sousa b3d769ff4f Update rspec syntax to v3
update rspec syntax to v3

change syntax to rspec v3

oops. fix typo

mailers classes with rspec3 syntax

helpers with rspec3 syntax

jobs with rspec3 syntax

serializers with rspec3 syntax

views with rspec3 syntax

support to rspec3 syntax

category spec with rspec3 syntax
2015-01-05 11:59:30 -03:00

24 lines
895 B
Ruby

require 'spec_helper'
describe UserHistory do
describe '#staff_action_records' do
context "with some records" do
before do
@change_site_setting = UserHistory.create!({action: UserHistory.actions[:change_site_setting], subject: "title", previous_value: "Old", new_value: "New"})
@change_trust_level = UserHistory.create!({action: UserHistory.actions[:change_trust_level], target_user_id: Fabricate(:user).id, details: "stuff happened"})
end
it "returns all records for admins" do
records = described_class.staff_action_records(Fabricate(:admin)).to_a
expect(records.size).to eq(2)
end
it "doesn't return records to moderators that only admins should see" do
records = described_class.staff_action_records(Fabricate(:moderator)).to_a
expect(records).to eq([@change_trust_level])
end
end
end
end