<commit_before>describe ContainerImageController do
  render_views
  before(:each) do
    stub_user(:features => :all)
  end

  it "when Smart Analysis is pressed" do
    ApplicationController.handle_exceptions = true

    expect(controller).to receive(:scan_images)
    post :button, :params => { :pressed => 'container_image_scan', :format => :js }
    expect(controller.send(:flash_errors?)).not_to be_truthy
  end

  it "when Check Compliance is pressed with no images" do
    ApplicationController.handle_exceptions = true

    expect(controller).to receive(:check_compliance).and_call_original
    expect(controller).to receive(:add_flash).with("No Container Images were selected for Compliance Check", :error)
    expect(controller).to receive(:add_flash).with("Container Image no longer exists", :error)
    post :button, :params => { :pressed => 'container_image_check_compliance', :format => :js }
  end

  it 'renders edit container image tags' do
    ApplicationController.handle_exceptions = true

    post :button, :params => {:pressed => "container_image_protect", :format => :js}
    expect(response.status).to eq(200)
    expect(response.body).to_not be_empty<commit_msg>Corrected specs<commit_after>describe ContainerImageController do
  render_views
  before(:each) do
    stub_user(:features => :all)
  end

  it "when Smart Analysis is pressed" do
    ApplicationController.handle_exceptions = true

    expect(controller).to receive(:scan_images)
    post :button, :params => { :pressed => 'container_image_scan', :format => :js }
    expect(controller.send(:flash_errors?)).not_to be_truthy
  end

  it "when Check Compliance is pressed with no images" do
    ApplicationController.handle_exceptions = true

    post :button, :params => { :pressed => 'container_image_check_compliance', :format => :js }
    expect(response.body).to match(/Can.+t access records without an id/)
  end

  it 'renders edit container image tags' do
    ApplicationController.handle_exceptions = true

    post :button, :params => {:pressed => "container_image_protect", :format => :js}
    expect(response.status).to eq(200)
    expect(response.body).to_not be_empty
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.0027662517289073307, 'mean_word_length': 4.725593667546174, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3743892', 'n_tokens_mistral': 639, 'n_tokens_neox': 606, 'n_words': 166}