require "spec_helper"

describe ActsAsTenant::TenantHelper, type: :helper do
  describe "#current_tenant" do
    it "returns nil if no tenant set" do
      expect(helper.current_tenant).to be_nil
    end

    it "returns nil if no tenant set" do
      ActsAsTenant.current_tenant = accounts(:foo)
      expect(helper.current_tenant).to eq(accounts(:foo))
    end
  end
end

require "spec_helper"

describe ActionView::Base, type: :helper do
  it "responds ot current_tenant" do
    expect(helper).to respond_to(:current_tenant)
  end

  it "returns nil if no tenant set" do
    expect(helper.current_tenant).to be_nil
  end

  it "returns the current tenant" do
    ActsAsTenant.current_tenant = accounts(:foo)
    expect(helper.current_tenant).to eq(accounts(:foo))
  end
end

Refactor view helper spec to test against ActionView::Base
Refactor view helper spec to test against ActionView::Base
