mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
First view spec in OFN testing the print invoice button display in the orders list page
This commit is contained in:
33
spec/views/spree/admin/orders/index.html.haml_spec.rb
Normal file
33
spec/views/spree/admin/orders/index.html.haml_spec.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "spree/admin/orders/index.html.haml" do
|
||||
include AuthenticationWorkflow
|
||||
|
||||
around do |example|
|
||||
original_config = Spree::Config[:enable_invoices?]
|
||||
example.run
|
||||
Spree::Config[:enable_invoices?] = original_config
|
||||
end
|
||||
|
||||
before do
|
||||
allow(view).to receive_messages spree_current_user: create_enterprise_user
|
||||
end
|
||||
|
||||
describe "print invoices button" do
|
||||
it "displays button when invoices are enabled" do
|
||||
Spree::Config[:enable_invoices?] = true
|
||||
|
||||
render
|
||||
|
||||
expect(rendered).to have_content("Print Invoices")
|
||||
end
|
||||
|
||||
it "does not display button when invoices are disabled" do
|
||||
Spree::Config[:enable_invoices?] = false
|
||||
|
||||
render
|
||||
|
||||
expect(rendered).to_not have_content("Print Invoices")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user