diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index fb5d686d45557ad9fd3cd13f8424f94f1c5d761b..f73bc99b5898bc4a4ef2cd4dcf299aeaf200d4f3 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 3c80e85f0524ba5085e514a39fd872dd3fcf4593..27435fb356bc06eda3c12c9ffe3ce8a49b791eb9 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 608f2c7f4d68a22f4aec8df1646575a877c25d40..980057f5070bc0d9f575726bd8f99c27965ff13e 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