|
63 | 63 | end |
64 | 64 |
|
65 | 65 | describe "allow_auto_login" do |
| 66 | + it "should default it to true when a new instance is created without a value being provided for it" do |
| 67 | + form = ServerConfigurationForm.new({}) |
| 68 | + expect(form.allow_auto_login).to eq nil |
| 69 | + expect(form.should_allow_auto_login).to eq true |
| 70 | + end |
| 71 | + |
66 | 72 | it "should set it when a new instance is created" do |
67 | | - form = ServerConfigurationForm.new({:allow_auto_login => "1"}) |
68 | | - expect(form.allow_auto_login).to eq "1" |
| 73 | + form = ServerConfigurationForm.new({:allow_auto_login => "true"}) |
| 74 | + expect(form.allow_auto_login).to eq "true" |
69 | 75 | expect(form.should_allow_auto_login).to eq true |
70 | 76 |
|
71 | | - form = ServerConfigurationForm.new({:allow_auto_login => "0"}) |
72 | | - expect(form.allow_auto_login).to eq "0" |
| 77 | + form = ServerConfigurationForm.new({:allow_auto_login => "false"}) |
| 78 | + expect(form.allow_auto_login).to eq "false" |
73 | 79 | expect(form.should_allow_auto_login).to eq false |
74 | 80 | end |
75 | 81 |
|
76 | | - it "should set allow_auto_login to 1 when form is being created from_server_config and isAllowOnlyKnownUsersToLogin is false" do |
| 82 | + it "should set allow_auto_login to 'true' when form is being created from_server_config and isAllowOnlyKnownUsersToLogin is false" do |
77 | 83 | @ldap_config = LdapConfig.new("ldap://test.com", "test", "password", @encrypted_password, true,BasesConfig.new([BaseConfig.new('base1'), BaseConfig.new('base2')].to_java(BaseConfig)), "searchFilter") |
78 | 84 | @password_file_config = PasswordFileConfig.new("path") |
79 | 85 | @security_config = SecurityConfig.new(@ldap_config, @password_file_config, false) |
80 | 86 | @mail_host = MailHost.new("blrstdcrspair02", 9999, "pavan", "strong_password", true, true, "from@from.com", "admin@admin.com") |
81 | 87 |
|
82 | 88 | form = ServerConfigurationForm.from_server_config(com.thoughtworks.go.config.ServerConfig.new(@security_config, @mail_host)) |
83 | | - expect(form.allow_auto_login).to eq "1" |
| 89 | + expect(form.allow_auto_login).to eq "true" |
84 | 90 | expect(form.should_allow_auto_login).to eq true |
85 | 91 | end |
86 | 92 |
|
87 | | - it "should set allow_auto_login to 0 when form is being created from_server_config and isAllowOnlyKnownUsersToLogin is true" do |
| 93 | + it "should set allow_auto_login to 'false' when form is being created from_server_config and isAllowOnlyKnownUsersToLogin is true" do |
88 | 94 | @ldap_config = LdapConfig.new("ldap://test.com", "test", "password", @encrypted_password, true,BasesConfig.new([BaseConfig.new('base1'), BaseConfig.new('base2')].to_java(BaseConfig)), "searchFilter") |
89 | 95 | @password_file_config = PasswordFileConfig.new("path") |
90 | 96 | @security_config = SecurityConfig.new(@ldap_config, @password_file_config, true) |
91 | 97 | @mail_host = MailHost.new("blrstdcrspair02", 9999, "pavan", "strong_password", true, true, "from@from.com", "admin@admin.com") |
92 | 98 |
|
93 | 99 | form = ServerConfigurationForm.from_server_config(com.thoughtworks.go.config.ServerConfig.new(@security_config, @mail_host)) |
94 | | - expect(form.allow_auto_login).to eq "0" |
| 100 | + expect(form.allow_auto_login).to eq "false" |
95 | 101 | expect(form.should_allow_auto_login).to eq false |
96 | 102 | end |
97 | 103 | end |
|
0 commit comments