Permalink
Browse files

Added new sku model specs for the in_stock and complete scopes.

  • Loading branch information...
1 parent ae12285 commit b0abe369f58fbab5db02efeaa61860dc6e525d3b @Jellyfishboy committed Jan 9, 2017
Showing with 20 additions and 0 deletions.
  1. +20 −0 spec/models/sku_spec.rb
@@ -223,4 +223,24 @@
end
end
end
+
+ describe "Scoping only in stock Skus" do
+ let!(:sku_1) { create(:sku, stock: 0, duplicate: true) }
+ let!(:sku_2) { create(:sku) }
+ let!(:sku_3) { create(:sku) }
+
+ it "should only list Skus which are in stock" do
+ expect(Sku.in_stock).to match_array([sku_2, sku_3])
+ end
+ end
+
+ describe "Scoping only complete Skus" do
+ let!(:sku_1) { create(:sku) }
+ let!(:sku_2) { create(:sku) }
+ let!(:sku_3) { create(:sku, stock: nil, duplicate: true) }
+
+ it "should only list Skus which are in stock" do
+ expect(Sku.complete).to match_array([sku_1, sku_2])
+ end
+ end
end

0 comments on commit b0abe36

Please sign in to comment.