Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
j_platform / spec / helpers / base_helper_spec.rb
Size: Mime:
require 'spec_helper'

describe BaseHelper, type: :helper do
  before do
    @feeds_host = J_FEEDS_HOST.sub("http://", "")
    @visualizer_host = J_VISUALIZER_HOST.sub("http://", "")
  end

  describe "#is_dashboard?" do
    context "with URL as (just) J_FEEDS_HOST" do
      before do
        controller.request.host = @feeds_host
        controller.request.path = ""
      end

      it "returns true" do
        expect(helper.is_dashboard?).to eq(true)
      end
    end

    context "with URL as (J_FEEDS_HOST + '/')" do
      before do
        controller.request.host = @feeds_host
        controller.request.path = "/"
      end

      it "returns true" do
        expect(helper.is_dashboard?).to eq(true)
      end
    end

    context "with URL as J_FEEDS_HOST + query_params" do
      before do
        controller.request.host = @feeds_host
        controller.request.path = "/?project_id=1"
      end

      it "returns true" do
        expect(helper.is_dashboard?).to eq(true)
      end
    end

    context "with URL as (J_FEEDS_HOST + some other path)" do
      before do
        controller.request.host = @feeds_host
        controller.request.path = "/tasks?project_id=1"
      end

      it "returns false" do
        expect(helper.is_dashboard?).to eq(false)
      end
    end

    context "with URL as J_VISUALIZER_HOST" do
      before do
        controller.request.host = @visualizer_host
      end

      it "returns false" do
        expect(helper.is_dashboard?).to eq(false)
      end
    end
  end
end