summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-12-27 19:58:44 -0500
committerRobert Speicher <rspeicher@gmail.com>2015-12-27 19:58:44 -0500
commitdcca64a5230bbfd53ef5db8403d132deac4667f2 (patch)
tree3715ce2d4ab3c4473d586668e390a4bfd538b004 /spec/helpers
parenta7756a4b51b0127caa19d1fb20953cb27c4c62a8 (diff)
downloadgitlab-ce-dcca64a5230bbfd53ef5db8403d132deac4667f2.tar.gz
Use `assign` instead of `instance_variable_set`
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/page_layout_helper_spec.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb
index 60c4eb21814..300dccf50ec 100644
--- a/spec/helpers/page_layout_helper_spec.rb
+++ b/spec/helpers/page_layout_helper_spec.rb
@@ -45,14 +45,14 @@ describe PageLayoutHelper do
describe 'page_description_default' do
it 'uses Project description when available' do
project = double(description: 'Project Description')
- helper.instance_variable_set(:@project, project)
+ assign(:project, project)
expect(helper.page_description_default).to eq 'Project Description'
end
it 'uses brand_title when Project description is nil' do
project = double(description: nil)
- helper.instance_variable_set(:@project, project)
+ assign(:project, project)
expect(helper).to receive(:brand_title).and_return('Brand Title')
expect(helper.page_description_default).to eq 'Brand Title'
@@ -73,14 +73,14 @@ describe PageLayoutHelper do
context 'with @project' do
it 'uses Project avatar if available' do
project = double(avatar_url: 'http://example.com/uploads/avatar.png')
- helper.instance_variable_set(:@project, project)
+ assign(:project, project)
expect(helper.page_image).to eq project.avatar_url
end
it 'falls back to the default' do
project = double(avatar_url: nil)
- helper.instance_variable_set(:@project, project)
+ assign(:project, project)
expect(helper.page_image).to end_with 'assets/gitlab_logo.png'
end
@@ -89,7 +89,7 @@ describe PageLayoutHelper do
context 'with @user' do
it 'delegates to avatar_icon helper' do
user = double('User')
- helper.instance_variable_set(:@user, user)
+ assign(:user, user)
expect(helper).to receive(:avatar_icon).with(user)
@@ -100,14 +100,14 @@ describe PageLayoutHelper do
context 'with @group' do
it 'uses Group avatar if available' do
group = double(avatar_url: 'http://example.com/uploads/avatar.png')
- helper.instance_variable_set(:@group, group)
+ assign(:group, group)
expect(helper.page_image).to eq group.avatar_url
end
it 'falls back to the default' do
group = double(avatar_url: nil)
- helper.instance_variable_set(:@group, group)
+ assign(:group, group)
expect(helper.page_image).to end_with 'assets/gitlab_logo.png'
end