Introduction
Introduction Statistics Contact Development Disclaimer Help
fixed soft-tab indentation issues, also added initial project feature spec whic…
Log
Files
Refs
README
---
commit a7ed1585a04b520a7a84acf517968df24010170c
parent d0d5c0f79f989db9ac60c286d2dde1a8c6878904
Author: zeknox <[email protected]>
Date: Fri, 23 Oct 2015 23:12:15 -0500
fixed soft-tab indentation issues, also added initial project feature spec whic…
Diffstat:
M app/views/projects/index.html.erb | 2 +-
A spec/features/projects_spec.rb | 25 +++++++++++++++++++++++++
M spec/features/visitor/logins_spec.… | 100 ++++++++++++++++-----------…
M spec/rails_helper.rb | 46 ++++++++++++++++-------------…
A spec/support/auth_logic_helpers.rb | 21 +++++++++++++++++++++
5 files changed, 120 insertions(+), 74 deletions(-)
---
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.…
@@ -2,7 +2,7 @@
<h1 class='title'>WarVOX Projects</h1>
<%= will_paginate @projects, :renderer => BootstrapPagination::Rails %>
-<table class='table table-striped ' width='90%'>
+<table id='projects-table' class='table table-striped ' width='90%'>
<thead>
<tr>
<th>Name</th>
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb
@@ -0,0 +1,25 @@
+require 'rails_helper'
+
+RSpec.feature "Projects", type: :feature do
+
+ before(:each) do
+ @user = create(:user)
+ create_user_session(@user)
+ end
+
+ it "list all existing projects" do
+ project = create(:project)
+ visit projects_path
+ expect(page).to have_content "WarVOX Projects"
+ within "#projects-table" do
+ expect(page).to have_content "Name"
+ expect(page).to have_content "Description"
+ expect(page).to have_content "Jobs"
+ expect(page).to have_content "Calls"
+ expect(page).to have_content "Analyzed"
+ expect(page).to have_content "Created"
+ expect(page).to have_content "Actions"
+ expect(page).to have_content project.name
+ end
+ end
+end
diff --git a/spec/features/visitor/logins_spec.rb b/spec/features/visitor/login…
@@ -1,58 +1,58 @@
require 'rails_helper'
RSpec.feature "Logins", type: :feature do
- it "login with valid credentials" do
- user = create(:user)
- visit login_path
- within "#new_user_session" do
- expect(page).to have_content "Username"
- expect(page).to have_content "Password"
- fill_in "user_session_login", with: user.login
- fill_in "user_session_password", with: 'RandomPass'
- click_button "Sign in"
- end
- within "div.content" do
- expect(page).to have_content "WarVOX Projects"
- end
- end
+ it "login with valid credentials" do
+ user = create(:user)
+ visit login_path
+ within "#new_user_session" do
+ expect(page).to have_content "Username"
+ expect(page).to have_content "Password"
+ fill_in "user_session_login", with: user.login
+ fill_in "user_session_password", with: 'RandomPass'
+ click_button "Sign in"
+ end
+ within "div.content" do
+ expect(page).to have_content "WarVOX Projects"
+ end
+ end
- it "failed login with invalid password valid username" do
- user = create(:user)
- visit login_path
- within "#new_user_session" do
- fill_in "user_session_login", with: user.login
- fill_in "user_session_password", with: 'WrongPassword'
- click_button "Sign in"
- end
- expect(page).to have_content "Password is not valid"
- end
+ it "failed login with invalid password valid username" do
+ user = create(:user)
+ visit login_path
+ within "#new_user_session" do
+ fill_in "user_session_login", with: user.login
+ fill_in "user_session_password", with: 'WrongPassword'
+ click_button "Sign in"
+ end
+ expect(page).to have_content "Password is not valid"
+ end
- it "failed login with invalid username valid password" do
- user = create(:user)
- visit login_path
- within "#new_user_session" do
- fill_in "user_session_login", with: user.login + "Wrong"
- fill_in "user_session_password", with: 'RandomPass'
- click_button "Sign in"
- end
- expect(page).to have_content "Login is not valid"
- end
+ it "failed login with invalid username valid password" do
+ user = create(:user)
+ visit login_path
+ within "#new_user_session" do
+ fill_in "user_session_login", with: user.login + "Wron…
+ fill_in "user_session_password", with: 'RandomPass'
+ click_button "Sign in"
+ end
+ expect(page).to have_content "Login is not valid"
+ end
- it "failed login with no input entered" do
- visit login_path
- within "#new_user_session" do
- click_button "Sign in"
- end
- expect(page).to have_content "You did not provide any details for authenti…
- end
+ it "failed login with no input entered" do
+ visit login_path
+ within "#new_user_session" do
+ click_button "Sign in"
+ end
+ expect(page).to have_content "You did not provide any details …
+ end
- it "failed login with no password entered" do
- user = create(:user)
- visit login_path
- within "#new_user_session" do
- fill_in "user_session_login", with: user.login
- click_button "Sign in"
- end
- expect(page).to have_content "Password cannot be blank"
- end
+ it "failed login with no password entered" do
+ user = create(:user)
+ visit login_path
+ within "#new_user_session" do
+ fill_in "user_session_login", with: user.login
+ click_button "Sign in"
+ end
+ expect(page).to have_content "Password cannot be blank"
+ end
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
@@ -20,36 +20,36 @@ require 'rspec/rails'
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
-# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
+Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
- # FactoryGirl Syntax
- config.include FactoryGirl::Syntax::Methods
+ # FactoryGirl Syntax
+ config.include FactoryGirl::Syntax::Methods
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fi…
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, remove the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = true
+ # If you're not using ActiveRecord, or you'd prefer not to run each of…
+ # examples within a transaction, remove the following line or assign f…
+ # instead of true.
+ config.use_transactional_fixtures = true
- # RSpec Rails can automatically mix in different behaviours to your tests
- # based on their file location, for example enabling you to call `get` and
- # `post` in specs under `spec/controllers`.
- #
- # You can disable this behaviour by removing the line below, and instead
- # explicitly tag your specs with their type, e.g.:
- #
- # RSpec.describe UsersController, :type => :controller do
- # # ...
- # end
- #
- # The different available types are documented in the features, such as in
- # https://relishapp.com/rspec/rspec-rails/docs
- config.infer_spec_type_from_file_location!
+ # RSpec Rails can automatically mix in different behaviours to your te…
+ # based on their file location, for example enabling you to call `get`…
+ # `post` in specs under `spec/controllers`.
+ #
+ # You can disable this behaviour by removing the line below, and inste…
+ # explicitly tag your specs with their type, e.g.:
+ #
+ # RSpec.describe UsersController, :type => :controller do
+ # # ...
+ # end
+ #
+ # The different available types are documented in the features, such a…
+ # https://relishapp.com/rspec/rspec-rails/docs
+ config.infer_spec_type_from_file_location!
end
diff --git a/spec/support/auth_logic_helpers.rb b/spec/support/auth_logic_helpe…
@@ -0,0 +1,20 @@
+module Authlogic
+ module TestHelper
+ def create_user_session(user)
+ visit login_path
+ within "#new_user_session" do
+ expect(page).to have_content "Username"
+ expect(page).to have_content "Password"
+ fill_in "user_session_login", with: user.login
+ fill_in "user_session_password", with: user.pa…
+ click_button "Sign in"
+ end
+ end
+ end
+end
+
+# Make this available to just the request and feature specs
+RSpec.configure do |config|
+ config.include Authlogic::TestHelper, type: :request
+ config.include Authlogic::TestHelper, type: :feature
+end
+\ No newline at end of file
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.