Skip to content

Commit

Permalink
Extract user instance var to let(:user) clause
Browse files Browse the repository at this point in the history
  • Loading branch information
isimluk committed Dec 13, 2016
1 parent e9b9e30 commit 2ac95eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/models/chargeback_vm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ac95eb

Please sign in to comment.