improve tests
This commit is contained in:
parent
6f5d7a4908
commit
3f7e6b6175
|
@ -27,8 +27,10 @@ $(document).ready ->
|
||||||
return
|
return
|
||||||
|
|
||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
$.ajax(url: "/resume/progress").done (html) ->
|
bar = jQuery("#progress")
|
||||||
$("#progress").html html
|
if(bar.length > 0)
|
||||||
|
$.ajax(url: "/resume/progress").done (html) ->
|
||||||
|
bar.html html
|
||||||
|
|
||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
$('.best_in_place').bind 'ajax:success', ->
|
$('.best_in_place').bind 'ajax:success', ->
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :course do
|
factory :course do
|
||||||
name "First Course"
|
sequence :name do |n|
|
||||||
|
"Course #{n}"
|
||||||
|
end
|
||||||
extra "With Extras"
|
extra "With Extras"
|
||||||
start "2016-06-17"
|
sequence :start do |n|
|
||||||
|
Time.now - 2.weeks + (n*2).weeks
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
feature 'Applies' do
|
||||||
|
|
||||||
|
before(:each) do
|
||||||
|
sign_new
|
||||||
|
create_list( :course , 3)
|
||||||
|
visit application_path
|
||||||
|
end
|
||||||
|
after(:each) do
|
||||||
|
Warden.test_reset!
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'Send Application' do
|
||||||
|
within "#apply_primary_choice_course_id" do
|
||||||
|
courses = page.find_all("option")
|
||||||
|
expect(courses.length).to be 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "has plan select" do
|
||||||
|
within "#apply_plan" do
|
||||||
|
courses = page.find_all("option")
|
||||||
|
expect(courses.length).to be 3
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,3 @@
|
||||||
include Warden::Test::Helpers
|
|
||||||
Warden.test_mode!
|
|
||||||
|
|
||||||
# Feature: User profile page
|
# Feature: User profile page
|
||||||
# As a user
|
# As a user
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
include Warden::Test::Helpers
|
|
||||||
Warden.test_mode!
|
|
||||||
|
|
||||||
# Feature: User edit
|
# Feature: User edit
|
||||||
# As a user
|
# As a user
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
include Warden::Test::Helpers
|
|
||||||
Warden.test_mode!
|
|
||||||
|
|
||||||
feature 'Resume edit' do
|
feature 'Resume edit' do
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,22 @@ RSpec.describe Course, type: :model do
|
||||||
course = build :course
|
course = build :course
|
||||||
expect(course.save).to eq true
|
expect(course.save).to eq true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "names course not the same" do
|
||||||
|
course1 = create :course
|
||||||
|
course2 = create :course
|
||||||
|
expect(course1.name).not_to eq course2.name
|
||||||
|
end
|
||||||
|
|
||||||
|
it "creates courses that don't start at the same time" do
|
||||||
|
course1 = create :course
|
||||||
|
course2 = create :course
|
||||||
|
expect(course1.start).not_to eq course2.start
|
||||||
|
end
|
||||||
|
|
||||||
|
it "the second course is in the future" do
|
||||||
|
create :course
|
||||||
|
course2 = create :course
|
||||||
|
expect((course2.start - DateTime.now).to_i).to be < 250
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,51 +7,20 @@ require 'spec_helper'
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
# Add additional requires below this line. Rails is not loaded until this point!
|
# Add additional requires below this line. Rails is not loaded until this point!
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
|
||||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
|
||||||
# run as spec files by default. This means that files in spec/support that end
|
|
||||||
# in _spec.rb will both be required and run as specs, causing the specs to be
|
|
||||||
# run twice. It is recommended that you do not name files matching this glob to
|
|
||||||
# end with _spec.rb. You can configure this pattern with the --pattern
|
|
||||||
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
|
||||||
#
|
|
||||||
# The following line is provided for convenience purposes. It has the downside
|
|
||||||
# of increasing the boot-up time by auto-requiring all files in the support
|
|
||||||
# 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 migration and applies them before tests are run.
|
|
||||||
# If you are not using ActiveRecord, you can remove this line.
|
|
||||||
ActiveRecord::Migration.maintain_test_schema!
|
ActiveRecord::Migration.maintain_test_schema!
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
||||||
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 = false
|
|
||||||
|
|
||||||
# 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!
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
||||||
# Filter lines from Rails gems in backtraces.
|
|
||||||
config.filter_rails_from_backtrace!
|
config.filter_rails_from_backtrace!
|
||||||
# arbitrary gems may also be filtered via:
|
|
||||||
# config.filter_gems_from_backtrace("gem name")
|
config.include Warden::Test::Helpers, type: :feature
|
||||||
|
# config.include Devise::Test::IntegrationHelpers, type: :feature
|
||||||
|
|
||||||
|
Warden.test_mode!
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,18 +1,5 @@
|
||||||
ENV["RAILS_ENV"] = 'test'
|
ENV["RAILS_ENV"] = 'test'
|
||||||
|
|
||||||
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
|
||||||
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
||||||
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
||||||
# this file to always be loaded, without a need to explicitly require it in any
|
|
||||||
# files.
|
|
||||||
#
|
|
||||||
# Given that it is always loaded, you are encouraged to keep this file as
|
|
||||||
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
||||||
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
||||||
# individual file that may not need all of that loaded. Instead, consider making
|
|
||||||
# a separate helper file that requires the additional dependencies and performs
|
|
||||||
# the additional setup, and require it from the spec files that actually need
|
|
||||||
# it.
|
|
||||||
#
|
#
|
||||||
# The `.rspec` file also contains a few flags that are not defaults but that
|
# The `.rspec` file also contains a few flags that are not defaults but that
|
||||||
# users commonly want.
|
# users commonly want.
|
||||||
|
|
Loading…
Reference in New Issue