Adjust specs

This commit is contained in:
Matt-Yorkley
2019-07-25 10:17:22 +01:00
parent 7dccb5ba90
commit 4a0df684c7
4 changed files with 8 additions and 36 deletions

View File

@@ -437,6 +437,7 @@ feature '
visit spree.admin_products_path
select2_select s1.name, from: "producer_filter"
apply_filters
expect(page).to have_no_field "product_name", with: p2.name
fill_in "product_name", with: "new product1"
@@ -609,6 +610,7 @@ feature '
# Set a filter
select2_select s1.name, from: "producer_filter"
apply_filters
# Products are hidden when filtered out
expect(page).to have_field "product_name", with: p1.name
@@ -616,6 +618,7 @@ feature '
# Clearing filters
click_button "Clear Filters"
apply_filters
# All products are shown again
expect(page).to have_field "product_name", with: p1.name
@@ -789,4 +792,8 @@ feature '
expect(page).to have_selector "div.reveal-modal"
end
end
def apply_filters
page.find('.button.icon-search').click
end
end

View File

@@ -170,6 +170,7 @@ feature "Product Import", js: true do
expect(page).to have_selector 'div#s2id_import_date_filter'
import_time = carrots.import_date.to_date.to_formatted_s(:long)
select2_select import_time, from: "import_date_filter"
page.find('.button.icon-search').click
expect(page).to have_field "product_name", with: carrots.name
expect(page).to have_field "product_name", with: potatoes.name

View File

@@ -299,13 +299,6 @@ describe "AdminProductEditCtrl", ->
$scope.$digest()
expect($scope.resetProducts).toHaveBeenCalled()
it "sets the loading property to true before fetching products and unsets it when loading is complete", ->
$scope.fetchProducts()
expect($scope.loading).toEqual true
$scope.$digest()
expect($scope.loading).toEqual false
describe "resetting products", ->
beforeEach ->
spyOn DirtyProducts, "clear"

View File

@@ -8,35 +8,6 @@ describe "BulkProducts service", ->
BulkProducts = _BulkProducts_
$httpBackend = _$httpBackend_
describe "fetching products", ->
beforeEach ->
spyOn BulkProducts, 'addProducts'
it "makes a standard call to dataFetcher when no filters exist", ->
$httpBackend.expectGET("/api/products/bulk_products?page=1;per_page=20;").respond "list of products"
BulkProducts.fetch [], ->
$httpBackend.flush()
it "makes more calls to dataFetcher if more pages exist", ->
$httpBackend.expectGET("/api/products/bulk_products?page=1;per_page=20;").respond { products: [], pages: 2 }
$httpBackend.expectGET("/api/products/bulk_products?page=2;per_page=20;").respond { products: ["list of products"] }
BulkProducts.fetch [], ->
$httpBackend.flush()
it "applies filters when they are supplied", ->
filter =
property:
name: "Name"
db_column: "name"
predicate:
name: "Equals"
predicate: "eq"
value: "Product1"
$httpBackend.expectGET("/api/products/bulk_products?page=1;per_page=20;q[name_eq]=Product1;").respond "list of products"
BulkProducts.fetch [filter], ->
$httpBackend.flush()
describe "cloning products", ->
it "clones products using a http post request to /api/products/(id)/clone", ->
BulkProducts.products = [