Skip to content

Commit

Permalink
Set visible to only_through_links on enterprise creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jibees committed Jul 25, 2023
1 parent 9e0f3d0 commit 82b1e02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/v0/enterprises_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def override_sells
end

def override_visible
enterprise_params[:visible] = false
enterprise_params[:visible] = "only_through_links"
end

def enterprise_params
Expand Down
8 changes: 8 additions & 0 deletions spec/controllers/api/v0/enterprises_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
expect(enterprise.sells).to eq('any')
end

it "creates a visible=hidden enterprise" do
api_post :create, { enterprise: new_enterprise_params }
expect(response.status).to eq 201

enterprise = Enterprise.last
expect(enterprise.visible).to eq("only_through_links")
end

it "saves all user ids submitted" do
manager1 = create(:user)
manager2 = create(:user)
Expand Down

0 comments on commit 82b1e02

Please sign in to comment.