Sha256: 4a552f13db12d055164c819b2929b60ba9b7689188f9a57baff45784b6dccc81

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Conekta::LineItem do
  include_context "API 2.0.0"

  let(:line_items) do
    [{
       name: "Box of Cohiba S1s",
       description: "Imported From Mex.",
       unit_price: 35000,
       quantity: 1,
       tags: ["food", "mexican food"]
     },
     {
       name: "Other item",
       description: "other description",
       unit_price: 35000,
       quantity: 1,
       tags: ["food"]
     }]
  end
  let(:order_data) do
    {
      currency:   'mxn',
      line_items: line_items
    }
  end
  let(:order)     { Conekta::Order.create(order_data) }
  let(:line_item) { order.line_items.first }

  context "deleting line items" do
    it "successful line item delete" do
      line_item.delete

      expect(line_item.deleted).to eq(true)
    end
  end

  context "updating line items" do
    it "successful line item update" do
      line_item.update(unit_price: 1000)

      expect(line_item.unit_price).to eq(1000)
    end

    it "unsuccessful line item update" do
      expect {
        line_item.update(description: nil)
      }.to raise_error(Conekta::ErrorList)
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
conekta-2.0.0 spec/conekta/2.0.0/line_item_spec.rb
conekta-1.1.3 spec/conekta/2.0.0/line_item_spec.rb
conekta-1.1.2 spec/conekta/2.0.0/line_item_spec.rb
conekta-1.1.1 spec/conekta/2.0.0/line_item_spec.rb
conekta-1.1.0 spec/conekta/2.0.0/line_item_spec.rb