Skip to content
Snippets Groups Projects
Commit 492ea3cf authored by Dore, Kieran D (UG - Comp Sci & Elec Eng)'s avatar Dore, Kieran D (UG - Comp Sci & Elec Eng)
Browse files

Commented Tests

parent c427570c
No related branches found
No related tags found
No related merge requests found
......@@ -20,5 +20,21 @@
</library>
</libraries>
</data-source>
<data-source source="LOCAL" name="Rails Lab4: test" uuid="7b8d0096-5fb7-44d2-9ddb-c8639886d44f">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
<remarks>$PROJECT_DIR$/config/database.yml</remarks>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\kiera\Documents\COM2025WAD\Coursework\db\test.sqlite3</jdbc-url>
</data-source>
<data-source source="LOCAL" name="Rails Lab4: development" uuid="bf80988c-35f0-4f8b-996b-ed02880324df">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
<remarks>$PROJECT_DIR$/config/database.yml</remarks>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\kiera\Documents\COM2025WAD\Coursework\db\development.sqlite3</jdbc-url>
</data-source>
</component>
</project>
\ No newline at end of file
......@@ -7,21 +7,21 @@ class ContactControllerTest < ActionDispatch::IntegrationTest
end
test 'email should not be blank and should be in a valid format' do
post sendmessage_path, params: {name: 'Ben', email: 'email@address.com', message: 'boop'}
post sendmessage_path, params: {name: 'Ben', email: 'email@address.com', message: 'boop'} # Correct
assert_redirected_to homepage_path
post sendmessage_path, params: {name: 'Ben', email: 'bad_email', message: 'boop'}
post sendmessage_path, params: {name: 'Ben', email: 'bad_email', message: 'boop'} # Incorrect
assert_redirected_to contact_path
post sendmessage_path, params: {name: 'Ben', email: 'bad_email', message: 'boop'}
post sendmessage_path, params: {name: 'Ben', email: '', message: 'boop'} # Incorrect
assert_redirected_to contact_path
end
test 'message should not be blank' do
post sendmessage_path, params: {name: 'Ben', email: 'email@address.com', message: 'boop'}
post sendmessage_path, params: {name: 'Ben', email: 'email@address.com', message: 'boop'} # Correct
assert_redirected_to homepage_path
post sendmessage_path, params: {name: 'Ben', email: 'email@address.com', message: ''}
post sendmessage_path, params: {name: 'Ben', email: 'email@address.com', message: ''} # Incorrect
assert_redirected_to contact_path
end
......
......@@ -37,26 +37,26 @@ class ListviewControllerTest < ActionDispatch::IntegrationTest
end
test 'product quantity should be empty or greater than 0' do
get change_prods_path, params: { product_id: [Product.first.id], quantity: [69] }
get change_prods_path, params: { product_id: [Product.first.id], quantity: [69] } # Correct
assert Product.first.quantity = 69
assert_redirected_to listview_path
get change_prods_path, params: { product_id: [Product.first.id], quantity: [''] }
get change_prods_path, params: { product_id: [Product.first.id], quantity: [''] } # Incorrect
assert Product.first.quantity = 69
assert_redirected_to listview_path
get change_prods_path, params: { product_id: [Product.first.id], quantity: [-4] }
get change_prods_path, params: { product_id: [Product.first.id], quantity: [-4] } # Incorrect
assert Product.first.quantity = 69
assert_redirected_to listview_path
end
test 'product name should not be empty' do
get change_prods_path, params: { product_id: [Product.first.id], name: ['nothing'] }
get change_prods_path, params: { product_id: [Product.first.id], name: ['nothing'] } # Correct
assert Product.first.name = 'nothing'
assert_redirected_to listview_path
get change_prods_path, params: { product_id: [Product.first.id], name: [''] }
get change_prods_path, params: { product_id: [Product.first.id], name: [''] } # Incorrect
assert Product.first.name = 'nothing'
assert_redirected_to listview_path
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment