Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
kobaltz committed Feb 8, 2024
1 parent 204ff7a commit 8b006eb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class ProjectsControllerTest < ActionDispatch::IntegrationTest
end

test "should not get new" do
MissionControl::Servers::Project.destroy_all
get new_project_url
assert_redirected_to projects_url
assert_response :success
end

test "should get new" do
Expand All @@ -25,8 +26,10 @@ class ProjectsControllerTest < ActionDispatch::IntegrationTest
end

test "should not create project" do
Project.create(title: "Project", token: SecureRandom.hex)
MissionControl::Servers.configuration.single_project_mode = true
assert_no_difference("Project.count") do
post projects_url, params: { project: { title: @project.title, token: @project.token } }
post projects_url, params: { project: { title: "Example", token: SecureRandom.hex } }
end

assert_redirected_to projects_url
Expand All @@ -35,7 +38,7 @@ class ProjectsControllerTest < ActionDispatch::IntegrationTest
test "should create project when none exists" do
MissionControl::Servers::Project.destroy_all
assert_difference("Project.count") do
post projects_url, params: { project: { title: @project.title, token: @project.token } }
post projects_url, params: { project: { title: "Example", token: SecureRandom.hex } }
end

assert_redirected_to project_url(Project.last)
Expand Down

0 comments on commit 8b006eb

Please sign in to comment.