mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Transpec spec/controllers/api/taxonomies_controller_spec, spec/controllers/api/taxons_controller_spec and spec/models/enterprise_spec
This commit is contained in:
@@ -23,9 +23,9 @@ module Api
|
||||
it "gets the jstree-friendly version of a taxonomy" do
|
||||
api_get :jstree, id: taxonomy.id
|
||||
|
||||
json_response["data"].should eq(taxonomy.root.name)
|
||||
json_response["attr"].should eq("id" => taxonomy.root.id, "name" => taxonomy.root.name)
|
||||
json_response["state"].should eq("closed")
|
||||
expect(json_response["data"]).to eq(taxonomy.root.name)
|
||||
expect(json_response["attr"]).to eq("id" => taxonomy.root.id, "name" => taxonomy.root.name)
|
||||
expect(json_response["state"]).to eq("closed")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,9 +44,9 @@ describe Api::TaxonsController do
|
||||
api_get :jstree, taxonomy_id: taxonomy.id, id: taxon.id
|
||||
|
||||
response = json_response.first
|
||||
response["data"].should eq(taxon2.name)
|
||||
response["attr"].should eq("name" => taxon2.name, "id" => taxon2.id)
|
||||
response["state"].should eq("closed")
|
||||
expect(response["data"]).to eq(taxon2.name)
|
||||
expect(response["attr"]).to eq("name" => taxon2.name, "id" => taxon2.id)
|
||||
expect(response["state"]).to eq("closed")
|
||||
end
|
||||
|
||||
it "cannot create a new taxon if not an admin" do
|
||||
|
||||
@@ -494,11 +494,11 @@ describe Enterprise do
|
||||
end
|
||||
|
||||
it "gets all taxons of all distributed products in open order cycles" do
|
||||
Spree::Product.stub(:in_distributor).and_return [product1, product2, product3]
|
||||
allow(Spree::Product).to receive(:in_distributor).and_return [product1, product2, product3]
|
||||
ex.variants << product1.variants.first
|
||||
ex.variants << product3.variants.first
|
||||
|
||||
distributor.current_distributed_taxons.should match_array [taxon1, taxon3]
|
||||
expect(distributor.current_distributed_taxons).to match_array [taxon1, taxon3]
|
||||
end
|
||||
|
||||
it "gets all taxons of all supplied products" do
|
||||
|
||||
Reference in New Issue
Block a user