Skip to content

Commit

Permalink
Merge pull request #17448 from matheuscmelo/remove_each
Browse files Browse the repository at this point in the history
removing :each from before and after
  • Loading branch information
jrafanie authored May 21, 2018
2 parents 428d092 + 07e926b commit 79305c7
Show file tree
Hide file tree
Showing 29 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion spec/models/assigned_server_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
end

context "Server Role" do
before (:each) do
before do
@server_role = FactoryGirl.create(
:server_role,
:name => "smartproxy",
Expand Down
4 changes: 2 additions & 2 deletions spec/models/dialog_field_sorted_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
let(:default_value) { "test2" }

context "when show_refresh_button is true" do
before(:each) do
before do
allow(dialog_field).to receive(:force_multi_value).and_return(false)
end
let(:show_refresh_button) { true }
Expand Down Expand Up @@ -195,7 +195,7 @@

context "when show_refresh_button is false" do
let(:show_refresh_button) { false }
before(:each) do
before do
allow(dialog_field).to receive(:force_multi_value).and_return(false)
end

Expand Down
8 changes: 4 additions & 4 deletions spec/models/ems_event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

context "with availability zones" do
let(:vm) { FactoryGirl.create(:vm_openstack, :ems_ref => "vm1") }
before :each do
before do
@zone = FactoryGirl.create(:small_environment)
@ems = @zone.ext_management_systems.first
@availability_zone = FactoryGirl.create(:availability_zone_openstack, :ems_ref => "az1")
Expand All @@ -78,7 +78,7 @@
context ".process_availability_zone_in_event!" do
let(:event_hash) { { :vm_or_template_id => vm.id } }
context "when the event has an availability zone" do
before :each do
before do
event_hash[:availability_zone_ems_ref] = @availability_zone.ems_ref
end

Expand All @@ -90,7 +90,7 @@

context "when the event has no availability zone" do
context "and the VM has an availability zone" do
before :each do
before do
vm.availability_zone_id = @availability_zone.id
vm.save
end
Expand Down Expand Up @@ -160,7 +160,7 @@
end

context ".add" do
before :each do
before do
@event_hash = {
:event_type => "event_with_availability_zone",
:target_type => vm.class.name,
Expand Down
2 changes: 1 addition & 1 deletion spec/models/manageiq/providers/cloud_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def tenant_from_cloud_tenant_by(vm)
FactoryGirl.create(:cloud_tenant_openstack, :ext_management_system => ems_cloud, :name => ct_name_3)
end

before(:each) do
before do
vm_1.cloud_tenant.update_attributes!(:parent => ct_3, :ext_management_system => ems_cloud, :name => ct_name_1)
vm_2.cloud_tenant.update_attributes!(:ext_management_system => ems_cloud, :name => ct_name_2)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/manager_refresh/persister/finders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Spec scenarios for asserts giving hints to developers
######################################################################################################################
#
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud,
:zone => @zone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Spec scenarios for making sure the local db index is able to build complex queries using references
######################################################################################################################
#
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud,
:zone => @zone,
Expand All @@ -22,7 +22,7 @@
allow(Settings.ems_refresh).to receive(:mock).and_return({})
end

before :each do
before do
initialize_mocked_records
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/manager_refresh/persister/serializing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Spec scenarios testing Persister can serialize/deserialize, with having complex nested lazy_find links
######################################################################################################################
#
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud,
:zone => @zone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
[{:inventory_object_saving_strategy => nil},
{:inventory_object_saving_strategy => :recursive},].each do |inventory_object_settings|
context "with settings #{inventory_object_settings}" do
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud, :zone => @zone)

Expand All @@ -77,7 +77,7 @@
end

context 'with empty DB' do
before :each do
before do
initialize_data_and_inventory_collections
end

Expand Down Expand Up @@ -586,7 +586,7 @@
end

context "lazy_find vs find" do
before :each do
before do
# Initialize the InventoryCollections
@data = {}
@data[:vms] = ::ManagerRefresh::InventoryCollection.new(
Expand Down Expand Up @@ -663,7 +663,7 @@
end

context "assert_referential_integrity" do
before :each do
before do
# Initialize the InventoryCollections
@data = {}
@data[:vms] = ::ManagerRefresh::InventoryCollection.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
[{:inventory_object_saving_strategy => nil},
{:inventory_object_saving_strategy => :recursive},].each do |inventory_object_settings|
context "with settings #{inventory_object_settings}" do
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud, :zone => @zone)
@ems_network = FactoryGirl.create(:ems_network, :zone => @zone, :parent_manager => @ems)
Expand All @@ -289,7 +289,7 @@
end

context 'with empty DB' do
before :each do
before do
initialize_inventory_collections
end

Expand Down Expand Up @@ -359,7 +359,7 @@
end

context 'with empty DB and reversed InventoryCollections' do
before :each do
before do
initialize_inventory_collections_reversed
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[{:inventory_object_saving_strategy => nil},
{:inventory_object_saving_strategy => :recursive}].each do |inventory_object_settings|
context "with settings #{inventory_object_settings}" do
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud, :zone => @zone)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{:saver_strategy => :batch, :use_ar_object => false},
].each do |options|
context "with options #{options}" do
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud,
:zone => @zone,
Expand All @@ -31,7 +31,7 @@
allow(Settings.ems_refresh).to receive(:mock).and_return(inventory_object_settings)
end

