diff options
| author | mo khan <mo@mokhan.ca> | 2014-11-15 16:01:26 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-11-15 16:01:26 -0700 |
| commit | c6b45629633a1187af8fc44dd196320a61b1ff84 (patch) | |
| tree | 371ed351cef9691ebb62aef34a9890efb71f1530 | |
| parent | 22056af72b6550e5578321cc60331f2631d80093 (diff) | |
add first functional test.
| -rw-r--r-- | Gemfile | 1 | ||||
| -rw-r--r-- | Gemfile.lock | 12 | ||||
| -rw-r--r-- | config/environments/test.rb | 1 | ||||
| -rw-r--r-- | spec/features/login_spec.rb | 15 | ||||
| -rw-r--r-- | spec/rails_helper.rb | 4 |
5 files changed, 32 insertions, 1 deletions
@@ -65,6 +65,7 @@ group :development, :test do gem 'dotenv-rails' gem 'i18n-tasks' gem "codeclimate-test-reporter", require: nil + gem 'capybara' end group :staging, :production do gem 'rails_12factor' diff --git a/Gemfile.lock b/Gemfile.lock index bbcf2e9..89d10c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,6 +56,12 @@ GEM columnize (~> 0.8) debugger-linecache (~> 1.2) slop (~> 3.6) + capybara (2.4.4) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) codeclimate-test-reporter (0.4.1) simplecov (>= 0.7.1, < 1.0.0) coderay (1.1.0) @@ -122,8 +128,11 @@ GEM mime-types (>= 1.16, < 3) method_source (0.8.2) mime-types (2.4.3) + mini_portile (0.6.1) minitest (5.4.2) multi_json (1.10.1) + nokogiri (1.6.4.1) + mini_portile (~> 0.6.0) pg (0.17.1) pry (0.10.1) coderay (~> 1.1.0) @@ -225,6 +234,8 @@ GEM uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) + xpath (2.0.0) + nokogiri (~> 1.3) PLATFORMS ruby @@ -233,6 +244,7 @@ DEPENDENCIES bcrypt bootstrap-sass byebug + capybara codeclimate-test-reporter coffee-rails dalli diff --git a/config/environments/test.rb b/config/environments/test.rb index 0dbbe46..7517974 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -33,4 +33,5 @@ Urkel::Application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + config.allow_concurrency = false end diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb new file mode 100644 index 0000000..ef83ce3 --- /dev/null +++ b/spec/features/login_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +describe "the signin process", type: :feature do + let!(:user) { create(:user, password: 'password') } + + it 'signs the user in' do + visit root_path + within ".form-signin" do + fill_in 'email', with: user.email + fill_in 'password', with: 'password' + end + click_button "Sign in" + expect(page).to have_content("Dashboard") + end +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index f0a689c..6da124b 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -2,8 +2,10 @@ ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! +require 'rspec/rails' +require 'capybara/rails' +require 'capybara/rspec' # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are |
