RSpec3-ize controller spec

This commit is contained in:
Pau Perez
2018-11-26 12:27:30 +01:00
parent b9dfaea274
commit 5a85d7a77b

View File

@@ -2,16 +2,17 @@ require 'spec_helper'
describe ShopsController, type: :controller do
render_views
let!(:distributor) { create(:distributor_enterprise) }
let!(:invisible_distributor) { create(:distributor_enterprise, visible: false) }
before do
Enterprise.stub_chain("distributors_with_active_order_cycles.ready_for_checkout") { [distributor] }
allow(Enterprise).to receive_message_chain(:distributors_with_active_order_cycles, :ready_for_checkout) { [distributor] }
end
# Exclusion from actual rendered view handled in features/consumer/home
it "shows JSON for invisible hubs" do
get :index
response.body.should have_content invisible_distributor.name
expect(response.body).to have_content(invisible_distributor.name)
end
end