<commit_before>describe GenericObjectDefinitionController do
  include CompressedIds

  let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
  let(:zone) { FactoryGirl.build(:zone) }

  describe "#show" do
    render_views
    before(:each) do
      EvmSpecHelper.create_guid_miq_server_zone
      login_as FactoryGirl.create(:user)
    end

    it "should redirect to #show_list" do
      generic_obj_defn = FactoryGirl.create(:generic_object_definition)
      get :show, :params => {:id => generic_obj_defn.id}
      expect(response.status).to eq(302)
      expect(response).to redirect_to(:action => 'show_list')
      expect(controller.x_node).to eq("god-#{to_cid(generic_obj_defn.id)}")
    end
  end

  describe "#show_list" do
    before(:each) do
      stub_user(:features => :all)
      FactoryGirl.create(:generic_object_definition)
      allow(controller).to receive(:build_tree)
      allow(controller).to receive(:exp_build_table)<commit_msg>spec that demonstrates the bug in the `show` method when display=main<commit_after>describe GenericObjectDefinitionController do
  include CompressedIds

  let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
  let(:zone) { FactoryGirl.build(:zone) }

  describe "#show" do
    render_views
    before(:each) do
      EvmSpecHelper.create_guid_miq_server_zone
      login_as FactoryGirl.create(:user)
    end

    it "should redirect to #show_list" do
      generic_obj_defn = FactoryGirl.create(:generic_object_definition)
      get :show, :params => {:id => generic_obj_defn.id}
      expect(response.status).to eq(302)
      expect(response).to redirect_to(:action => 'show_list')
      expect(controller.x_node).to eq("god-#{to_cid(generic_obj_defn.id)}")
    end

    context "#show when display=main" do
      before do
        allow_any_instance_of(GenericObjectDefinition).to receive(:generic_objects)
      end
      it "show the generic_object_definition record when display=main" do
        generic_obj_defn = FactoryGirl.create(:generic_object_definition)
        get :show, :params => {:id => generic_obj_defn.id, :display => "main"}
        expect(response.status).to eq(200)
      end
    end
  end

  describe "#show_list" do
    before(:each) do
      stub_user(:features => :all)
      FactoryGirl.create(:generic_object_definition)
      allow(controller).to receive(:build_tree)
      allow(controller).to receive(:exp_build_table)
{'fraction_non_alphanumeric': 0.11120263591433278, 'fraction_numerical': 0.0037067545304777594, 'mean_word_length': 3.9979423868312756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '13978', 'n_tokens_mistral': 768, 'n_tokens_neox': 742, 'n_words': 148}