Commit c6b4562

mo khan <mo@mokhan.ca>
2014-11-15 23:01:26
add first functional test.
1 parent 22056af
Changed files (5)
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
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
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
Gemfile
@@ -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'
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