mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix taxon_spec
This commit is contained in:
@@ -54,36 +54,36 @@ module Spree
|
||||
context "set_permalink" do
|
||||
it "should set permalink correctly when no parent present" do
|
||||
taxon.set_permalink
|
||||
taxon.permalink.should == "ruby-on-rails"
|
||||
expect(taxon.permalink).to eq "ruby-on-rails"
|
||||
end
|
||||
|
||||
it "should support Chinese characters" do
|
||||
taxon.name = "你好"
|
||||
taxon.set_permalink
|
||||
taxon.permalink.should == 'ni-hao'
|
||||
expect(taxon.permalink).to eq 'ni-hao'
|
||||
end
|
||||
|
||||
context "with parent taxon" do
|
||||
before do
|
||||
taxon.stub parent_id: 123
|
||||
taxon.stub parent: mock_model(Spree::Taxon, permalink: "brands")
|
||||
taxon.stub parent: build(:taxon, permalink: "brands")
|
||||
end
|
||||
|
||||
it "should set permalink correctly when taxon has parent" do
|
||||
taxon.set_permalink
|
||||
taxon.permalink.should == "brands/ruby-on-rails"
|
||||
expect(taxon.permalink).to eq "brands/ruby-on-rails"
|
||||
end
|
||||
|
||||
it "should set permalink correctly with existing permalink present" do
|
||||
taxon.permalink = "b/rubyonrails"
|
||||
taxon.set_permalink
|
||||
taxon.permalink.should == "brands/rubyonrails"
|
||||
expect(taxon.permalink).to eq "brands/rubyonrails"
|
||||
end
|
||||
|
||||
it "should support Chinese characters" do
|
||||
taxon.name = "我"
|
||||
taxon.set_permalink
|
||||
taxon.permalink.should == "brands/wo"
|
||||
expect(taxon.permalink).to eq "brands/wo"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -93,7 +93,6 @@ module Spree
|
||||
let(:taxonomy) { create(:taxonomy) }
|
||||
|
||||
it "does not error out" do
|
||||
pending "breaks in Rails 4 with postgres, see https://github.com/rails/rails/issues/10995"
|
||||
expect { taxonomy.root.children.where(name: "Some name").first_or_create }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user