Add controller tests
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
require "test_helper"
|
||||
|
||||
class Accounts::EntropyConfigurationsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "update" do
|
||||
put account_entropy_configuration_path, params: { entropy_configuration: { auto_close_period: 1.day, auto_reconsider_period: 2.days } }
|
||||
|
||||
assert_equal 1.day, entropy_configurations("37s_account").auto_close_period
|
||||
assert_equal 2.days, entropy_configurations("37s_account").auto_reconsider_period
|
||||
|
||||
assert_redirected_to account_settings_path
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
require "test_helper"
|
||||
|
||||
class Accounts::SettingsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in_as :kevin
|
||||
end
|
||||
|
||||
test "show" do
|
||||
get account_settings_path
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
@@ -30,7 +30,9 @@ class CollectionsControllerTest < ActionDispatch::IntegrationTest
|
||||
patch collection_path(collections(:writebook)), params: {
|
||||
collection: {
|
||||
name: "Writebook bugs",
|
||||
all_access: false
|
||||
all_access: false,
|
||||
auto_close_period: 1.day,
|
||||
auto_reconsider_period: 2.days,
|
||||
},
|
||||
user_ids: users(:david, :jz).pluck(:id)
|
||||
}
|
||||
@@ -38,6 +40,8 @@ class CollectionsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_redirected_to edit_collection_path(collections(:writebook))
|
||||
assert_equal "Writebook bugs", collections(:writebook).reload.name
|
||||
assert_equal users(:david, :jz).sort, collections(:writebook).users.sort
|
||||
assert_equal 1.day, entropy_configurations(:writebook_collection).auto_close_period
|
||||
assert_equal 2.days, entropy_configurations(:writebook_collection).auto_reconsider_period
|
||||
assert_not collections(:writebook).all_access?
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user