Skip to content

Instantly share code, notes, and snippets.

@werkshy
Created April 7, 2017 16:28
Show Gist options
  • Save werkshy/bb2424f97c49b3f3c6139739ec3ea867 to your computer and use it in GitHub Desktop.
Save werkshy/bb2424f97c49b3f3c6139739ec3ea867 to your computer and use it in GitHub Desktop.
context "With Barlteby turned on" do
# TODO Get rid of NA tests and test single sku regions only when regionalization complete,
# check sku on VP instead of business region sku as well.
context "With a North American Viewable Product" do
- scenario "Lets you successfuly edit both associated skus and other fields" do
+ scenario "Lets you successfully edit both associated skus and other fields" do
+ t0 = Time.now
allow(BartlebyMode).to receive(:mode) { "full" }
viewable_product = FactoryGirl.create(:viewable_product, :bartleby_mode_full)
first_associated_sku = viewable_product.business_region_skus.first.sku
@@ -298,32 +300,32 @@ feature 'Viewable Product Admin', js: true, admin: true do
visit "/admin/viewable_products"
edit_non_sku_vp_info(viewable_product)
# The already successfully associated primary sku should be highlighted
- page.find("#viewable_product_business_region_skus_attributes_0_sku").has_css?(".associated_sku")
+ expect(page).to have_css( "#viewable_product_business_region_skus_attributes_0_sku.associated_sku")
# disassociate previous primary sku and fill in new one
click_button "primary_sku_disassociate"
- page.find("#viewable_product_business_region_skus_attributes_0_sku").has_no_css?(".associated_sku")
+ expect(page).not_to have_css( "#viewable_product_business_region_skus_attributes_0_sku.associated_sku")
fill_in "viewable_product_business_region_skus_attributes_0_sku", with: new_united_states_sku
click_button "primary_sku_associate"
wait_for_ajax
- page.find("#viewable_product_business_region_skus_attributes_0_sku").has_css?(".associated_sku")
+ expect(page).to have_css("#viewable_product_business_region_skus_attributes_0_sku.associated_sku")
# The already successfully Associated secondary sku should be highlighted
- page.find("#viewable_product_business_region_skus_attributes_1_sku").has_css?(".associated_sku")
+ expect(page).to have_css("#viewable_product_business_region_skus_attributes_1_sku.associated_sku")
# disassociate previous secondary sku and fill in new one
click_button "secondary_sku_disassociate"
- page.find("#viewable_product_business_region_skus_attributes_1_sku").has_no_css?(".associated_sku")
+ expect(page).not_to have_css( "#viewable_product_business_region_skus_attributes_1_sku.associated_sku")
fill_in "viewable_product_business_region_skus_attributes_1_sku", with: new_canadian_sku
click_button "secondary_sku_associate"
wait_for_ajax
- page.find("#viewable_product_business_region_skus_attributes_1_sku").has_css?(".associated_sku")
+ expect(page).to have_css("#viewable_product_business_region_skus_attributes_1_sku.associated_sku")
click_button "Update Viewable product"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment