First view spec in OFN testing the print invoice button display in the orders list page

This commit is contained in:
luisramos0
2019-06-19 15:03:36 +01:00
parent b3c378e8c1
commit 2a2d05ad39

View 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