Transpec spec/controllers/api/taxonomies_controller_spec, spec/controllers/api/taxons_controller_spec and spec/models/enterprise_spec

This commit is contained in:
luisramos0
2019-09-19 20:34:30 +01:00
parent c4e6c0af2b
commit 3c412b7b7d
3 changed files with 8 additions and 8 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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