mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-19 04:49:15 +00:00
Fixing specs
This commit is contained in:
@@ -4,7 +4,7 @@ module Api
|
||||
before_filter :override_owner, only: [:create, :update]
|
||||
before_filter :check_type, only: :update
|
||||
before_filter :override_sells, only: [:create, :update]
|
||||
before_filter :override_visiblity, only: [:create, :update]
|
||||
before_filter :override_visible, only: [:create, :update]
|
||||
respond_to :json
|
||||
|
||||
def managed
|
||||
|
||||
@@ -25,7 +25,7 @@ feature %q{
|
||||
it "displays a message when number of products is zero" do
|
||||
visit '/admin/products/bulk_edit'
|
||||
|
||||
expect(page).to have_text "No products found."
|
||||
expect(page).to have_text "No products yet. Why don't you add some?"
|
||||
end
|
||||
|
||||
it "displays a select box for suppliers, with the appropriate supplier selected" do
|
||||
|
||||
@@ -28,11 +28,13 @@ feature %q{
|
||||
end
|
||||
end
|
||||
|
||||
context "with an enterprise" do
|
||||
context "with multiple enterprises" do
|
||||
let(:d1) { create(:distributor_enterprise) }
|
||||
let(:d2) { create(:distributor_enterprise) }
|
||||
|
||||
before :each do
|
||||
@enterprise_user.enterprise_roles.build(enterprise: d1).save
|
||||
@enterprise_user.enterprise_roles.build(enterprise: d2).save
|
||||
end
|
||||
|
||||
it "displays information about the enterprise" do
|
||||
|
||||
@@ -18,22 +18,4 @@ describe Api::EnterpriseSerializer do
|
||||
serializer = Api::EnterpriseSerializer.new enterprise
|
||||
serializer.to_json.should match "map_005-hub.svg"
|
||||
end
|
||||
|
||||
describe "visibility" do
|
||||
before do
|
||||
enterprise.stub(:visible).and_return true
|
||||
end
|
||||
|
||||
it "is visible when confirmed" do
|
||||
enterprise.stub(:confirmed?).and_return true
|
||||
serializer = Api::EnterpriseSerializer.new enterprise
|
||||
expect(serializer.to_json).to match "\"visible\":true"
|
||||
end
|
||||
|
||||
it "is not visible when unconfirmed" do
|
||||
enterprise.stub(:confirmed?).and_return false
|
||||
serializer = Api::EnterpriseSerializer.new enterprise
|
||||
expect(serializer.to_json).to match "\"visible\":false"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user