Split dashboard into single and multiple enterprise views

This commit is contained in:
Rob Harrington
2014-10-22 12:16:28 +11:00
parent b75af8d9ff
commit 8bf472e970
6 changed files with 83 additions and 24 deletions

View File

@@ -0,0 +1,31 @@
require 'spec_helper'
describe Spree::Admin::OverviewController do
include AuthenticationWorkflow
context "loading overview" do
let(:user) { create_enterprise_user(enterprise_limit: 2) }
before do
controller.stub spree_current_user: user
end
context "when user own only one enterprise" do
let!(:enterprise) { create(:distributor_enterprise, owner: user) }
it "renders the single enterprise dashboard" do
spree_get :index
response.should render_template partial: "_single_enterprise_dashboard"
end
end
context "when user owns multiple enterprises" do
let!(:enterprise1) { create(:distributor_enterprise, owner: user) }
let!(:enterprise2) { create(:distributor_enterprise, owner: user) }
it "renders the multi enterprise dashboard" do
spree_get :index
response.should render_template partial: "_multi_enterprise_dashboard"
end
end
end
end