summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorskv <skv-headless@yandex.ru>2013-12-14 17:43:48 +0400
committerskv <skv-headless@yandex.ru>2013-12-15 00:05:10 +0400
commitd89527839ea0dd1734dacb71c3ed2a97f1ff74d7 (patch)
tree3fe4c3f961cefb0c06e956bb7906bbc943c90703 /spec/helpers
parentee53b73986ba4c9dd2f0c726a44718acb8febaf8 (diff)
downloadgitlab-ce-d89527839ea0dd1734dacb71c3ed2a97f1ff74d7.tar.gz
fix most of warnings
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/application_helper_spec.rb22
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb4
-rw-r--r--spec/helpers/notifications_helper_spec.rb2
-rw-r--r--spec/helpers/search_helper_spec.rb6
-rw-r--r--spec/helpers/tab_helper_spec.rb4
5 files changed, 20 insertions, 18 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index d63a2de8806..21c3e15f57b 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe ApplicationHelper do
describe 'current_controller?' do
before do
- controller.stub!(:controller_name).and_return('foo')
+ controller.stub(:controller_name).and_return('foo')
end
it "returns true when controller matches argument" do
@@ -22,7 +22,7 @@ describe ApplicationHelper do
describe 'current_action?' do
before do
- stub!(:action_name).and_return('foo')
+ allow(self).to receive(:action_name).and_return('foo')
end
it "returns true when action matches argument" do
@@ -52,7 +52,7 @@ describe ApplicationHelper do
it "should call gravatar_icon when no avatar is present" do
user = create(:user)
user.save!
- stub!(:gravatar_icon).and_return('gravatar_method_called')
+ allow(self).to receive(:gravatar_icon).and_return('gravatar_method_called')
avatar_icon(user.email).to_s.should == "gravatar_method_called"
end
end
@@ -70,33 +70,33 @@ describe ApplicationHelper do
end
it "should return default gravatar url" do
- stub!(:request).and_return(double(:ssl? => false))
+ allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email).should match('http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118')
end
it "should use SSL when appropriate" do
- stub!(:request).and_return(double(:ssl? => true))
+ allow(self).to receive(:request).and_return(double(:ssl? => true))
gravatar_icon(user_email).should match('https://secure.gravatar.com')
end
it "should return custom gravatar path when gravatar_url is set" do
- stub!(:request).and_return(double(:ssl? => false))
+ allow(self).to receive(:request).and_return(double(:ssl? => false))
Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}')
gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
end
it "should accept a custom size" do
- stub!(:request).and_return(double(:ssl? => false))
+ allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email, 64).should match(/\?s=64/)
end
it "should use default size when size is wrong" do
- stub!(:request).and_return(double(:ssl? => false))
+ allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email, nil).should match(/\?s=40/)
end
it "should be case insensitive" do
- stub!(:request).and_return(double(:ssl? => false))
+ allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email).should == gravatar_icon(user_email.upcase + " ")
end
@@ -105,7 +105,7 @@ describe ApplicationHelper do
describe "user_color_scheme_class" do
context "with current_user is nil" do
it "should return a string" do
- stub!(:current_user).and_return(nil)
+ allow(self).to receive(:current_user).and_return(nil)
user_color_scheme_class.should be_kind_of(String)
end
end
@@ -115,7 +115,7 @@ describe ApplicationHelper do
context "with color_scheme_id == #{color_scheme_id}" do
it "should return a string" do
current_user = double(:color_scheme_id => color_scheme_id)
- stub!(:current_user).and_return(current_user)
+ allow(self).to receive(:current_user).and_return(current_user)
user_color_scheme_class.should be_kind_of(String)
end
end
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb
index 0c25fa66ece..33e69d4326c 100644
--- a/spec/helpers/gitlab_markdown_helper_spec.rb
+++ b/spec/helpers/gitlab_markdown_helper_spec.rb
@@ -435,7 +435,7 @@ describe GitlabMarkdownHelper do
describe "#render_wiki_content" do
before do
- @wiki = stub('WikiPage')
+ @wiki = double('WikiPage')
@wiki.stub(:content).and_return('wiki content')
end
@@ -449,7 +449,7 @@ describe GitlabMarkdownHelper do
it "should use the Gollum renderer for all other file types" do
@wiki.stub(:format).and_return(:rdoc)
- formatted_content_stub = stub('formatted_content')
+ formatted_content_stub = double('formatted_content')
formatted_content_stub.should_receive(:html_safe)
@wiki.stub(:formatted_content).and_return(formatted_content_stub)
diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb
index 328f66237c3..c1efc1fb2a0 100644
--- a/spec/helpers/notifications_helper_spec.rb
+++ b/spec/helpers/notifications_helper_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe NotificationsHelper do
describe 'notification_icon' do
- let(:notification) { stub(disabled?: false, participating?: false, watch?: false) }
+ let(:notification) { double(disabled?: false, participating?: false, watch?: false) }
context "disabled notification" do
before { notification.stub(disabled?: true) }
diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb
index 55b6b6b4dad..33ecb980202 100644
--- a/spec/helpers/search_helper_spec.rb
+++ b/spec/helpers/search_helper_spec.rb
@@ -8,7 +8,9 @@ describe SearchHelper do
describe 'search_autocomplete_source' do
context "with no current user" do
- before { stub!(:current_user).and_return(nil) }
+ before do
+ allow(self).to receive(:current_user).and_return(nil)
+ end
it "it returns nil" do
search_autocomplete_source.should be_nil
@@ -20,7 +22,7 @@ describe SearchHelper do
let(:result) { JSON.parse(search_autocomplete_source) }
before do
- stub!(:current_user).and_return(user)
+ allow(self).to receive(:current_user).and_return(user)
end
it "includes Help sections" do
diff --git a/spec/helpers/tab_helper_spec.rb b/spec/helpers/tab_helper_spec.rb
index ef8e4cf6375..fa8a3f554f7 100644
--- a/spec/helpers/tab_helper_spec.rb
+++ b/spec/helpers/tab_helper_spec.rb
@@ -5,8 +5,8 @@ describe TabHelper do
describe 'nav_link' do
before do
- controller.stub!(:controller_name).and_return('foo')
- stub!(:action_name).and_return('foo')
+ controller.stub(:controller_name).and_return('foo')
+ allow(self).to receive(:action_name).and_return('foo')
end
it "captures block output" do