extracted boolean validation logic into stand-alone validator
This commit is contained in:
@ -9,6 +9,8 @@ describe CodeOcean::File do
|
||||
|
||||
it 'validates the presence of the hidden flag' do
|
||||
expect(file.errors[:hidden]).to be_present
|
||||
file.update(hidden: false)
|
||||
expect(file.errors[:hidden]).to be_blank
|
||||
end
|
||||
|
||||
it 'validates the presence of a name' do
|
||||
@ -17,6 +19,8 @@ describe CodeOcean::File do
|
||||
|
||||
it 'validates the presence of the read-only flag' do
|
||||
expect(file.errors[:read_only]).to be_present
|
||||
file.update(read_only: false)
|
||||
expect(file.errors[:read_only]).to be_blank
|
||||
end
|
||||
|
||||
context 'as a teacher-defined test' do
|
||||
|
@ -34,6 +34,8 @@ describe ExecutionEnvironment do
|
||||
|
||||
it 'validates the presence of the network enabled flag' do
|
||||
expect(execution_environment.errors[:network_enabled]).to be_present
|
||||
execution_environment.update(network_enabled: false)
|
||||
expect(execution_environment.errors[:network_enabled]).to be_blank
|
||||
end
|
||||
|
||||
it 'validates the numericality of the permitted run time' do
|
||||
|
@ -28,6 +28,8 @@ describe Exercise do
|
||||
|
||||
it 'validates the presence of the public flag' do
|
||||
expect(exercise.errors[:public]).to be_present
|
||||
exercise.update(public: false)
|
||||
expect(exercise.errors[:public]).to be_blank
|
||||
end
|
||||
|
||||
it 'validates the presence of a title' do
|
||||
|
@ -5,6 +5,8 @@ describe FileType do
|
||||
|
||||
it 'validates the presence of the binary flag' do
|
||||
expect(file_type.errors[:binary]).to be_present
|
||||
file_type.update(binary: false)
|
||||
expect(file_type.errors[:binary]).to be_blank
|
||||
end
|
||||
|
||||
context 'when binary' do
|
||||
@ -33,6 +35,8 @@ describe FileType do
|
||||
|
||||
it 'validates the presence of the executable flag' do
|
||||
expect(file_type.errors[:executable]).to be_present
|
||||
file_type.update(executable: false)
|
||||
expect(file_type.errors[:executable]).to be_blank
|
||||
end
|
||||
|
||||
it 'validates the presence of a name' do
|
||||
@ -41,6 +45,8 @@ describe FileType do
|
||||
|
||||
it 'validates the presence of the renderable flag' do
|
||||
expect(file_type.errors[:renderable]).to be_present
|
||||
file_type.update(renderable: false)
|
||||
expect(file_type.errors[:renderable]).to be_blank
|
||||
end
|
||||
|
||||
it 'validates the presence of a user' do
|
||||
|
Reference in New Issue
Block a user