From 67d985ed3047fe9e73b2038a81d96876ab54b63a Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 7 Dec 2015 23:36:30 -0500 Subject: Add a simple Capybara test * Add Rakefile to run tests with `rake` * Add a `test_helper` to take care of the setup that Capybara requires in order to run * Add a super basic test to see if Capybara works * Put app in a `Sinatra::Base` subclass so that we can tell Capybara where to find it --- test/integration/auth_test.rb | 9 +++++++++ test/integration_test_helper.rb | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 test/integration/auth_test.rb create mode 100644 test/integration_test_helper.rb (limited to 'test') diff --git a/test/integration/auth_test.rb b/test/integration/auth_test.rb new file mode 100644 index 0000000..df60187 --- /dev/null +++ b/test/integration/auth_test.rb @@ -0,0 +1,9 @@ +require 'integration_test_helper' + + +class TestAuth < CapybaraTestCase + def test_index_has_login_form + visit '/' + assert_equal 200, page.status_code + end +end diff --git a/test/integration_test_helper.rb b/test/integration_test_helper.rb new file mode 100644 index 0000000..4cc35a7 --- /dev/null +++ b/test/integration_test_helper.rb @@ -0,0 +1,16 @@ +require 'minitest/autorun' +require 'capybara' + +require 'app' + + +class CapybaraTestCase < Minitest::Unit::TestCase + include Capybara::DSL + + def teardown + Capybara.reset_sessions! + Capybara.use_default_driver + end +end + +Capybara.app = App -- cgit v1.2.3