From 492ea3cf1dee18f81ad4ff875be00890cc88f8e6 Mon Sep 17 00:00:00 2001 From: kd00506 <kd00506@surrey.ac.uk> Date: Tue, 1 Dec 2020 18:53:40 +0000 Subject: [PATCH] Commented Tests --- .idea/dataSources.xml | 16 ++++++++++++++++ test/controllers/contact_controller_test.rb | 10 +++++----- test/controllers/listview_controller_test.rb | 10 +++++----- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index fb5d686..f73bc99 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -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 diff --git a/test/controllers/contact_controller_test.rb b/test/controllers/contact_controller_test.rb index 3c80e85..27435fb 100644 --- a/test/controllers/contact_controller_test.rb +++ b/test/controllers/contact_controller_test.rb @@ -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 diff --git a/test/controllers/listview_controller_test.rb b/test/controllers/listview_controller_test.rb index 608f2c7..980057f 100644 --- a/test/controllers/listview_controller_test.rb +++ b/test/controllers/listview_controller_test.rb @@ -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 -- GitLab