Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ group :development, :test do
gem 'codecov', '~> 0.1.17', require: false
# Strategies for cleaning databases in Ruby. Can be used to ensure a clean state for testing.
gem 'database_cleaner', '~> 1.8.5'
# Capybara is an integration testing tool for rack based web applications. It simulates how a user would interact with a website
gem 'capybara'
end

group :development do
Expand Down
15 changes: 15 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ansi (1.5.0)
arel (9.0.0)
autoprefixer-rails (9.8.6.3)
Expand All @@ -52,6 +54,14 @@ GEM
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.1.3)
capybara (3.33.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
codecov (0.1.21)
json
simplecov
Expand Down Expand Up @@ -120,6 +130,7 @@ GEM
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
pg (1.2.3)
public_suffix (4.0.6)
puma (3.12.6)
rack (2.2.3)
rack-test (1.1.0)
Expand Down Expand Up @@ -156,6 +167,7 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (1.8.2)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
Expand Down Expand Up @@ -243,13 +255,16 @@ GEM
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
will_paginate (3.1.8)
xpath (3.2.0)
nokogiri (~> 1.8)

PLATFORMS
ruby

DEPENDENCIES
bootsnap (>= 1.1.0)
byebug
capybara
codecov (~> 0.1.17)
coffee-rails (~> 4.2)
database_cleaner (~> 1.8.5)
Expand Down
49 changes: 49 additions & 0 deletions spec/features/users_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require 'rails_helper'

RSpec.feature "Users", type: :feature do
context 'create new user' do
scenario "should be successful" do
visit new_user_registration_path
within('form') do
fill_in 'Email', with: 'john.doe@example.com'
fill_in 'Password', with: 'examplePass'
fill_in 'Password confirmation', with: 'examplePass'
end
click_button 'Sign up'
expect(page).to have_content('Logout john.doe@example.com')
end

scenario "should fail" do
visit new_user_registration_path
within('form') do
end
click_button 'Sign up'
expect(page).to have_content('Email can\'t be blank Password can\'t be blank')
end

scenario "should fail password doesen\'t mutch password" do
visit new_user_registration_path
within('form') do
fill_in 'Email', with: 'john.doe@example.com'
fill_in 'Password', with: 'examplePass'
end
click_button 'Sign up'
expect(page).to have_content('Password confirmation doesn\'t match Password')
end

scenario "should redirect to Log in page" do
visit new_user_registration_path
within('form') do
fill_in 'Email', with: 'john.doe@example.com'
fill_in 'Password', with: 'examplePass'
end
# click_link 'Log in'
find("a[href='#{new_user_registration_path}']").click
expect(page).to have_content('Log in')
end
end
context 'update user' do
end
context 'destroy user' do
end
end
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require 'capybara/rails'
# Add additional requires below this line. Rails is not loaded until this point!
require 'support/factory_bot'
require 'support/simple_cov'
Expand Down