You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
808 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Admin::ActionLogsHelper, type: :helper do
  4. klass = Class.new do
  5. include ActionView::Helpers
  6. include Admin::ActionLogsHelper
  7. end
  8. let(:hoge) { klass.new }
  9. describe '#log_target' do
  10. after do
  11. hoge.log_target(log)
  12. end
  13. context 'log.target' do
  14. let(:log) { double(target: true) }
  15. it 'calls linkable_log_target' do
  16. expect(hoge).to receive(:linkable_log_target).with(log.target)
  17. end
  18. end
  19. context '!log.target' do
  20. let(:log) { double(target: false, target_type: :type, recorded_changes: :change) }
  21. it 'calls log_target_from_history' do
  22. expect(hoge).to receive(:log_target_from_history).with(log.target_type, log.recorded_changes)
  23. end
  24. end
  25. end
  26. end