<commit_before>require "spec_helper"

describe "spree/admin/orders/edit.html.haml" do
  include AuthenticationWorkflow
  helper Spree::BaseHelper # required to make pretty_time work

  around do |example|
    original_config = Spree::Config[:enable_invoices?]
    example.run
    Spree::Config[:enable_invoices?] = original_config
  end

  before do
    controller.singleton_class.class_eval do
      def current_ability
        Spree::Ability.new(Spree.user_class.new)
      end
    end

    allow(view).to receive_messages spree_current_user: create_enterprise_user

    order = create(:completed_order_with_fees)
    order.distributor = create(:distributor_enterprise)
    assign(:order, order)
    assign(:shops, [order.distributor])
    assign(:order_cycles, [])
  end

  describe "order values" do
    it "displays order shipping costs, transaction fee and order total" do
      render

      expect(rendered).to have_content("Shipping: UPS Ground $6.00")
      expect(rendered).to have_content("Transaction fee: $10.00")
      expect(rendered).to have_content("Order Total $36.00")
    end
  end
end<commit_msg>add view specs to admin edit page<commit_after>require "spec_helper"

describe "spree/admin/orders/edit.html.haml" do
  include AuthenticationWorkflow
  helper Spree::BaseHelper # required to make pretty_time work

  around do |example|
    original_config = Spree::Config[:enable_invoices?]
    example.run
    Spree::Config[:enable_invoices?] = original_config
  end

  before do
    controller.singleton_class.class_eval do
      def current_ability
        Spree::Ability.new(Spree.user_class.new)
      end
    end

    allow(view).to receive_messages spree_current_user: create_enterprise_user

    order = create(:completed_order_with_fees)
    order.distributor = create(:distributor_enterprise)
    assign(:order, order)
    assign(:shops, [order.distributor])
    assign(:order_cycles, [])
  end

  describe "order values" do
    it "displays order shipping costs, transaction fee and order total" do
      render

      expect(rendered).to have_content("Shipping: UPS Ground $6.00")
      expect(rendered).to have_content("Transaction fee: $10.00")
      expect(rendered).to have_content("Order Total $36.00")
    end
  end

  describe "actions dropwdown" do
    it "contains all the actions buttons" do
      render

      expect(rendered).to have_content("Resend Confirmation")
      expect(rendered).to have_content("Send Invoice")
      expect(rendered).to have_content("Print Invoices")
      expect(rendered).to have_content("Cancel Order")
    end
  end
end
{'fraction_non_alphanumeric': 0.09332819128422676, 'fraction_numerical': 0.008484381025838797, 'mean_word_length': 3.940952380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5708053', 'n_tokens_mistral': 820, 'n_tokens_neox': 769, 'n_words': 187}