Created
March 16, 2018 17:49
-
-
Save cored/c0d82ac67032e21aabd37f2eb170cffb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rails_helper" | |
describe WarehouseShowPresenter do | |
subject(:presenter) { described_class.new(warehouse) } | |
let(:warehouse) { create(:warehouse) } | |
let(:product) do | |
create(:product, id: 1, | |
variation_count: 2, | |
category: 1, | |
name: "Product Number 1", sku: "SKU1") | |
end | |
let(:variations) { product.variations } | |
describe "#inventory_info_by_variation" do | |
it "returns something" do | |
create_list(:inventory_item, | |
4, | |
variation: product.variations.first, location: warehouse) | |
expect( | |
presenter.inventory_info_by_variation(variations) | |
).to match_array([ | |
[ | |
["mattress", "Product Number 1", "SKU1", 4, 4, 0, 0, 0], | |
[ | |
["mattress", "SKU1", "VAR-1", 0, 0, 0, "-", "-"], | |
["mattress", "SKU1", "VAR-2", 0, 0, 0, "-", "-"], | |
], | |
] | |
]) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment