<commit_before>describe VmCloudController do
  render_views
  before :each do
    set_user_privileges
    EvmSpecHelper.create_guid_miq_server_zone
  end

  context "#tree_select" do
    [
      %w(Instances instances_tree),
      %w(Images images_tree),
      %w(Instances instances_filter_tree),
      %w(Images images_filter_tree)
    ].each do |elements, tree|
      it "renders list of #{elements} for #{tree} root node" do
        FactoryGirl.create(:vm_openstack)
        FactoryGirl.create(:template_openstack)

        session[:settings] = {}
        seed_session_trees('vm_cloud', tree.to_sym)

        post :tree_select, :params => { :id => 'root', :format => :js }

        expect(response).to render_template('layouts/gtl/_list')
        expect(response.status).to eq(200)
      end
    end

    it "renders Instance details for Instance node" do
      instance = FactoryGirl.create(:vm_openstack)

      session[:settings] = {}
      seed_session_trees('vm_cloud', 'instances_tree')

      post :tree_select, :params => { :id => "v-#{instance.compressed_id}", :format => :js }

      expect(response).to render_template('vm_cloud/_main')
      expect(response).to render_template('shared/summary/_textual_tags')
      expect(response.status).to eq(200)
    end
  end
end<commit_msg>Add specs for cloud instance display in explorer. (transferred from ManageIQ/manageiq@78296e7326dd9faedcc850e2670563c40bfabe3f)<commit_after>describe VmCloudController do
  render_views
  before :each do
    set_user_privileges
    EvmSpecHelper.create_guid_miq_server_zone
  end

  context "#tree_select" do
    [
      %w(Instances instances_tree),
      %w(Images images_tree),
      %w(Instances instances_filter_tree),
      %w(Images images_filter_tree)
    ].each do |elements, tree|
      it "renders list of #{elements} for #{tree} root node" do
        FactoryGirl.create(:vm_openstack)
        FactoryGirl.create(:template_openstack)

        session[:settings] = {}
        seed_session_trees('vm_cloud', tree.to_sym)

        post :tree_select, :params => { :id => 'root', :format => :js }

        expect(response).to render_template('layouts/gtl/_list')
        expect(response.status).to eq(200)
      end
    end

    [
      %w(vm_openstack Openstack),
      %w(vm_azure Azure),
      %w(vm_google Google),
      %w(vm_amazon Amazon)
    ].each do |instance, name|
      it "renders Instance details for #{name} node" do
        instance = FactoryGirl.create(instance.to_sym)

        session[:settings] = {}
        seed_session_trees('vm_cloud', 'instances_tree')

        post :tree_select, :params => { :id => "v-#{instance.compressed_id}", :format => :js }

        expect(response).to render_template('vm_cloud/_main')
        expect(response).to render_template('shared/summary/_textual_tags')
        expect(response.status).to eq(200)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11681109185441942, 'fraction_numerical': 0.012131715771230503, 'mean_word_length': 3.2629246676514034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3308342', 'n_tokens_mistral': 947, 'n_tokens_neox': 898, 'n_words': 186}