Sha256: 7b77dd7b7acfa129cd7f9265b8f4773f15e43a7d40dfe7dc7df828f67c5ce68a

Contents?: true

Size: 1.92 KB

Versions: 8

Compression:

Stored size: 1.92 KB

Contents

require 'spec_helper'

describe DashboardHelper, :type => :helper do
  
  describe "#render_recent_activity" do
    context "when there is no activity" do
      it "should return a messages stating the user has no recent activity" do
        assign(:activity, [])
        expect(helper.render_recent_activity).to include("no recent activity")
      end
    end
  end

  describe "#render_recent_notifications" do
    context "when there are no notifications" do
      it "should return a messages stating the user has no recent notifications" do
        assign(:notifications, [])
        expect(helper.render_recent_notifications).to include("no notifications")
      end
    end
  end

  describe "#on_the_dashboard?" do
    it "should return false for controllers that aren't a part of the dashboard" do
      allow(helper).to receive(:params).and_return({ controller: "foo" })
      expect(helper).to_not be_on_the_dashboard
    end

    it "should return true for controllers that are part of the dashboard" do
      allow(helper).to receive(:params).and_return({ controller: "my/files" })
      expect(helper).to be_on_the_dashboard
      allow(helper).to receive(:params).and_return({ controller: "my/collections" })
      expect(helper).to be_on_the_dashboard
      allow(helper).to receive(:params).and_return({ controller: "my/highlights" })
      expect(helper).to be_on_the_dashboard
      allow(helper).to receive(:params).and_return({ controller: "my/shares" })
      expect(helper).to be_on_the_dashboard
    end
  end

  describe "#on_my_files" do
    it "should return false when the controller isn't my files" do
      allow(helper).to receive(:params).and_return({ controller: "my/collections" })
      expect(helper).to_not be_on_my_files
    end
    it "should return true when the controller is my files" do
      allow(helper).to receive(:params).and_return({ controller: "my/files" })
      expect(helper).to be_on_my_files
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-5.0.0 spec/helpers/dashboard_helper_spec.rb
sufia-5.0.0.rc1 spec/helpers/dashboard_helper_spec.rb
sufia-6.0.0.rc2 spec/helpers/dashboard_helper_spec.rb
sufia-6.0.0.rc1 spec/helpers/dashboard_helper_spec.rb
sufia-4.3.1 spec/helpers/dashboard_helper_spec.rb
sufia-6.0.0.beta1 spec/helpers/dashboard_helper_spec.rb
sufia-4.2.0 spec/helpers/dashboard_helper_spec.rb
sufia-4.1.0 spec/helpers/dashboard_helper_spec.rb