<commit_before>require "spec_helper"

describe Rbac do
  context "tenant scoping" do
    before do
      MiqRegion.seed
      User.stub(:server_timezone => "UTC")
      default_tenant = Tenant.seed

      @owner_tenant  = FactoryGirl.create(:tenant, :divisible => false, :parent => default_tenant)
      @owner_group   = FactoryGirl.create(:miq_group, :tenant => @owner_tenant)
      @owner_user    = FactoryGirl.create(:user, :userid => 'foo', :miq_groups => [@owner_group])

      @other_tenant  = FactoryGirl.create(:tenant, :divisible => false, :parent => default_tenant)
      @other_group   = FactoryGirl.create(:miq_group, :tenant => @other_tenant)
      @other_user    = FactoryGirl.create(:user, :userid => 'bar', :miq_groups => [@other_group])
    end

    klass_factory_names = [
      "ExtManagementSystem", :ems_vmware,
      "MiqAeNamespace", :miq_ae_namespace,
      "MiqAeDomain", :miq_ae_domain,
      #"MiqRequest", :miq_request,  # MiqRequest is an abstract class that can't be instantiated currently<commit_msg>Use EvmSpecHelper.create_root_tenant to simplify things.<commit_after>require "spec_helper"

describe Rbac do
  context "tenant scoping" do
    before do
      default_tenant = EvmSpecHelper.create_root_tenant
      User.stub(:server_timezone => "UTC")

      @owner_tenant  = FactoryGirl.create(:tenant, :divisible => false, :parent => default_tenant)
      @owner_group   = FactoryGirl.create(:miq_group, :tenant => @owner_tenant)
      @owner_user    = FactoryGirl.create(:user, :userid => 'foo', :miq_groups => [@owner_group])

      @other_tenant  = FactoryGirl.create(:tenant, :divisible => false, :parent => default_tenant)
      @other_group   = FactoryGirl.create(:miq_group, :tenant => @other_tenant)
      @other_user    = FactoryGirl.create(:user, :userid => 'bar', :miq_groups => [@other_group])
    end

    klass_factory_names = [
      "ExtManagementSystem", :ems_vmware,
      "MiqAeNamespace", :miq_ae_namespace,
      "MiqAeDomain", :miq_ae_domain,
      #"MiqRequest", :miq_request,  # MiqRequest is an abstract class that can't be instantiated currently
{'fraction_non_alphanumeric': 0.12494061757719715, 'fraction_numerical': 0.0, 'mean_word_length': 4.124087591240876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '6240793', 'n_tokens_mistral': 698, 'n_tokens_neox': 698, 'n_words': 138}