about summary refs log tree commit diff
path: root/spec/helpers
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-04-09 11:11:37 -0400
committerEugen <eugen@zeonfederated.com>2017-04-09 17:11:37 +0200
commitea6c930c04762bef00b42dad16a17b71b8acc93b (patch)
tree3760237e43060ee0ffe0362570266d95021cc910 /spec/helpers
parent12e29c9660df3ce85f46715bb62a4a15ce38f6a5 (diff)
Helper cleanup (#1348)
* Remove unused helper files

* Add coverage for application helper

* Add coverage for StreamEntriesHelper #display_name
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/about_helper_spec.rb5
-rw-r--r--spec/helpers/admin/domain_blocks_helper_spec.rb5
-rw-r--r--spec/helpers/admin/pubsubhubbub_helper_spec.rb5
-rw-r--r--spec/helpers/application_helper_spec.rb16
-rw-r--r--spec/helpers/authorize_follow_helper_spec.rb5
-rw-r--r--spec/helpers/stream_entries_helper_spec.rb12
-rw-r--r--spec/helpers/tags_helper_spec.rb5
-rw-r--r--spec/helpers/xrd_helper_spec.rb5
8 files changed, 26 insertions, 32 deletions
diff --git a/spec/helpers/about_helper_spec.rb b/spec/helpers/about_helper_spec.rb
deleted file mode 100644
index 6efc9f5bd..000000000
--- a/spec/helpers/about_helper_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe AboutHelper, type: :helper do
-
-end
diff --git a/spec/helpers/admin/domain_blocks_helper_spec.rb b/spec/helpers/admin/domain_blocks_helper_spec.rb
deleted file mode 100644
index cc7ead84e..000000000
--- a/spec/helpers/admin/domain_blocks_helper_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Admin::DomainBlocksHelper, type: :helper do
-
-end
diff --git a/spec/helpers/admin/pubsubhubbub_helper_spec.rb b/spec/helpers/admin/pubsubhubbub_helper_spec.rb
deleted file mode 100644
index 673236a7e..000000000
--- a/spec/helpers/admin/pubsubhubbub_helper_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Admin::PubsubhubbubHelper, type: :helper do
-
-end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index c2063c995..a2eeb443c 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -1,5 +1,19 @@
 require 'rails_helper'
 
-RSpec.describe ApplicationHelper, type: :helper do
+describe ApplicationHelper do
+  describe 'active_nav_class' do
+    it 'returns active when on the current page' do
+      allow(helper).to receive(:current_page?).and_return(true)
 
+      result = helper.active_nav_class("/test")
+      expect(result).to eq "active"
+    end
+
+    it 'returns empty string when not on current page' do
+      allow(helper).to receive(:current_page?).and_return(false)
+
+      result = helper.active_nav_class("/test")
+      expect(result).to eq ""
+    end
+  end
 end
diff --git a/spec/helpers/authorize_follow_helper_spec.rb b/spec/helpers/authorize_follow_helper_spec.rb
deleted file mode 100644
index ba5b0a70b..000000000
--- a/spec/helpers/authorize_follow_helper_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe AuthorizeFollowHelper, type: :helper do
-
-end
diff --git a/spec/helpers/stream_entries_helper_spec.rb b/spec/helpers/stream_entries_helper_spec.rb
index 6227f9280..221e1e32d 100644
--- a/spec/helpers/stream_entries_helper_spec.rb
+++ b/spec/helpers/stream_entries_helper_spec.rb
@@ -2,7 +2,17 @@ require 'rails_helper'
 
 RSpec.describe StreamEntriesHelper, type: :helper do
   describe '#display_name' do
-    pending
+    it 'uses the display name when it exists' do
+      account = Account.new(display_name: "Display", username: "Username")
+
+      expect(helper.display_name(account)).to eq "Display"
+    end
+
+    it 'uses the username when display name is nil' do
+      account = Account.new(display_name: nil, username: "Username")
+
+      expect(helper.display_name(account)).to eq "Username"
+    end
   end
 
   describe '#avatar_for_status_url' do
diff --git a/spec/helpers/tags_helper_spec.rb b/spec/helpers/tags_helper_spec.rb
deleted file mode 100644
index f661e44ac..000000000
--- a/spec/helpers/tags_helper_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe TagsHelper, type: :helper do
-
-end
diff --git a/spec/helpers/xrd_helper_spec.rb b/spec/helpers/xrd_helper_spec.rb
deleted file mode 100644
index 0bc71b657..000000000
--- a/spec/helpers/xrd_helper_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe XrdHelper, type: :helper do
-
-end