Skip to content

Commit

Permalink
Merge pull request #1616 from fschwahn/patch-1
Browse files Browse the repository at this point in the history
Update product slug validation
  • Loading branch information
jhawthorn committed Dec 13, 2016
2 parents 1b77bc4 + df7be82 commit c9a09d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/spec/features/admin/products/edit/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

fill_in "product_slug", with: ''
click_button "Update"
within('#product_slug_field') { expect(page).to have_content("is too short") }
within('#product_slug_field') { expect(page).to have_content("can't be blank") }

fill_in "product_slug", with: 'another-random-slug-value'
fill_in "product_slug", with: 'x'
click_button "Update"
expect(page).to have_content("successfully updated!")
end
Expand Down
2 changes: 1 addition & 1 deletion core/app/models/spree/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def find_or_build_master
validates :name, presence: true
validates :price, presence: true, if: proc { Spree::Config[:require_master_price] }
validates :shipping_category_id, presence: true
validates :slug, length: { minimum: 3 }, uniqueness: { allow_blank: true }
validates :slug, presence: true, uniqueness: { allow_blank: true }

attr_accessor :option_values_hash

Expand Down

0 comments on commit c9a09d5

Please sign in to comment.