before :each do
before do
@image1 = FactoryGirl.create(:miq_template, image_data(1))
@image2 = FactoryGirl.create(:miq_template, image_data(2))
@image3 = FactoryGirl.create(:miq_template, image_data(3))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[{:inventory_object_saving_strategy => nil},
{:inventory_object_saving_strategy => :recursive},].each do |inventory_object_settings|
context "with settings #{inventory_object_settings}" do
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud, :zone => @zone)

Expand Down Expand Up @@ -99,14 +99,14 @@
end

context 'with existing Vms in the DB' do
before :each do
before do
# Fill DB with test Vms
@vm1 = FactoryGirl.create(:vm_cloud, vm_data(1).merge(:ext_management_system => @ems))
@vm2 = FactoryGirl.create(:vm_cloud, vm_data(2).merge(:ext_management_system => @ems))
end

context 'with VM InventoryCollection with default settings' do
before :each do
before do
# Initialize the InventoryCollections
@data = {}
@data[:vms] = ::ManagerRefresh::InventoryCollection.new(
Expand Down Expand Up @@ -237,7 +237,7 @@
end

context 'with VM InventoryCollection with :delete_method => :disconnect_inv' do
before :each do
before do
# Initialize the InventoryCollections
@data = {}
@data[:vms] = ::ManagerRefresh::InventoryCollection.new(
Expand Down Expand Up @@ -529,7 +529,7 @@
end

context 'with VM InventoryCollection with :complete => false' do
before :each do
before do
# Initialize the InventoryCollections
@data = {}
@data[:vms] = ::ManagerRefresh::InventoryCollection.new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
context "with settings #{inventory_object_settings}" do
[:local_db_find_references, :local_db_cache_all].each do |db_strategy|
context "with db strategy #{db_strategy}" do
before :each do
before do
@zone = FactoryGirl.create(:zone)
@ems = FactoryGirl.create(:ems_cloud,
:zone => @zone,
Expand All @@ -27,7 +27,7 @@
allow(Settings.ems_refresh).to receive(:mock).and_return(inventory_object_settings)
end

before :each do
before do
@image1 = FactoryGirl.create(:miq_template, image_data(1).merge(:ext_management_system => @ems))
@image2 = FactoryGirl.create(:miq_template, image_data(2).merge(:ext_management_system => @ems))
@image3 = FactoryGirl.create(:miq_template, image_data(3).merge(:ext_management_system => @ems))
Expand Down
2 changes: 1 addition & 1 deletion spec/models/metric/ci_mixin/capture_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def mock_adapter(postgre_adapter)

["miq_postgres", "miq_postgres_legacy"].each do |postgre_adapter|
context "with adapter #{postgre_adapter}" do
before :each do
before do
mock_adapter(postgre_adapter)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/metric_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
end

context "as vmware" do
before :each do
before do
@ems_vmware = FactoryGirl.create(:ems_vmware, :zone => @zone)
end

Expand Down Expand Up @@ -991,7 +991,7 @@
end

context "as openstack" do
before :each do
before do
@ems_openstack = FactoryGirl.create(:ems_openstack, :zone => @zone)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/miq_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
let(:num_cpu) { 2 }
let(:ems) { FactoryGirl.create(:ems_vmware, :name => "test_vcenter") }
let(:storage) { FactoryGirl.create(:storage, :name => "test_storage_nfs", :store_type => "NFS") }
before :each do
before do
@hw1 = FactoryGirl.create(:hardware, :cpu_total_cores => num_cpu, :memory_mb => ram_size)
@hw2 = FactoryGirl.create(:hardware, :cpu_total_cores => num_cpu, :memory_mb => ram_size)
@hw3 = FactoryGirl.create(:hardware, :cpu_total_cores => num_cpu, :memory_mb => ram_size)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/miq_region_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
end

context "with cloud and infra EMSes" do
before :each do
before do
_, _, zone = EvmSpecHelper.create_guid_miq_server_zone
ems_vmware = FactoryGirl.create(:ems_vmware, :zone => zone)
ems_openstack = FactoryGirl.create(:ems_openstack, :zone => zone)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/miq_report/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

describe "#generate" do
context "Memory Utilization Trends report (daily)" do
before :each do
before do
@miq_report_profile_all = FactoryGirl.create(
:miq_report,
:db => "VimPerformanceTrend",
Expand Down
4 changes: 2 additions & 2 deletions spec/models/miq_report_result_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe MiqReportResult do
before :each do
before do
EvmSpecHelper.local_miq_server

@user1 = FactoryGirl.create(:user_with_group)
Expand Down Expand Up @@ -28,7 +28,7 @@
end

context "report result created by User 1 with current group 1" do
before :each do
before do
@report_1 = FactoryGirl.create(:miq_report)
group_1 = FactoryGirl.create(:miq_group)
group_2 = FactoryGirl.create(:miq_group)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
let(:filters) { [["/managed/prov_max_memory/test"], ["/managed/my_name/test"]] }
let(:tag) { FactoryGirl.create(:tag, :name => "/managed/my_name/test") }

before :each do
before do
miq_group.entitlement.set_managed_filters(filters)
other_miq_group.entitlement.set_managed_filters(filters)
[miq_group, other_miq_group].each(&:save)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
end

context "Testing active VM aggregation" do
before :each do
before do
@ram_size = 1024
@disk_size = 1_000_000
@num_cpu = 2
Expand Down
2 changes: 1 addition & 1 deletion spec/models/vmdb_database_connection_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "concurrent/atomic/event"

describe VmdbDatabaseConnection do
before :each do
before do
@db = FactoryGirl.create(:vmdb_database)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/vmdb_database_setting_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe VmdbDatabaseSetting do
before :each do
before do
@db = FactoryGirl.create(:vmdb_database)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/vmdb_database_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe VmdbDatabase do
before :each do
before do
@db = FactoryGirl.create(:vmdb_database)
@table = FactoryGirl.create(:vmdb_table_evm, :vmdb_database => @db, :name => 'accounts')
@text = FactoryGirl.create(:vmdb_table_text, :vmdb_database => @db, :name => 'accounts', :parent_id => @table.id)
Expand Down Expand Up @@ -85,7 +85,7 @@
end

context "#top_tables_by" do
before :each do
before do
@table_1 = FactoryGirl.create(:vmdb_table_evm, :vmdb_database => @db, :name => 'accounts1')
@table_2 = FactoryGirl.create(:vmdb_table_evm, :vmdb_database => @db, :name => 'accounts2')
@table_3 = FactoryGirl.create(:vmdb_table_evm, :vmdb_database => @db, :name => 'accounts3')
Expand Down
2 changes: 1 addition & 1 deletion spec/models/vmdb_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
end

context "#rollup_metrics" do
before :each do
before do
db = VmdbDatabase.seed_self
@evm_table = FactoryGirl.create(:vmdb_table_evm, :vmdb_database => db, :name => 'accounts')
@evm_index = FactoryGirl.create(:vmdb_index, :vmdb_table => @evm_table, :name => "accounts_pkey")
Expand Down
2 changes: 1 addition & 1 deletion spec/models/vmdb_table_evm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
end

context "#rollup_metrics" do
before :each do
before do
db = VmdbDatabase.seed_self
@evm_table = FactoryGirl.create(:vmdb_table_evm, :vmdb_database => db, :name => 'accounts')

Expand Down
Loading

0 comments on commit 79305c7

Please sign in to comment.