Sha256: 235588f41031a5852694b4658bddcfff56f6cf62855d4043cc157395b63205bd

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

require 'rails_helper'

module RocketJobMissionControl
  RSpec.describe SlicesHelper, type: :helper do
    before do
      helper.extend(RocketJobMissionControl::ApplicationHelper)
    end

    describe '#display_slice_info' do
      let(:slice) { {id: 42, name: 'test'} }

      context "when encrypted" do
        it { expect(helper.display_slice_info(slice, true)).to eq('encrypted') }
      end

      context "when unencrypted" do
        before do
          allow(helper).to receive(:pretty_print_array_or_hash)
        end

        it "does not return 'encrypted'" do
          expect(helper.display_slice_info(slice, false)).to_not eq('encrypted')
        end

        it "displays the slice info" do
          helper.display_slice_info(slice, false)
          expect(helper).to have_received(:pretty_print_array_or_hash).with(slice.to_a)
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rocketjob_mission_control-3.0.0.rc1 spec/helpers/slices_helper_spec.rb
rocketjob_mission_control-2.1.1 spec/helpers/slices_helper_spec.rb
rocketjob_mission_control-2.1.0 spec/helpers/slices_helper_spec.rb
rocketjob_mission_control-2.0.0 spec/helpers/slices_helper_spec.rb
rocketjob_mission_control-2.0.0.rc2 spec/helpers/slices_helper_spec.rb
rocketjob_mission_control-2.0.0.rc1 spec/helpers/slices_helper_spec.rb