From 2ac95eb8075505dd676d440892b7c0ad7d45748b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= Date: Tue, 13 Dec 2016 11:46:35 +0100 Subject: [PATCH] Extract user instance var to let(:user) clause --- spec/models/chargeback_vm_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/models/chargeback_vm_spec.rb b/spec/models/chargeback_vm_spec.rb index 1c6ce8baa7c..c98fed65ccb 100644 --- a/spec/models/chargeback_vm_spec.rb +++ b/spec/models/chargeback_vm_spec.rb @@ -761,23 +761,23 @@ def used_average_for(metric, hours_in_interval) end context "by owner" do + let(:user) { FactoryGirl.create(:user, :name => 'Test VM Owner', :userid => 'test_user') } before do - @user = FactoryGirl.create(:user, :name => 'Test VM Owner', :userid => 'test_user') - @vm1.update_attribute(:evm_owner, @user) + @vm1.update_attribute(:evm_owner, user) @options = {:interval_size => 4, - :owner => @user.userid, + :owner => user.userid, :ext_options => {:tz => "Eastern Time (US & Canada)"}, } end it "valid" do - expect(subject.owner_name).to eq(@user.name) + expect(subject.owner_name).to eq(user.name) end it "not exist" do - @user.delete - expect { subject }.to raise_error(MiqException::Error, "Unable to find user '#{@user.userid}'") + user.delete + expect { subject }.to raise_error(MiqException::Error, "Unable to find user '#{user.userid}'") end end end