mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
43 lines
1.2 KiB
Ruby
43 lines
1.2 KiB
Ruby
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 "single_enterprise_dashboard"
|
|
end
|
|
|
|
context "when the enterprise sells property has not been set" do
|
|
before do
|
|
enterprise.sells = "unspecified"
|
|
enterprise.save
|
|
end
|
|
|
|
it "renders the welcome page" do
|
|
spree_get :index
|
|
response.should render_template "welcome"
|
|
end
|
|
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 "multi_enterprise_dashboard"
|
|
end
|
|
end
|
|
end
|
|
end |