diff --git a/.gitignore b/.gitignore index 4147943ea..c2b076ac7 100644 --- a/.gitignore +++ b/.gitignore @@ -119,6 +119,9 @@ package-lock.json # local environment files .env.*.local +# local Gemfile file +Gemfile.local + data/* .robocop.yml diff --git a/.rspec b/.rspec new file mode 100644 index 000000000..7a2cc1a6e --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--require spec_helper +--format documentation +--color diff --git a/Gemfile b/Gemfile index 81d55de31..247d777ef 100644 --- a/Gemfile +++ b/Gemfile @@ -1,54 +1,106 @@ source 'https://rubygems.org' -gem 'rails' -gem 'tzinfo-data' #needed by windows -gem 'mysql2' +# ------------------------------------------------------------ +# Core Framework +# ------------------------------------------------------------ +gem 'rails', '5.1.7' + +# ------------------------------------------------------------ +# Database & ODM +# ------------------------------------------------------------ +gem 'mongo' # MongoDB driver +gem 'mongoid' # ODM for MongoDB +gem 'carrierwave-mongoid', require: 'carrierwave/mongoid' # File uploads with Mongoid +gem 'kaminari-mongoid' # Pagination for Mongoid +gem 'kaminari' # Pagination core + +gem 'mysql2' # For CMS (RefineryCMS) + +# ------------------------------------------------------------ +# Authentication & Authorization +# ------------------------------------------------------------ +gem 'devise' +gem 'devise-encryptable' +gem 'bcrypt' + +# ------------------------------------------------------------ +# CMS (RefineryCMS) +# ------------------------------------------------------------ gem 'refinerycms' gem 'refinerycms-authentication-devise' gem 'refinerycms-wymeditor' -# We use this version of refinerycms-i18n because of the crash in story 1831. IT MUST BE REMOVED on bump of refinery to version 5 -gem 'refinerycms-i18n', '4.0.2', git: 'https://github.com/refinery/refinerycms-i18n', ref: '30059ea' -# See above -gem 'mongoid' -gem 'mongo' -gem 'execjs' -#gem 'libv8' -gem 'mobvious' -gem 'formtastic' -#gem 'therubyracer', platforms: :ruby # avoid loading on windows -gem 'airbrake' -# gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby' -gem 'bcrypt' -gem 'text' + +# Temporary fix: refinerycms-i18n pinned due to crash in story 1831 +# MUST BE REMOVED when upgrading Refinery to v5 +gem 'refinerycms-i18n', '4.0.2', + git: 'https://github.com/refinery/refinerycms-i18n', + ref: '30059ea' + +# Custom Refinery extension +gem 'refinerycms-county_pages', path: 'vendor/extensions' + +# ------------------------------------------------------------ +# Frontend & Assets +# ------------------------------------------------------------ +gem 'sass-rails' +gem 'coffee-rails' +gem 'bourbon' # Sass mixins +gem 'font_awesome5_rails' +gem 'jquery-rails' +gem 'uglifier' # JS compressor + +# ------------------------------------------------------------ +# Utilities & Enhancements +# ------------------------------------------------------------ +gem 'airbrake' # Error reporting +gem 'browser' # Browser detection +gem 'email_veracity' # Email validation +gem 'execjs' # JS runtime +gem 'formtastic' # Form builder +gem 'geocoder', '1.3.7' # Geocoding (locked due to regression in 1.4) +gem 'gretel' # Breadcrumbs gem 'json' -gem 'pry' -gem 'pry-byebug' -gem 'email_veracity' -gem 'unicode' -gem 'kaminari' -gem 'kaminari-mongoid' -gem 'gretel' -gem 'geocoder', '1.3.7' #appears to be a regression in 1.4 -gem 'bourbon' gem 'mail-logger' -gem 'devise' -gem 'devise-encryptable' -gem 'nokogiri', ">= 1.13.6" +gem 'mobvious' # Mobile device detection +gem 'newrelic_rpm' # Performance monitoring +gem 'nokogiri', '~> 1.15.0' +gem 'octokit' # GitHub API client gem 'osgb', git: 'https://github.com/FreeUKGen/osgb.git' +gem 'psych', '~> 3.3.0' gem 'rubyzip' -gem 'zip-zip' -gem 'rspec-rails' -gem 'carrierwave-mongoid', require: 'carrierwave/mongoid' gem 'simple_form' -gem 'newrelic_rpm' -gem 'octokit' -gem 'traceroute' -gem 'sass-rails' #, '~> 3.2.3' -gem 'coffee-rails'#, '~> 3.2.1' -gem 'uglifier'#, '>= 1.0.3' -gem 'jquery-rails' -gem 'font_awesome5_rails' -gem 'refinerycms-county_pages', :path => 'vendor/extensions' -gem 'rubocop-rails' -gem 'rubocop', '~> 1.23.0', require: false -gem 'browser' \ No newline at end of file +gem 'text' +gem 'traceroute' # Detect unused routes +gem 'tzinfo-data' # Required for Windows +gem 'unicode' +gem 'zip-zip' + +# ------------------------------------------------------------ +# Development & Test +# ------------------------------------------------------------ +group :development, :test do + gem 'factory_bot_rails' + gem 'mongoid-rspec' + gem 'pry' + gem 'pry-byebug' + gem 'rspec-rails' +end + +# ------------------------------------------------------------ +# Development Only +# ------------------------------------------------------------ +group :development do + gem "puma" + gem 'rubocop-rails' +end + +# ------------------------------------------------------------ +# Test Only +# ------------------------------------------------------------ +group :test do + gem "capybara" +end + +# Only load Gemfile.local if it exists +local_gemfile = File.join(__dir__, "Gemfile.local") +eval_gemfile(local_gemfile) if File.exist?(local_gemfile) diff --git a/Gemfile.lock b/Gemfile.lock index 3ca7408dc..b86f95db2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,17 +71,37 @@ GEM airbrake-ruby (5.1.1) rbtree3 (~> 0.5) arel (8.0.0) - ast (2.4.2) + ast (2.4.3) awesome_nested_set (3.2.1) activerecord (>= 4.0.0, < 7.0) babosa (1.0.4) + backport (1.2.0) bcrypt (3.1.16) + benchmark (0.5.0) + better_html (1.0.16) + actionview (>= 4.0) + activesupport (>= 4.0) + ast (~> 2.0) + erubi (~> 1.4) + html_tokenizer (~> 0.0.6) + parser (>= 2.4) + smart_properties + bindex (0.8.1) bourbon (7.0.0) thor (~> 1.0) browser (5.3.1) bson (4.11.1) - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) + capybara (3.39.2) + addressable + matrix + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) carrierwave (2.1.0) activemodel (>= 5.0.0) activesupport (>= 5.0.0) @@ -101,8 +121,15 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.7) + concurrent-ruby (1.3.5) crass (1.0.6) + database_cleaner-core (2.0.1) + database_cleaner-mongoid (2.0.1) + database_cleaner-core (~> 2.0.0) + mongoid + debug (1.11.0) + irb (~> 1.10) + reline (>= 0.3.8) decorators (2.0.5) railties (>= 4.0.0, < 7) devise (4.7.3) @@ -113,7 +140,7 @@ GEM warden (~> 1.2.3) devise-encryptable (0.2.0) devise (>= 2.1.0) - diff-lcs (1.4.4) + diff-lcs (1.6.2) diffy (3.4.0) dragonfly (1.2.1) addressable (~> 2.3) @@ -123,9 +150,26 @@ GEM dragonfly (~> 1.0) fog-aws email_veracity (0.6.0) - erubi (1.10.0) + erb-formatter (0.7.3) + syntax_tree (~> 6.0) + erb_lint (0.1.3) + activesupport + better_html (~> 1.0.7) + html_tokenizer + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties + erubi (1.13.1) excon (0.78.0) execjs (2.7.0) + factory_bot (6.4.5) + activesupport (>= 5.0.0) + factory_bot_rails (6.4.3) + factory_bot (~> 6.4) + railties (>= 5.0.0) + faker (2.2.1) + i18n (>= 0.8) faraday (1.1.0) multipart-post (>= 1.2, < 3) ruby2_keywords @@ -166,19 +210,26 @@ GEM gretel (4.2.0) actionview (>= 5.1, < 7.0) railties (>= 5.1, < 7.0) + html_tokenizer (0.0.8) i18n (0.9.5) concurrent-ruby (~> 1.0) image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) + io-console (0.8.1) ipaddress (0.8.3) + irb (1.15.3) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jaro_winkler (1.6.1) jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (5.0.5) railties (>= 3.2.16) - json (2.3.1) + json (2.15.1) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -194,14 +245,26 @@ GEM kaminari-mongoid (1.0.1) kaminari-core (~> 1.0) mongoid - loofah (2.8.0) + kramdown (2.5.1) + rexml (>= 3.3.9) + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + language_server-protocol (3.17.0.5) + launchy (2.5.0) + addressable (~> 2.7) + letter_opener (1.10.0) + launchy (>= 2.2, < 4) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.1) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.7.1) mini_mime (>= 0.1.1) mail-logger (0.0.4) mail - method_source (1.0.0) + matrix (0.4.3) + method_source (1.1.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2020.1104) @@ -210,8 +273,8 @@ GEM rake mini_magick (4.11.0) mini_mime (1.0.2) - mini_portile2 (2.8.0) - minitest (5.14.2) + mini_portile2 (2.8.9) + minitest (5.26.0) mobileesp_converted (0.2.3) mobvious (0.3.2) mobileesp_converted (~> 0.2.0) @@ -221,38 +284,55 @@ GEM mongoid (7.1.5) activemodel (>= 5.1, < 6.1) mongo (>= 2.7.0, < 3.0.0) + mongoid-compatibility (1.0.0) + activesupport + mongoid (>= 2.0) mongoid-grid_fs (2.4.0) mime-types (>= 1.0, < 4.0) mongoid (>= 3.0, < 8.0) + mongoid-rspec (4.2.0) + mongoid (>= 3.0, < 10.0) + mongoid-compatibility (>= 0.5.1) multi_json (1.15.0) multipart-post (2.1.1) mysql2 (0.5.3) mysql2 (0.5.3-x64-mingw32) newrelic_rpm (6.14.0) nio4r (2.5.4) - nokogiri (1.13.6) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.7) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.13.6-x64-mingw32) + nokogiri (1.15.7-x64-mingw32) racc (~> 1.4) + observer (0.1.2) octokit (4.19.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) orm_adapter (0.5.0) - parallel (1.21.0) - parser (3.0.3.2) + ostruct (0.6.3) + parallel (1.27.0) + parser (3.3.9.0) ast (~> 2.4.1) + racc + pp (0.6.3) + prettyprint + prettier_print (1.2.1) + prettyprint (0.2.0) + prism (1.5.2) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) + psych (3.3.4) public_suffix (4.0.6) - racc (1.6.0) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) + puma (6.6.1) + nio4r (~> 2.0) + racc (1.8.1) + rack (2.2.20) + rack-test (2.2.0) + rack (>= 1.3) rails (5.1.7) actioncable (= 5.1.7) actionmailer (= 5.1.7) @@ -265,11 +345,13 @@ GEM bundler (>= 1.3.0) railties (= 5.1.7) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails-i18n (5.0.4) i18n (~> 0.7) railties (~> 5.0) @@ -279,12 +361,14 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (3.0.0) - rake (13.0.1) + rainbow (3.1.1) + rake (13.3.0) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) + rbs (3.1.3) rbtree3 (0.6.0) + rdoc (6.3.4.1) refinerycms (4.0.3) refinerycms-core (= 4.0.3) refinerycms-images (= 4.0.3) @@ -337,53 +421,73 @@ GEM refinerycms-dragonfly (~> 1.0) refinerycms-wymeditor (2.2.0) refinerycms-core (>= 4.0.0, < 5.0) - regexp_parser (2.2.0) + regexp_parser (2.11.3) + reline (0.6.3) + io-console (~> 0.5) request_store (1.5.0) rack (>= 1.4) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) - rexml (3.2.5) + reverse_markdown (3.0.0) + nokogiri + rexml (3.4.4) routing-filter (0.6.3) actionpack (>= 4.2) activesupport (>= 4.2) - rspec-core (3.10.0) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.0) + rspec-core (3.13.5) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-rails (4.0.1) + rspec-support (~> 3.13.0) + rspec-rails (4.1.2) actionpack (>= 4.2) activesupport (>= 4.2) railties (>= 4.2) - rspec-core (~> 3.9) - rspec-expectations (~> 3.9) - rspec-mocks (~> 3.9) - rspec-support (~> 3.9) - rspec-support (3.10.0) - rubocop (1.23.0) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.13.6) + rubocop (1.81.1) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.15.0) - parser (>= 3.0.1.1) - rubocop-rails (2.12.4) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.47.1) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-capybara (2.22.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.33.4) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - ruby-progressbar (1.11.0) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rspec (3.8.0) + lint_roller (~> 1.1) + rubocop (~> 1.81) + ruby-progressbar (1.13.0) ruby-vips (2.0.17) ffi (~> 1.9) ruby2_keywords (0.0.2) rubyzip (2.3.0) + rufo (0.17.1) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -400,9 +504,31 @@ GEM faraday (> 0.8, < 2.0) seo_meta (3.0.0) railties (>= 5.0.0) + shoulda-matchers (4.5.1) + activesupport (>= 4.2.0) simple_form (5.0.3) actionpack (>= 5.0) activemodel (>= 5.0) + smart_properties (1.17.0) + solargraph (0.52.0) + backport (~> 1.2) + benchmark + bundler (~> 2.0) + diff-lcs (~> 1.4) + jaro_winkler (~> 1.6) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.1) + logger (~> 1.6) + observer (~> 0.1) + ostruct (~> 0.6) + parser (~> 3.0) + rbs (~> 3.0) + reverse_markdown (>= 2.0, < 4) + rubocop (~> 1.38) + thor (~> 1.0) + tilt (~> 2.0) + yard (~> 0.9, >= 0.9.24) + yard-solargraph (~> 0.1) speakingurl-rails (8.0.2) railties (>= 3.1) sprockets (3.7.2) @@ -412,27 +538,43 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + syntax_tree (6.3.0) + prettier_print (>= 1.2.0) text (1.3.1) - thor (1.0.1) + thor (1.4.0) thread_safe (0.3.6) tilt (2.0.10) traceroute (0.8.1) rails (>= 3.0.0) truncate_html (0.9.3) - tzinfo (1.2.8) + tzinfo (1.2.11) thread_safe (~> 0.1) tzinfo-data (1.2020.4) tzinfo (>= 1.0.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode (0.4.4.4) - unicode-display_width (2.1.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) warden (1.2.9) rack (>= 2.0.9) + web-console (3.7.0) + actionview (>= 5.0) + activemodel (>= 5.0) + bindex (>= 0.4.0) + railties (>= 5.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) will_paginate (3.3.0) + xpath (3.2.0) + nokogiri (~> 1.8) + xray-rails (0.3.3) + rails (>= 3.1.0) + yard (0.9.37) + yard-solargraph (0.1.0) + yard (~> 0.9) zilch-authorisation (0.0.1) zip-zip (0.3) rubyzip (>= 1.0.0) @@ -446,12 +588,19 @@ DEPENDENCIES bcrypt bourbon browser + capybara carrierwave-mongoid coffee-rails + database_cleaner-mongoid + debug devise devise-encryptable email_veracity + erb-formatter + erb_lint execjs + factory_bot_rails + faker font_awesome5_rails formtastic geocoder (= 1.3.7) @@ -460,34 +609,45 @@ DEPENDENCIES json kaminari kaminari-mongoid + letter_opener mail-logger mobvious mongo mongoid + mongoid-rspec mysql2 newrelic_rpm - nokogiri (>= 1.13.6) + nokogiri (~> 1.15.0) octokit osgb! pry pry-byebug - rails + psych (~> 3.3.0) + puma + rails (= 5.1.7) refinerycms refinerycms-authentication-devise refinerycms-county_pages! refinerycms-i18n (= 4.0.2)! refinerycms-wymeditor rspec-rails - rubocop (~> 1.23.0) + rubocop-capybara + rubocop-performance rubocop-rails + rubocop-rspec rubyzip + rufo sass-rails + shoulda-matchers simple_form + solargraph text traceroute tzinfo-data uglifier unicode + web-console + xray-rails zip-zip BUNDLED WITH diff --git a/spec/factories/image_dirs.rb b/doc/old_test_files/spec/factories/image_dirs.rb similarity index 100% rename from spec/factories/image_dirs.rb rename to doc/old_test_files/spec/factories/image_dirs.rb diff --git a/spec/factories/image_files.rb b/doc/old_test_files/spec/factories/image_files.rb similarity index 100% rename from spec/factories/image_files.rb rename to doc/old_test_files/spec/factories/image_files.rb diff --git a/spec/factories/image_upload_logs.rb b/doc/old_test_files/spec/factories/image_upload_logs.rb similarity index 100% rename from spec/factories/image_upload_logs.rb rename to doc/old_test_files/spec/factories/image_upload_logs.rb diff --git a/spec/factories/image_uploads.rb b/doc/old_test_files/spec/factories/image_uploads.rb similarity index 100% rename from spec/factories/image_uploads.rb rename to doc/old_test_files/spec/factories/image_uploads.rb diff --git a/spec/models/assignment_spec.rb b/doc/old_test_files/spec/models/assignment_spec.rb similarity index 100% rename from spec/models/assignment_spec.rb rename to doc/old_test_files/spec/models/assignment_spec.rb diff --git a/spec/models/emendation_rule_spec.rb b/doc/old_test_files/spec/models/emendation_rule_spec.rb similarity index 100% rename from spec/models/emendation_rule_spec.rb rename to doc/old_test_files/spec/models/emendation_rule_spec.rb diff --git a/spec/models/emendation_type_spec.rb b/doc/old_test_files/spec/models/emendation_type_spec.rb similarity index 100% rename from spec/models/emendation_type_spec.rb rename to doc/old_test_files/spec/models/emendation_type_spec.rb diff --git a/spec/models/feedback_spec.rb b/doc/old_test_files/spec/models/feedback_spec.rb similarity index 100% rename from spec/models/feedback_spec.rb rename to doc/old_test_files/spec/models/feedback_spec.rb diff --git a/spec/models/freecen1_fixed_dat_entry_spec.rb b/doc/old_test_files/spec/models/freecen1_fixed_dat_entry_spec.rb similarity index 100% rename from spec/models/freecen1_fixed_dat_entry_spec.rb rename to doc/old_test_files/spec/models/freecen1_fixed_dat_entry_spec.rb diff --git a/spec/models/freecen1_fixed_dat_file_spec.rb b/doc/old_test_files/spec/models/freecen1_fixed_dat_file_spec.rb similarity index 100% rename from spec/models/freecen1_fixed_dat_file_spec.rb rename to doc/old_test_files/spec/models/freecen1_fixed_dat_file_spec.rb diff --git a/spec/models/freecen1_vld_entry_spec.rb b/doc/old_test_files/spec/models/freecen1_vld_entry_spec.rb similarity index 100% rename from spec/models/freecen1_vld_entry_spec.rb rename to doc/old_test_files/spec/models/freecen1_vld_entry_spec.rb diff --git a/spec/models/freecen1_vld_file_spec.rb b/doc/old_test_files/spec/models/freecen1_vld_file_spec.rb similarity index 100% rename from spec/models/freecen1_vld_file_spec.rb rename to doc/old_test_files/spec/models/freecen1_vld_file_spec.rb diff --git a/spec/models/freecen_dwelling_spec.rb b/doc/old_test_files/spec/models/freecen_dwelling_spec.rb similarity index 100% rename from spec/models/freecen_dwelling_spec.rb rename to doc/old_test_files/spec/models/freecen_dwelling_spec.rb diff --git a/spec/models/freecen_individual_spec.rb b/doc/old_test_files/spec/models/freecen_individual_spec.rb similarity index 100% rename from spec/models/freecen_individual_spec.rb rename to doc/old_test_files/spec/models/freecen_individual_spec.rb diff --git a/spec/models/freecen_piece_spec.rb b/doc/old_test_files/spec/models/freecen_piece_spec.rb similarity index 100% rename from spec/models/freecen_piece_spec.rb rename to doc/old_test_files/spec/models/freecen_piece_spec.rb diff --git a/spec/models/freecen_utility_spec.rb b/doc/old_test_files/spec/models/freecen_utility_spec.rb similarity index 100% rename from spec/models/freecen_utility_spec.rb rename to doc/old_test_files/spec/models/freecen_utility_spec.rb diff --git a/spec/models/freereg1_csv_entry_spec.rb b/doc/old_test_files/spec/models/freereg1_csv_entry_spec.rb similarity index 100% rename from spec/models/freereg1_csv_entry_spec.rb rename to doc/old_test_files/spec/models/freereg1_csv_entry_spec.rb diff --git a/spec/models/freereg1_csv_file_kirk_spec.rb b/doc/old_test_files/spec/models/freereg1_csv_file_kirk_spec.rb similarity index 100% rename from spec/models/freereg1_csv_file_kirk_spec.rb rename to doc/old_test_files/spec/models/freereg1_csv_file_kirk_spec.rb diff --git a/spec/models/freereg1_csv_file_spec.rb b/doc/old_test_files/spec/models/freereg1_csv_file_spec.rb similarity index 100% rename from spec/models/freereg1_csv_file_spec.rb rename to doc/old_test_files/spec/models/freereg1_csv_file_spec.rb diff --git a/spec/models/freereg1_translator_spec.rb b/doc/old_test_files/spec/models/freereg1_translator_spec.rb similarity index 100% rename from spec/models/freereg1_translator_spec.rb rename to doc/old_test_files/spec/models/freereg1_translator_spec.rb diff --git a/spec/models/freereg_content_spec.rb b/doc/old_test_files/spec/models/freereg_content_spec.rb similarity index 100% rename from spec/models/freereg_content_spec.rb rename to doc/old_test_files/spec/models/freereg_content_spec.rb diff --git a/spec/models/gap_spec.rb b/doc/old_test_files/spec/models/gap_spec.rb similarity index 100% rename from spec/models/gap_spec.rb rename to doc/old_test_files/spec/models/gap_spec.rb diff --git a/spec/models/image_file_spec.rb b/doc/old_test_files/spec/models/image_file_spec.rb similarity index 100% rename from spec/models/image_file_spec.rb rename to doc/old_test_files/spec/models/image_file_spec.rb diff --git a/spec/models/image_upload_log_spec.rb b/doc/old_test_files/spec/models/image_upload_log_spec.rb similarity index 100% rename from spec/models/image_upload_log_spec.rb rename to doc/old_test_files/spec/models/image_upload_log_spec.rb diff --git a/spec/models/image_upload_spec.rb b/doc/old_test_files/spec/models/image_upload_spec.rb similarity index 100% rename from spec/models/image_upload_spec.rb rename to doc/old_test_files/spec/models/image_upload_spec.rb diff --git a/spec/models/manage_county_spec.rb b/doc/old_test_files/spec/models/manage_county_spec.rb similarity index 100% rename from spec/models/manage_county_spec.rb rename to doc/old_test_files/spec/models/manage_county_spec.rb diff --git a/spec/models/page_image_spec.rb b/doc/old_test_files/spec/models/page_image_spec.rb similarity index 100% rename from spec/models/page_image_spec.rb rename to doc/old_test_files/spec/models/page_image_spec.rb diff --git a/spec/models/page_spec.rb b/doc/old_test_files/spec/models/page_spec.rb similarity index 100% rename from spec/models/page_spec.rb rename to doc/old_test_files/spec/models/page_spec.rb diff --git a/spec/models/place_cache_spec.rb b/doc/old_test_files/spec/models/place_cache_spec.rb similarity index 100% rename from spec/models/place_cache_spec.rb rename to doc/old_test_files/spec/models/place_cache_spec.rb diff --git a/spec/models/place_spec.rb b/doc/old_test_files/spec/models/place_spec.rb similarity index 100% rename from spec/models/place_spec.rb rename to doc/old_test_files/spec/models/place_spec.rb diff --git a/spec/models/s3bucket_spec.rb b/doc/old_test_files/spec/models/s3bucket_spec.rb similarity index 100% rename from spec/models/s3bucket_spec.rb rename to doc/old_test_files/spec/models/s3bucket_spec.rb diff --git a/spec/models/sample_people.rb b/doc/old_test_files/spec/models/sample_people.rb similarity index 100% rename from spec/models/sample_people.rb rename to doc/old_test_files/spec/models/sample_people.rb diff --git a/spec/models/search_query_spec.rb b/doc/old_test_files/spec/models/search_query_spec.rb similarity index 100% rename from spec/models/search_query_spec.rb rename to doc/old_test_files/spec/models/search_query_spec.rb diff --git a/spec/models/search_record_spec.rb b/doc/old_test_files/spec/models/search_record_spec.rb similarity index 100% rename from spec/models/search_record_spec.rb rename to doc/old_test_files/spec/models/search_record_spec.rb diff --git a/spec/models/search_statistic_spec.rb b/doc/old_test_files/spec/models/search_statistic_spec.rb similarity index 100% rename from spec/models/search_statistic_spec.rb rename to doc/old_test_files/spec/models/search_statistic_spec.rb diff --git a/spec/models/site_statistic_spec.rb b/doc/old_test_files/spec/models/site_statistic_spec.rb similarity index 100% rename from spec/models/site_statistic_spec.rb rename to doc/old_test_files/spec/models/site_statistic_spec.rb diff --git a/spec/models/source_spec.rb b/doc/old_test_files/spec/models/source_spec.rb similarity index 100% rename from spec/models/source_spec.rb rename to doc/old_test_files/spec/models/source_spec.rb diff --git a/spec/models/userid_detail_spec.rb b/doc/old_test_files/spec/models/userid_detail_spec.rb similarity index 100% rename from spec/models/userid_detail_spec.rb rename to doc/old_test_files/spec/models/userid_detail_spec.rb diff --git a/doc/old_test_files/spec/spec_helper.rb b/doc/old_test_files/spec/spec_helper.rb new file mode 100644 index 000000000..e87b07c07 --- /dev/null +++ b/doc/old_test_files/spec/spec_helper.rb @@ -0,0 +1,601 @@ +# Copyright 2012 Trustees of FreeBMD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' +#require 'rspec/autorun' + +require 'record_type' + +require 'new_freereg_csv_update_processor' + +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} + +RSpec.configure do |config| + # ## Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + config.color = true + + # 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 = true + + # If true, the base class of anonymous controllers will be inferred + # automatically. This will be the default behavior in future versions of + # rspec-rails. + + config.infer_base_class_for_anonymous_controllers = false +end + +def clean_freereg1_csv_file_document(file) + Freereg1CsvFile.file_name(file[:file]).userid(file[:user]).delete +end +def clean_database + PhysicalFile.delete_all + AtticFile.delete_all + SearchRecord.delete_all + Freereg1CsvEntry.delete_all + Freereg1CsvFile.delete_all + Register.delete_all + Church.delete_all + Place.delete_all +end + + +def create_stub_church(file) + place = Place.where(:place_name => file[:placename], :chapman_code => file[:chapman_code]).first + church = Church.where(:place_id => place.id,:church_name => file[:churchname]).first + if !church + church = Church.create!(:church_name => file[:churchname]) + place.churches << church + place.save! + end + church +end + +def create_stub_place(file) + # create stub place + place = Place.where(:place_name => file[:placename], :chapman_code => file[:chapman_code]).first + place.approve if place.present? + unless place + place = Place.create!(:place_name => file[:placename], :chapman_code => file[:chapman_code], :latitude => 60, :longitude => 0, :modified_place_name => file[:placename].gsub(/-/, " ").gsub(/\./, "").gsub(/\'/, "").downcase) + place.approve + place.save! + end + place +end + +def create_stub_userid(file) + # create_stub user + username = file[:user] + userid = UseridDetail.userid(username).first + unless userid + u = Refinery::Authentication::Devise::User.where(:username => username).first + u.delete unless u.nil? + userid = UseridDetail.create!(:userid=>username, :password=>username, :email_address=>"#{username}@example.com", :person_surname => username, :person_forename => username, :syndicate => 'test') + end + userid +end + +def create_new_user(username) + userid = UseridDetail.userid(username).first + unless userid + u = Refinery::Authentication::Devise::User.where(:username => username).first + u.delete unless u.nil? + userid = UseridDetail.create!(:userid=>username, :password=>username, :email_address=>"#{username}@example.com", :person_surname => username, :person_forename => username, :syndicate => 'test') + end + folder_location = create_stub_userid_folder(username) + return userid,folder_location +end + +def create_stub_userid_folder(username) + folder_location = File.join(Rails.application.config.datafiles,username) + Dir.mkdir(folder_location,0774) unless Dir.exist?(folder_location) + folder_location +end + +def get_line + processing_file = Rails.application.config.delete_list + line = File.open(processing_file, &:readline) +end + + +def process_test_file(file) + userid = create_stub_userid(file) + place = create_stub_place(file) + church = create_stub_church(file) + Rails.application.config.datafiles = file[:basedir] + NewFreeregCsvUpdateProcessor.activate_project('create_search_records','individual','force_rebuild',file[:filename]) + freereg1_csv_file = Freereg1CsvFile.userid(file[:user]).file_name(file[:file]).first +end + + +def setup_userids + Dir.glob(File.join(Rails.root, 'test_data', 'freereg1_csvs', '*')). + map{|fn| File.basename(fn)}. + each{|uid| UseridDetail.create!(:userid => uid, :password => uid, :encrypted_password => uid, :email_address => "#{uid}@example.com", :person_surname => uid, :person_forename => uid, :syndicate => 'test') unless UseridDetail.where(:userid => uid).first} +end + +def set_up_new_location(file) + register = file.register + church = register.church + place = church.place + sess = {} + par ={} + sess[:selectcountry] = file.country + sess[:selectcounty] = file.county + sess[:selectplace] = place.id + sess[:selectchurch] = church.id + par[:register_type] = file.register_type + return par,sess +end + +def write_new_copy(user,file_name) + #this is used to replace the removed file + userid = UseridDetail.userid(user).first + file = AtticFile.userid(userid.id).first + folder = create_stub_userid_folder(user) + new_file = File.join(folder,file_name) + old_file = File.join(Rails.application.config.datafiles,user,".attic",file.name) + File.rename(old_file,new_file) +end + +FREEREG1_CSV_FILES = [ + { + :filename => "kirknorfolk/NFKALEBU.csv", + :file => "NFKALEBU.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :type => RecordType::BURIAL, + :user => 'kirknorfolk', + :chapman_code => 'NFK', + :placename => 'Aldeby', + :churchname => 'St Mary', + :register_type => "BT", + :minimum_date => "1690", + :maximum_date => "1698", + :entry_count => 15, + :entries => { + :first => { + :line_id => "kirknorfolk.NFKALEBU.CSV.1", + :burial_person_forename => 'Will', + :burial_person_surname => 'SADD', + :burial_date => '6 Mar 1690/1', + :modern_year => 1691 + }, + :last => { + :line_id => "kirknorfolk.NFKALEBU.CSV.15", + :burial_person_forename => 'Robert', + :burial_person_surname => 'LONDON', + :burial_date => '7 Nov 1691', + :modern_year => 1691 + } + } + }, + { + :filename => "kirkbedfordshire/BDFYIEBA.CSV", + :file => "BDFYIEBA.CSV", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :type => RecordType::BAPTISM, + :user => 'kirkbedfordshire', + :chapman_code => 'BDF', + :placename => 'Yielden', + :churchname => 'St Fictional', + :entry_count => 1223, + :register_type => "PR", + :minimum_date => "1602", + :maximum_date => "1812", + :entries => { + :first => { + :line_id => "kirkbedfordshire.BDFYIEBA.CSV.1", + :baptism_date => '30 Aug 1602', + :person_forename => 'Paul', + :person_sex => 'M', + :father_forename => 'Thomas', + :father_surname => 'MAXEE', + :modern_year => 1602 + }, + :last => { + :line_id => "kirkbedfordshire.BDFYIEBA.CSV.1223", + :baptism_date => '19 Oct 1812', + :person_forename => 'Elizabeth', + :mother_forename => 'Susan', + :person_sex => 'F', + :father_surname => 'CHARLES', + :father_forename => 'Joseph', + :modern_year => 1812 + } + } + }, + { + # :filename => "/home/benwbrum/dev/clients/freeukgen/scratch/Chd/HRTCALMA.csv", + # :basedir => "/home/benwbrum/dev/clients/freeukgen/scratch/", + :filename => "Chd/HRTCALMA.csv", + :file => "HRTCALMA.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :type => RecordType::MARRIAGE, + :user => 'Chd', + :chapman_code => 'HRT', + :placename => 'Caldecote', + :churchname => 'St Mary Magdalene', + :entry_count => 45, + :register_type => "AT", + :minimum_date => "1726", + :maximum_date => "1837", + :entries => { + :first => { + :line_id => "Chd.HRTCALMA.CSV.1", + :marriage_date => '4 Oct 1726', + :bride_surname => 'CANNON', + :bride_forename => 'Sarah', + :groom_surname => 'SAUNDERS', + :groom_forename => 'William', + :modern_year => 1726 + }, + :last => { + :line_id => "Chd.HRTCALMA.CSV.45", + :marriage_date => '12 Oct 1837', + :bride_surname => 'GARRATT', + :bride_forename => 'Anne', + :groom_surname => 'CLARKE', + :groom_forename => 'Charles', + :modern_year => 1837, + :witnesses => [ + { :first_name => 'William', :last_name => 'CLARKE'}, + { :first_name => 'Mary', :last_name => 'GARRATT'} + ] + } + } + }, + { + :filename => "Devonian/DEVLANBU.CSV", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "DEVLANBU.CSV", + :type => RecordType::BURIAL, + :user => 'Devonian', + :chapman_code => 'DEV', + :placename => 'Landcross', + :churchname => 'Holy Trinity', + :entry_count => 128, + :register_type => "PR", + :minimum_date => "1594", + :maximum_date => "1811", + :entries => { + :first => { + :line_id => "Devonian.DEVLANBU.CSV.1", + :burial_person_forename => 'John', + :relative_surname => 'NORTHWAY', + :burial_date => '7 Dec 1802', + :modern_year => 1802 + }, # add problem entry here + :last => { + :line_id => "Devonian.DEVLANBU.CSV.128", + :burial_person_forename => 'Richardus', + :burial_person_surname => 'OXENHAM', + :burial_date => '13 Mar 1693/4', + :modern_year => 1694 + } + } + }, + { + :filename => "Chd/HRTWILMA.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "HRTWILMA.csv", + :type => RecordType::MARRIAGE, + :user => 'Chd', + :chapman_code => 'HRT', + :placename => 'Willian', + :churchname => 'All Saints', + :entry_count => 545, + :register_type => "EX", + :minimum_date => "1559", + :maximum_date => "1911", + :entries => { + :first => { + :line_id => "Chd.HRTWILMA.csv.1", + :marriage_date => '8 Oct 1559', + :bride_surname => 'CHATTERTON', + :bride_forename => 'Margerie', + :groom_surname => 'BUCKMASTER', + :groom_forename => 'Thomas', + :modern_year => 1559 + }, + :last => { + :line_id => "Chd.HRTWILMA.csv.545", + :marriage_date => '11 Nov 1911', + :bride_surname => 'SWAIN', + :bride_forename => 'Bessie Malinda', + :groom_surname => 'BROWN', + :groom_forename => 'Percy', + :bride_father_surname => 'SWAIN', + :bride_father_forename => 'Thomas', + :groom_father_surname => 'BROWN', + :groom_father_forename => 'Charles', + :modern_year => 1911 + } + } +}] + + +ARTIFICIAL_FILES = [ + { + :filename => "artificial/double_latinization.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "double_latinization.csv", + :chapman_code => 'NTH', + :placename => 'Gretton', + :churchname => 'St James', + :entry_count => 1, + :register_type => "PR", + :minimum_date => "1798", + :maximum_date => "1798", + :user => 'artificial' + }, + { + :filename => "artificial/multiple_expansions.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "multiple_expansions.csv", + :chapman_code => 'LEI', + :placename => 'Belton', + :churchname => 'St John The Baptist', + :entry_count => 1, + :register_type => "DW", + :minimum_date => "1739", + :maximum_date => "1739", + :user => 'artificial' + } +] + +EMENDATION_FILES = [ + { + :filename => "artificial/double_latinization.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "double_latinization.csv", + :entry_count => 1, + :register_type => "PR", + :minimum_date => "1798", + :maximum_date => "1798", + :user => 'artificial' + }, + { + :filename => "artificial/multiple_expansions.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "multiple_expansions.csv", + :entry_count => 1, + :register_type => "DW", + :minimum_date => "1739", + :maximum_date => "1739", + :user => 'artificial' + } +] + +NO_BAPTISMAL_NAME = +{ + :filename => "BobChown/KENSTIBA1.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/", + :file => "KENSTIBA1.csv", + :chapman_code => 'KEN', + :placename => 'Stone in Oxney', + :churchname => 'St Mary', + :entry_count => 1, + :register_type => "TR", + :minimum_date => "1553", + :maximum_date => "1553", + :user => 'BobChown' +} + +NO_BURIAL_FORENAME = +{ + :filename => "1boy7girls/LINBEEBU.CSV", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/", + :file => "LINBEEBU.CSV", + :chapman_code => 'LIN', + :placename => 'Beelsby', + :churchname => 'St Andrew', + :entry_count => 2, + :register_type => "PR", + :minimum_date => "1935", + :maximum_date => "1935", + :user => '1boy7girls' +} + +NO_RELATIVE_SURNAME = +{ + :filename => "brilyn/NFKWYMBU.CSV", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/", + :file => "NFKWYMBU.CSV", + :chapman_code => 'NFK', + :placename => 'Wymondham', + :churchname => "Virgin Mary And St Thomas A Becket", + :entry_count => 1, + :register_type => "AT", + :minimum_date => "1781", + :maximum_date => "1781", + :user => 'brilyn' +} + + +SQUARE_BRACE_UCF = +{ + :filename => "artificial/ucf_nostar.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "ucf_nostar.csv", + :chapman_code => 'NTH', + :placename => 'Gretton', + :churchname => "St James", + :entry_count => 17, + :register_type => "", + :minimum_date => "1798", + :maximum_date => "1798", + :user => 'artificial' +} + +WILDCARD_UCF = +{ + :filename => "artificial/ucf_star.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "ucf_star.csv", + :chapman_code => 'SOM', + :placename => 'Runnington', + :churchname => 'St Peter', + :entry_count => 8, + :register_type => "", + :minimum_date => "1734", + :maximum_date => "1798", + :user => 'artificial' +} + +BAPTISM_BIRTH = +{ + :filename => "artificial/birth_date_ba.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "birth_date_ba.csv", + :chapman_code => 'KEN', + :placename => 'Stone in Oxney', + :churchname => 'St Mary', + :entry_count => 1, + :register_type => "TR", + :minimum_date => "1553", + :maximum_date => "1653", + :user => 'artificial' +} + +WILDCARD_DATES = +{ + :filename => "artificial/unclear_date_ba.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "unclear_date_ba.csv", + :chapman_code => 'KEN', + :placename => 'Stone in Oxney', + :churchname => 'St Mary', + :entry_count => 1, + :register_type => "TR", + :minimum_date => "1653", + :maximum_date => "1653", + :user => 'artificial' +} +CHANGELESS_FILE = +{ + :filename => "jelit/SSXSESBU.CSV", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "SSXSESBU.CSV", + :chapman_code => 'SSX', + :placename => 'Selsey', + :churchname => 'St Peter', + :entry_count => 835, + :register_type => "PR", + :minimum_date => "1813", + :maximum_date => "1866", + :user => 'jelit' +} + + + + +DELTA_FILES = [ + { + :filename => "artificial/deltas/v1/kirknorfolk/NFKALEBU.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/deltas/v1/", + :file => "NFKALEBU.csv", + :chapman_code => 'NFK', + :placename => 'Aldeby', + :churchname => 'St Mary', + :entry_count => 15, + :register_type => "BT", + :minimum_date => "1690", + :maximum_date => "1691", + :user => 'kirknorfolk' + }, + { + :filename => "artificial/deltas/v2/kirknorfolk/NFKALEBU.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/deltas/v2/", + :file => "NFKALEBU.csv", + :chapman_code => 'NFK', + :placename => 'Aldeby', + :churchname => 'St Mary', + :entry_count => 15, + :register_type => "BT", + :minimum_date => "1690", + :maximum_date => "1691", + :user => 'kirknorfolk' + }, + { + :filename => "artificial/deltas/v3/kirknorfolk/NFKALEBU.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/deltas/v3/", + :file => "NFKALEBU.csv", + :chapman_code => 'NFK', + :placename => 'Aldeby', + :churchname => 'St Mary', + :entry_count => 15, + :register_type => "BT", + :minimum_date => "1690", + :maximum_date => "1691", + :user => 'kirknorfolk' + } +] + + +EMBARGO_FILES = [ + { + :filename => "artificial/embargoed_baptism.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "embargoed_baptism.csv", + :chapman_code => 'NFK', + :placename => 'Norwich', + :churchname => 'Octagon Unitarian Chapel', + :entry_count => 2, + :register_type => "", + :minimum_date => "1691", + :maximum_date => "1941", + :user => 'artificial' + }, + { + :filename => "artificial/embargoed_marriage.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "embargoed_marriage.csv", + :chapman_code => 'LIN', + :placename => 'Great Hale', + :churchname => 'St John', + :entry_count => 2, + :register_type => "", + :minimum_date => "1915", + :maximum_date => "1949", + :user => 'artificial' + }, + { + :filename => "artificial/embargoed_burial.csv", + :basedir => "#{Rails.root}/test_data/freereg1_csvs/", + :file => "embargoed_burial.csv", + :chapman_code => 'NFK', + :placename => 'Ingham', + :churchname => 'St John', + :entry_count => 2, + :register_type => "AT", + :minimum_date => "1726", + :maximum_date => "2014", + :user => 'artificial' + } +] diff --git a/test/performance/browsing_test.rb b/doc/old_test_files/test/performance/browsing_test.rb similarity index 100% rename from test/performance/browsing_test.rb rename to doc/old_test_files/test/performance/browsing_test.rb diff --git a/test/test_helper.rb b/doc/old_test_files/test/test_helper.rb similarity index 100% rename from test/test_helper.rb rename to doc/old_test_files/test/test_helper.rb diff --git a/test_data/Place_and_church_name_resources/Gazetteer.csv b/doc/old_test_files/test_data/Place_and_church_name_resources/Gazetteer.csv similarity index 100% rename from test_data/Place_and_church_name_resources/Gazetteer.csv rename to doc/old_test_files/test_data/Place_and_church_name_resources/Gazetteer.csv diff --git a/test_data/Place_and_church_name_resources/places_from_public_domain_data.csv b/doc/old_test_files/test_data/Place_and_church_name_resources/places_from_public_domain_data.csv similarity index 100% rename from test_data/Place_and_church_name_resources/places_from_public_domain_data.csv rename to doc/old_test_files/test_data/Place_and_church_name_resources/places_from_public_domain_data.csv diff --git a/test_data/freecen1_dats/1841/CONPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1841/CONPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1841/CONPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1841/CONPARMS.DAT diff --git a/test_data/freecen1_dats/1851/CONPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1851/CONPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1851/CONPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1851/CONPARMS.DAT diff --git a/test_data/freecen1_dats/1861/CONPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1861/CONPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1861/CONPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1861/CONPARMS.DAT diff --git a/test_data/freecen1_dats/1861/DURPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1861/DURPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1861/DURPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1861/DURPARMS.DAT diff --git a/test_data/freecen1_dats/1871/CONPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1871/CONPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1871/CONPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1871/CONPARMS.DAT diff --git a/test_data/freecen1_dats/1871/DURPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1871/DURPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1871/DURPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1871/DURPARMS.DAT diff --git a/test_data/freecen1_dats/1881/CONPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1881/CONPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1881/CONPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1881/CONPARMS.DAT diff --git a/test_data/freecen1_dats/1891/CONPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1891/CONPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1891/CONPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1891/CONPARMS.DAT diff --git a/test_data/freecen1_dats/1891/DURPARMS.DAT b/doc/old_test_files/test_data/freecen1_dats/1891/DURPARMS.DAT similarity index 100% rename from test_data/freecen1_dats/1891/DURPARMS.DAT rename to doc/old_test_files/test_data/freecen1_dats/1891/DURPARMS.DAT diff --git a/test_data/freecen1_vlds/CON-Cornwall/RG102267.VLD b/doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/RG102267.VLD similarity index 100% rename from test_data/freecen1_vlds/CON-Cornwall/RG102267.VLD rename to doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/RG102267.VLD diff --git a/test_data/freecen1_vlds/CON-Cornwall/ho410133.vld b/doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/ho410133.vld similarity index 100% rename from test_data/freecen1_vlds/CON-Cornwall/ho410133.vld rename to doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/ho410133.vld diff --git a/test_data/freecen1_vlds/CON-Cornwall/ho410140.vld b/doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/ho410140.vld similarity index 100% rename from test_data/freecen1_vlds/CON-Cornwall/ho410140.vld rename to doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/ho410140.vld diff --git a/test_data/freecen1_vlds/CON-Cornwall/ho511906.vld b/doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/ho511906.vld similarity index 100% rename from test_data/freecen1_vlds/CON-Cornwall/ho511906.vld rename to doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/ho511906.vld diff --git a/test_data/freecen1_vlds/CON-Cornwall/rg091544.vld b/doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/rg091544.vld similarity index 100% rename from test_data/freecen1_vlds/CON-Cornwall/rg091544.vld rename to doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/rg091544.vld diff --git a/test_data/freecen1_vlds/CON-Cornwall/rg112275.vld b/doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/rg112275.vld similarity index 100% rename from test_data/freecen1_vlds/CON-Cornwall/rg112275.vld rename to doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/rg112275.vld diff --git a/test_data/freecen1_vlds/CON-Cornwall/rg121836.vld b/doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/rg121836.vld similarity index 100% rename from test_data/freecen1_vlds/CON-Cornwall/rg121836.vld rename to doc/old_test_files/test_data/freecen1_vlds/CON-Cornwall/rg121836.vld diff --git a/test_data/freecen1_vlds/DUR/RG093730.VLD b/doc/old_test_files/test_data/freecen1_vlds/DUR/RG093730.VLD similarity index 100% rename from test_data/freecen1_vlds/DUR/RG093730.VLD rename to doc/old_test_files/test_data/freecen1_vlds/DUR/RG093730.VLD diff --git a/test_data/freereg1_csvs/Chd/HRTCALBA.csv b/doc/old_test_files/test_data/freereg1_csvs/Chd/HRTCALBA.csv similarity index 100% rename from test_data/freereg1_csvs/Chd/HRTCALBA.csv rename to doc/old_test_files/test_data/freereg1_csvs/Chd/HRTCALBA.csv diff --git a/test_data/freereg1_csvs/Chd/HRTCALBU.csv b/doc/old_test_files/test_data/freereg1_csvs/Chd/HRTCALBU.csv similarity index 100% rename from test_data/freereg1_csvs/Chd/HRTCALBU.csv rename to doc/old_test_files/test_data/freereg1_csvs/Chd/HRTCALBU.csv diff --git a/test_data/freereg1_csvs/Chd/HRTCALMA.csv b/doc/old_test_files/test_data/freereg1_csvs/Chd/HRTCALMA.csv similarity index 100% rename from test_data/freereg1_csvs/Chd/HRTCALMA.csv rename to doc/old_test_files/test_data/freereg1_csvs/Chd/HRTCALMA.csv diff --git a/test_data/freereg1_csvs/Chd/HRTWILMA.csv b/doc/old_test_files/test_data/freereg1_csvs/Chd/HRTWILMA.csv similarity index 100% rename from test_data/freereg1_csvs/Chd/HRTWILMA.csv rename to doc/old_test_files/test_data/freereg1_csvs/Chd/HRTWILMA.csv diff --git a/test_data/freereg1_csvs/DSR/SOMRUNBA.CSV b/doc/old_test_files/test_data/freereg1_csvs/DSR/SOMRUNBA.CSV similarity index 100% rename from test_data/freereg1_csvs/DSR/SOMRUNBA.CSV rename to doc/old_test_files/test_data/freereg1_csvs/DSR/SOMRUNBA.CSV diff --git a/test_data/freereg1_csvs/Devonian/DEVLANBU.CSV b/doc/old_test_files/test_data/freereg1_csvs/Devonian/DEVLANBU.CSV similarity index 100% rename from test_data/freereg1_csvs/Devonian/DEVLANBU.CSV rename to doc/old_test_files/test_data/freereg1_csvs/Devonian/DEVLANBU.CSV diff --git a/test_data/freereg1_csvs/artificial/1boy7girls/LINBEEBU.CSV b/doc/old_test_files/test_data/freereg1_csvs/artificial/1boy7girls/LINBEEBU.CSV similarity index 100% rename from test_data/freereg1_csvs/artificial/1boy7girls/LINBEEBU.CSV rename to doc/old_test_files/test_data/freereg1_csvs/artificial/1boy7girls/LINBEEBU.CSV diff --git a/test_data/freereg1_csvs/artificial/BobChown/KENSTIBA1.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/BobChown/KENSTIBA1.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/BobChown/KENSTIBA1.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/BobChown/KENSTIBA1.csv diff --git a/test_data/freereg1_csvs/artificial/birth_date_ba.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/birth_date_ba.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/birth_date_ba.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/birth_date_ba.csv diff --git a/test_data/freereg1_csvs/artificial/brilyn/NFKWYMBU.CSV b/doc/old_test_files/test_data/freereg1_csvs/artificial/brilyn/NFKWYMBU.CSV similarity index 100% rename from test_data/freereg1_csvs/artificial/brilyn/NFKWYMBU.CSV rename to doc/old_test_files/test_data/freereg1_csvs/artificial/brilyn/NFKWYMBU.CSV diff --git a/test_data/freereg1_csvs/artificial/deltas/v1/kirknorfolk/NFKALEBU.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/deltas/v1/kirknorfolk/NFKALEBU.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/deltas/v1/kirknorfolk/NFKALEBU.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/deltas/v1/kirknorfolk/NFKALEBU.csv diff --git a/test_data/freereg1_csvs/artificial/deltas/v2/kirknorfolk/NFKALEBU.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/deltas/v2/kirknorfolk/NFKALEBU.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/deltas/v2/kirknorfolk/NFKALEBU.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/deltas/v2/kirknorfolk/NFKALEBU.csv diff --git a/test_data/freereg1_csvs/artificial/deltas/v3/kirknorfolk/NFKALEBU.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/deltas/v3/kirknorfolk/NFKALEBU.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/deltas/v3/kirknorfolk/NFKALEBU.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/deltas/v3/kirknorfolk/NFKALEBU.csv diff --git a/test_data/freereg1_csvs/artificial/double_latinization.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/double_latinization.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/double_latinization.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/double_latinization.csv diff --git a/test_data/freereg1_csvs/artificial/embargoed_baptism.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/embargoed_baptism.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/embargoed_baptism.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/embargoed_baptism.csv diff --git a/test_data/freereg1_csvs/artificial/embargoed_burial.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/embargoed_burial.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/embargoed_burial.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/embargoed_burial.csv diff --git a/test_data/freereg1_csvs/artificial/embargoed_marriage.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/embargoed_marriage.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/embargoed_marriage.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/embargoed_marriage.csv diff --git a/test_data/freereg1_csvs/artificial/multiple_expansions.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/multiple_expansions.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/multiple_expansions.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/multiple_expansions.csv diff --git a/test_data/freereg1_csvs/artificial/multiple_forenames.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/multiple_forenames.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/multiple_forenames.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/multiple_forenames.csv diff --git a/test_data/freereg1_csvs/artificial/ucf_nostar.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/ucf_nostar.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/ucf_nostar.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/ucf_nostar.csv diff --git a/test_data/freereg1_csvs/artificial/ucf_star.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/ucf_star.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/ucf_star.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/ucf_star.csv diff --git a/test_data/freereg1_csvs/artificial/unclear_date_ba.csv b/doc/old_test_files/test_data/freereg1_csvs/artificial/unclear_date_ba.csv similarity index 100% rename from test_data/freereg1_csvs/artificial/unclear_date_ba.csv rename to doc/old_test_files/test_data/freereg1_csvs/artificial/unclear_date_ba.csv diff --git a/test_data/freereg1_csvs/dates/SOMRUNBA.CSV b/doc/old_test_files/test_data/freereg1_csvs/dates/SOMRUNBA.CSV similarity index 100% rename from test_data/freereg1_csvs/dates/SOMRUNBA.CSV rename to doc/old_test_files/test_data/freereg1_csvs/dates/SOMRUNBA.CSV diff --git a/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBA.CSV b/doc/old_test_files/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBA.CSV similarity index 100% rename from test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBA.CSV rename to doc/old_test_files/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBA.CSV diff --git a/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBU.CSV b/doc/old_test_files/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBU.CSV similarity index 100% rename from test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBU.CSV rename to doc/old_test_files/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEBU.CSV diff --git a/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEMA.CSV b/doc/old_test_files/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEMA.CSV similarity index 100% rename from test_data/freereg1_csvs/kirkbedfordshire/BDFYIEMA.CSV rename to doc/old_test_files/test_data/freereg1_csvs/kirkbedfordshire/BDFYIEMA.CSV diff --git a/test_data/freereg1_csvs/kirknorfolk/NFKALEBU.csv b/doc/old_test_files/test_data/freereg1_csvs/kirknorfolk/NFKALEBU.csv similarity index 100% rename from test_data/freereg1_csvs/kirknorfolk/NFKALEBU.csv rename to doc/old_test_files/test_data/freereg1_csvs/kirknorfolk/NFKALEBU.csv diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNBA2.csv b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA2.csv similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNBA2.csv rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA2.csv diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNBA3.csv b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA3.csv similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNBA3.csv rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA3.csv diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNBA5.CSV b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA5.CSV similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNBA5.CSV rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA5.CSV diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNBA6.CSV b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA6.CSV similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNBA6.CSV rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBA6.CSV diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNBU2.csv b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBU2.csv similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNBU2.csv rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBU2.csv diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNBU3.csv b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBU3.csv similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNBU3.csv rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBU3.csv diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNBU5.CSV b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBU5.CSV similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNBU5.CSV rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNBU5.CSV diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNMA2.csv b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNMA2.csv similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNMA2.csv rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNMA2.csv diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNMA3.csv b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNMA3.csv similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNMA3.csv rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNMA3.csv diff --git a/test_data/freereg1_csvs/place_creation/SOMMSNMA5.CSV b/doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNMA5.CSV similarity index 100% rename from test_data/freereg1_csvs/place_creation/SOMMSNMA5.CSV rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/SOMMSNMA5.CSV diff --git a/test_data/freereg1_csvs/place_creation/behavior.txt b/doc/old_test_files/test_data/freereg1_csvs/place_creation/behavior.txt similarity index 100% rename from test_data/freereg1_csvs/place_creation/behavior.txt rename to doc/old_test_files/test_data/freereg1_csvs/place_creation/behavior.txt diff --git a/test_data/mvuploads/heterogenoustest/4011569_00930.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4011569_00930.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4011569_00930.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4011569_00930.jpg diff --git a/test_data/mvuploads/heterogenoustest/4034126_00391.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4034126_00391.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4034126_00391.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4034126_00391.jpg diff --git a/test_data/mvuploads/heterogenoustest/4034127_00102.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4034127_00102.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4034127_00102.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4034127_00102.jpg diff --git a/test_data/mvuploads/heterogenoustest/4034130_00057.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4034130_00057.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4034130_00057.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4034130_00057.jpg diff --git a/test_data/mvuploads/heterogenoustest/4115449_00415.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4115449_00415.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4115449_00415.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4115449_00415.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_00517.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00517.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_00517.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00517.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_00564.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00564.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_00564.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00564.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_00584.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00584.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_00584.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00584.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_00694.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00694.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_00694.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00694.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_00836.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00836.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_00836.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00836.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_00886.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00886.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_00886.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_00886.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_01091.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_01091.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_01091.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_01091.jpg diff --git a/test_data/mvuploads/heterogenoustest/4143523_01206.jpg b/doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_01206.jpg similarity index 100% rename from test_data/mvuploads/heterogenoustest/4143523_01206.jpg rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/4143523_01206.jpg diff --git a/test_data/mvuploads/heterogenoustest/DEVON 1851.zip b/doc/old_test_files/test_data/mvuploads/heterogenoustest/DEVON 1851.zip similarity index 100% rename from test_data/mvuploads/heterogenoustest/DEVON 1851.zip rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/DEVON 1851.zip diff --git a/test_data/mvuploads/heterogenoustest/Flintshire 1861.zip b/doc/old_test_files/test_data/mvuploads/heterogenoustest/Flintshire 1861.zip similarity index 100% rename from test_data/mvuploads/heterogenoustest/Flintshire 1861.zip rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/Flintshire 1861.zip diff --git a/test_data/mvuploads/heterogenoustest/Nottm 1851.zip b/doc/old_test_files/test_data/mvuploads/heterogenoustest/Nottm 1851.zip similarity index 100% rename from test_data/mvuploads/heterogenoustest/Nottm 1851.zip rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/Nottm 1851.zip diff --git a/test_data/mvuploads/heterogenoustest/SSCens Tutor_Hse_3p.pdf b/doc/old_test_files/test_data/mvuploads/heterogenoustest/SSCens Tutor_Hse_3p.pdf similarity index 100% rename from test_data/mvuploads/heterogenoustest/SSCens Tutor_Hse_3p.pdf rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/SSCens Tutor_Hse_3p.pdf diff --git a/test_data/mvuploads/heterogenoustest/SSCens Tutorial_Spread_1p.pdf b/doc/old_test_files/test_data/mvuploads/heterogenoustest/SSCens Tutorial_Spread_1p.pdf similarity index 100% rename from test_data/mvuploads/heterogenoustest/SSCens Tutorial_Spread_1p.pdf rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/SSCens Tutorial_Spread_1p.pdf diff --git a/test_data/mvuploads/heterogenoustest/email b/doc/old_test_files/test_data/mvuploads/heterogenoustest/email similarity index 100% rename from test_data/mvuploads/heterogenoustest/email rename to doc/old_test_files/test_data/mvuploads/heterogenoustest/email diff --git a/test_data/mvuploads/pdftest/SSCens Tutor_Hse_3p.pdf b/doc/old_test_files/test_data/mvuploads/pdftest/SSCens Tutor_Hse_3p.pdf similarity index 100% rename from test_data/mvuploads/pdftest/SSCens Tutor_Hse_3p.pdf rename to doc/old_test_files/test_data/mvuploads/pdftest/SSCens Tutor_Hse_3p.pdf diff --git a/test_data/mvuploads/simpletest/4011569_00930.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4011569_00930.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4011569_00930.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4011569_00930.jpg diff --git a/test_data/mvuploads/simpletest/4034126_00391.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4034126_00391.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4034126_00391.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4034126_00391.jpg diff --git a/test_data/mvuploads/simpletest/4034127_00102.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4034127_00102.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4034127_00102.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4034127_00102.jpg diff --git a/test_data/mvuploads/simpletest/4034130_00057.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4034130_00057.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4034130_00057.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4034130_00057.jpg diff --git a/test_data/mvuploads/simpletest/4115449_00415.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4115449_00415.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4115449_00415.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4115449_00415.jpg diff --git a/test_data/mvuploads/simpletest/4143523_00517.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_00517.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_00517.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_00517.jpg diff --git a/test_data/mvuploads/simpletest/4143523_00564.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_00564.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_00564.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_00564.jpg diff --git a/test_data/mvuploads/simpletest/4143523_00584.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_00584.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_00584.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_00584.jpg diff --git a/test_data/mvuploads/simpletest/4143523_00694.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_00694.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_00694.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_00694.jpg diff --git a/test_data/mvuploads/simpletest/4143523_00836.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_00836.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_00836.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_00836.jpg diff --git a/test_data/mvuploads/simpletest/4143523_00886.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_00886.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_00886.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_00886.jpg diff --git a/test_data/mvuploads/simpletest/4143523_01091.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_01091.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_01091.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_01091.jpg diff --git a/test_data/mvuploads/simpletest/4143523_01206.jpg b/doc/old_test_files/test_data/mvuploads/simpletest/4143523_01206.jpg similarity index 100% rename from test_data/mvuploads/simpletest/4143523_01206.jpg rename to doc/old_test_files/test_data/mvuploads/simpletest/4143523_01206.jpg diff --git a/test_data/mvuploads/ziptest/Flintshire 1861.zip b/doc/old_test_files/test_data/mvuploads/ziptest/Flintshire 1861.zip similarity index 100% rename from test_data/mvuploads/ziptest/Flintshire 1861.zip rename to doc/old_test_files/test_data/mvuploads/ziptest/Flintshire 1861.zip diff --git a/test_data/processor/log/delete_files b/doc/old_test_files/test_data/processor/log/delete_files similarity index 100% rename from test_data/processor/log/delete_files rename to doc/old_test_files/test_data/processor/log/delete_files diff --git a/test_data/processor/log/foo.txt b/doc/old_test_files/test_data/processor/log/foo.txt similarity index 100% rename from test_data/processor/log/foo.txt rename to doc/old_test_files/test_data/processor/log/foo.txt diff --git a/test_data/processor/log/freereg1.delta b/doc/old_test_files/test_data/processor/log/freereg1.delta similarity index 100% rename from test_data/processor/log/freereg1.delta rename to doc/old_test_files/test_data/processor/log/freereg1.delta diff --git a/test_data/processor/log/processing_delta b/doc/old_test_files/test_data/processor/log/processing_delta similarity index 100% rename from test_data/processor/log/processing_delta rename to doc/old_test_files/test_data/processor/log/processing_delta diff --git a/test_data/processor/log/rsync.errors b/doc/old_test_files/test_data/processor/log/rsync.errors similarity index 100% rename from test_data/processor/log/rsync.errors rename to doc/old_test_files/test_data/processor/log/rsync.errors diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 000000000..115d87b30 --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,71 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +require 'spec_helper' +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../config/environment', __dir__) +# Prevent database truncation if the environment is production +abort("The Rails environment is running in production mode!") if Rails.env.production? +require 'rspec/rails' +# Add additional requires below this line. Rails is not loaded until this point! + +# Replaces ActiveRecord +require 'mongoid' + +# Load the Mongoid config and explicitly use the :test environment +Mongoid.load!(Rails.root.join("config", "mongoid.yml"), :test ) + +# 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')].sort.each { |f| require f } + +# Checks for pending migrations and applies them before tests are run. +# If you are not using ActiveRecord, you can remove these lines. +# begin +# ActiveRecord::Migration.maintain_test_schema! +# rescue ActiveRecord::PendingMigrationError => e +# puts e.to_s.strip +# exit 1 +# end +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 # Mongoid cannot use transactional + + # You can uncomment this line to turn off ActiveRecord support entirely. + # config.use_active_record = 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! + + # Filter lines from Rails gems in backtraces. + config.filter_rails_from_backtrace! + # arbitrary gems may also be filtered via: + # config.filter_gems_from_backtrace("gem name") + +end diff --git a/spec/requests/search_queries_spec.rb b/spec/requests/search_queries_spec.rb new file mode 100644 index 000000000..168667764 --- /dev/null +++ b/spec/requests/search_queries_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +RSpec.describe 'SearchQueries', type: :request do + describe 'GET #new' do + it 'responds successfully with an HTTP 200 status' do + get new_search_query_path + expect(response).to have_http_status(:ok) + end + + it 'renders the home page' do + get get root_path + expect(response).to be_successful + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e87b07c07..327b58ea1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,601 +1,94 @@ -# Copyright 2012 Trustees of FreeBMD +# 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. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 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. # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This file is copied to spec/ when you run 'rails generate rspec:install' -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' -#require 'rspec/autorun' - -require 'record_type' - -require 'new_freereg_csv_update_processor' - -# Requires supporting ruby files with custom matchers and macros, etc, -# in spec/support/ and its subdirectories. -Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - +# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| - # ## Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - config.color = true - - # 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 = true - - # If true, the base class of anonymous controllers will be inferred - # automatically. This will be the default behavior in future versions of - # rspec-rails. - - config.infer_base_class_for_anonymous_controllers = false -end - -def clean_freereg1_csv_file_document(file) - Freereg1CsvFile.file_name(file[:file]).userid(file[:user]).delete -end -def clean_database - PhysicalFile.delete_all - AtticFile.delete_all - SearchRecord.delete_all - Freereg1CsvEntry.delete_all - Freereg1CsvFile.delete_all - Register.delete_all - Church.delete_all - Place.delete_all -end - - -def create_stub_church(file) - place = Place.where(:place_name => file[:placename], :chapman_code => file[:chapman_code]).first - church = Church.where(:place_id => place.id,:church_name => file[:churchname]).first - if !church - church = Church.create!(:church_name => file[:churchname]) - place.churches << church - place.save! + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true end - church -end -def create_stub_place(file) - # create stub place - place = Place.where(:place_name => file[:placename], :chapman_code => file[:chapman_code]).first - place.approve if place.present? - unless place - place = Place.create!(:place_name => file[:placename], :chapman_code => file[:chapman_code], :latitude => 60, :longitude => 0, :modified_place_name => file[:placename].gsub(/-/, " ").gsub(/\./, "").gsub(/\'/, "").downcase) - place.approve - place.save! + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true end - place -end -def create_stub_userid(file) - # create_stub user - username = file[:user] - userid = UseridDetail.userid(username).first - unless userid - u = Refinery::Authentication::Devise::User.where(:username => username).first - u.delete unless u.nil? - userid = UseridDetail.create!(:userid=>username, :password=>username, :email_address=>"#{username}@example.com", :person_surname => username, :person_forename => username, :syndicate => 'test') + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # This allows you to limit a spec run to individual examples or groups + # you care about by tagging them with `:focus` metadata. When nothing + # is tagged with `:focus`, all examples get run. RSpec also provides + # aliases for `it`, `describe`, and `context` that include `:focus` + # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + config.filter_run_when_matching :focus + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/ + config.disable_monkey_patching! + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = "doc" end - userid -end - -def create_new_user(username) - userid = UseridDetail.userid(username).first - unless userid - u = Refinery::Authentication::Devise::User.where(:username => username).first - u.delete unless u.nil? - userid = UseridDetail.create!(:userid=>username, :password=>username, :email_address=>"#{username}@example.com", :person_surname => username, :person_forename => username, :syndicate => 'test') - end - folder_location = create_stub_userid_folder(username) - return userid,folder_location -end - -def create_stub_userid_folder(username) - folder_location = File.join(Rails.application.config.datafiles,username) - Dir.mkdir(folder_location,0774) unless Dir.exist?(folder_location) - folder_location -end - -def get_line - processing_file = Rails.application.config.delete_list - line = File.open(processing_file, &:readline) -end - -def process_test_file(file) - userid = create_stub_userid(file) - place = create_stub_place(file) - church = create_stub_church(file) - Rails.application.config.datafiles = file[:basedir] - NewFreeregCsvUpdateProcessor.activate_project('create_search_records','individual','force_rebuild',file[:filename]) - freereg1_csv_file = Freereg1CsvFile.userid(file[:user]).file_name(file[:file]).first -end - - -def setup_userids - Dir.glob(File.join(Rails.root, 'test_data', 'freereg1_csvs', '*')). - map{|fn| File.basename(fn)}. - each{|uid| UseridDetail.create!(:userid => uid, :password => uid, :encrypted_password => uid, :email_address => "#{uid}@example.com", :person_surname => uid, :person_forename => uid, :syndicate => 'test') unless UseridDetail.where(:userid => uid).first} + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end end - -def set_up_new_location(file) - register = file.register - church = register.church - place = church.place - sess = {} - par ={} - sess[:selectcountry] = file.country - sess[:selectcounty] = file.county - sess[:selectplace] = place.id - sess[:selectchurch] = church.id - par[:register_type] = file.register_type - return par,sess -end - -def write_new_copy(user,file_name) - #this is used to replace the removed file - userid = UseridDetail.userid(user).first - file = AtticFile.userid(userid.id).first - folder = create_stub_userid_folder(user) - new_file = File.join(folder,file_name) - old_file = File.join(Rails.application.config.datafiles,user,".attic",file.name) - File.rename(old_file,new_file) -end - -FREEREG1_CSV_FILES = [ - { - :filename => "kirknorfolk/NFKALEBU.csv", - :file => "NFKALEBU.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :type => RecordType::BURIAL, - :user => 'kirknorfolk', - :chapman_code => 'NFK', - :placename => 'Aldeby', - :churchname => 'St Mary', - :register_type => "BT", - :minimum_date => "1690", - :maximum_date => "1698", - :entry_count => 15, - :entries => { - :first => { - :line_id => "kirknorfolk.NFKALEBU.CSV.1", - :burial_person_forename => 'Will', - :burial_person_surname => 'SADD', - :burial_date => '6 Mar 1690/1', - :modern_year => 1691 - }, - :last => { - :line_id => "kirknorfolk.NFKALEBU.CSV.15", - :burial_person_forename => 'Robert', - :burial_person_surname => 'LONDON', - :burial_date => '7 Nov 1691', - :modern_year => 1691 - } - } - }, - { - :filename => "kirkbedfordshire/BDFYIEBA.CSV", - :file => "BDFYIEBA.CSV", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :type => RecordType::BAPTISM, - :user => 'kirkbedfordshire', - :chapman_code => 'BDF', - :placename => 'Yielden', - :churchname => 'St Fictional', - :entry_count => 1223, - :register_type => "PR", - :minimum_date => "1602", - :maximum_date => "1812", - :entries => { - :first => { - :line_id => "kirkbedfordshire.BDFYIEBA.CSV.1", - :baptism_date => '30 Aug 1602', - :person_forename => 'Paul', - :person_sex => 'M', - :father_forename => 'Thomas', - :father_surname => 'MAXEE', - :modern_year => 1602 - }, - :last => { - :line_id => "kirkbedfordshire.BDFYIEBA.CSV.1223", - :baptism_date => '19 Oct 1812', - :person_forename => 'Elizabeth', - :mother_forename => 'Susan', - :person_sex => 'F', - :father_surname => 'CHARLES', - :father_forename => 'Joseph', - :modern_year => 1812 - } - } - }, - { - # :filename => "/home/benwbrum/dev/clients/freeukgen/scratch/Chd/HRTCALMA.csv", - # :basedir => "/home/benwbrum/dev/clients/freeukgen/scratch/", - :filename => "Chd/HRTCALMA.csv", - :file => "HRTCALMA.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :type => RecordType::MARRIAGE, - :user => 'Chd', - :chapman_code => 'HRT', - :placename => 'Caldecote', - :churchname => 'St Mary Magdalene', - :entry_count => 45, - :register_type => "AT", - :minimum_date => "1726", - :maximum_date => "1837", - :entries => { - :first => { - :line_id => "Chd.HRTCALMA.CSV.1", - :marriage_date => '4 Oct 1726', - :bride_surname => 'CANNON', - :bride_forename => 'Sarah', - :groom_surname => 'SAUNDERS', - :groom_forename => 'William', - :modern_year => 1726 - }, - :last => { - :line_id => "Chd.HRTCALMA.CSV.45", - :marriage_date => '12 Oct 1837', - :bride_surname => 'GARRATT', - :bride_forename => 'Anne', - :groom_surname => 'CLARKE', - :groom_forename => 'Charles', - :modern_year => 1837, - :witnesses => [ - { :first_name => 'William', :last_name => 'CLARKE'}, - { :first_name => 'Mary', :last_name => 'GARRATT'} - ] - } - } - }, - { - :filename => "Devonian/DEVLANBU.CSV", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "DEVLANBU.CSV", - :type => RecordType::BURIAL, - :user => 'Devonian', - :chapman_code => 'DEV', - :placename => 'Landcross', - :churchname => 'Holy Trinity', - :entry_count => 128, - :register_type => "PR", - :minimum_date => "1594", - :maximum_date => "1811", - :entries => { - :first => { - :line_id => "Devonian.DEVLANBU.CSV.1", - :burial_person_forename => 'John', - :relative_surname => 'NORTHWAY', - :burial_date => '7 Dec 1802', - :modern_year => 1802 - }, # add problem entry here - :last => { - :line_id => "Devonian.DEVLANBU.CSV.128", - :burial_person_forename => 'Richardus', - :burial_person_surname => 'OXENHAM', - :burial_date => '13 Mar 1693/4', - :modern_year => 1694 - } - } - }, - { - :filename => "Chd/HRTWILMA.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "HRTWILMA.csv", - :type => RecordType::MARRIAGE, - :user => 'Chd', - :chapman_code => 'HRT', - :placename => 'Willian', - :churchname => 'All Saints', - :entry_count => 545, - :register_type => "EX", - :minimum_date => "1559", - :maximum_date => "1911", - :entries => { - :first => { - :line_id => "Chd.HRTWILMA.csv.1", - :marriage_date => '8 Oct 1559', - :bride_surname => 'CHATTERTON', - :bride_forename => 'Margerie', - :groom_surname => 'BUCKMASTER', - :groom_forename => 'Thomas', - :modern_year => 1559 - }, - :last => { - :line_id => "Chd.HRTWILMA.csv.545", - :marriage_date => '11 Nov 1911', - :bride_surname => 'SWAIN', - :bride_forename => 'Bessie Malinda', - :groom_surname => 'BROWN', - :groom_forename => 'Percy', - :bride_father_surname => 'SWAIN', - :bride_father_forename => 'Thomas', - :groom_father_surname => 'BROWN', - :groom_father_forename => 'Charles', - :modern_year => 1911 - } - } -}] - - -ARTIFICIAL_FILES = [ - { - :filename => "artificial/double_latinization.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "double_latinization.csv", - :chapman_code => 'NTH', - :placename => 'Gretton', - :churchname => 'St James', - :entry_count => 1, - :register_type => "PR", - :minimum_date => "1798", - :maximum_date => "1798", - :user => 'artificial' - }, - { - :filename => "artificial/multiple_expansions.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "multiple_expansions.csv", - :chapman_code => 'LEI', - :placename => 'Belton', - :churchname => 'St John The Baptist', - :entry_count => 1, - :register_type => "DW", - :minimum_date => "1739", - :maximum_date => "1739", - :user => 'artificial' - } -] - -EMENDATION_FILES = [ - { - :filename => "artificial/double_latinization.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "double_latinization.csv", - :entry_count => 1, - :register_type => "PR", - :minimum_date => "1798", - :maximum_date => "1798", - :user => 'artificial' - }, - { - :filename => "artificial/multiple_expansions.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "multiple_expansions.csv", - :entry_count => 1, - :register_type => "DW", - :minimum_date => "1739", - :maximum_date => "1739", - :user => 'artificial' - } -] - -NO_BAPTISMAL_NAME = -{ - :filename => "BobChown/KENSTIBA1.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/", - :file => "KENSTIBA1.csv", - :chapman_code => 'KEN', - :placename => 'Stone in Oxney', - :churchname => 'St Mary', - :entry_count => 1, - :register_type => "TR", - :minimum_date => "1553", - :maximum_date => "1553", - :user => 'BobChown' -} - -NO_BURIAL_FORENAME = -{ - :filename => "1boy7girls/LINBEEBU.CSV", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/", - :file => "LINBEEBU.CSV", - :chapman_code => 'LIN', - :placename => 'Beelsby', - :churchname => 'St Andrew', - :entry_count => 2, - :register_type => "PR", - :minimum_date => "1935", - :maximum_date => "1935", - :user => '1boy7girls' -} - -NO_RELATIVE_SURNAME = -{ - :filename => "brilyn/NFKWYMBU.CSV", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/", - :file => "NFKWYMBU.CSV", - :chapman_code => 'NFK', - :placename => 'Wymondham', - :churchname => "Virgin Mary And St Thomas A Becket", - :entry_count => 1, - :register_type => "AT", - :minimum_date => "1781", - :maximum_date => "1781", - :user => 'brilyn' -} - - -SQUARE_BRACE_UCF = -{ - :filename => "artificial/ucf_nostar.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "ucf_nostar.csv", - :chapman_code => 'NTH', - :placename => 'Gretton', - :churchname => "St James", - :entry_count => 17, - :register_type => "", - :minimum_date => "1798", - :maximum_date => "1798", - :user => 'artificial' -} - -WILDCARD_UCF = -{ - :filename => "artificial/ucf_star.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "ucf_star.csv", - :chapman_code => 'SOM', - :placename => 'Runnington', - :churchname => 'St Peter', - :entry_count => 8, - :register_type => "", - :minimum_date => "1734", - :maximum_date => "1798", - :user => 'artificial' -} - -BAPTISM_BIRTH = -{ - :filename => "artificial/birth_date_ba.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "birth_date_ba.csv", - :chapman_code => 'KEN', - :placename => 'Stone in Oxney', - :churchname => 'St Mary', - :entry_count => 1, - :register_type => "TR", - :minimum_date => "1553", - :maximum_date => "1653", - :user => 'artificial' -} - -WILDCARD_DATES = -{ - :filename => "artificial/unclear_date_ba.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "unclear_date_ba.csv", - :chapman_code => 'KEN', - :placename => 'Stone in Oxney', - :churchname => 'St Mary', - :entry_count => 1, - :register_type => "TR", - :minimum_date => "1653", - :maximum_date => "1653", - :user => 'artificial' -} -CHANGELESS_FILE = -{ - :filename => "jelit/SSXSESBU.CSV", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "SSXSESBU.CSV", - :chapman_code => 'SSX', - :placename => 'Selsey', - :churchname => 'St Peter', - :entry_count => 835, - :register_type => "PR", - :minimum_date => "1813", - :maximum_date => "1866", - :user => 'jelit' -} - - - - -DELTA_FILES = [ - { - :filename => "artificial/deltas/v1/kirknorfolk/NFKALEBU.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/deltas/v1/", - :file => "NFKALEBU.csv", - :chapman_code => 'NFK', - :placename => 'Aldeby', - :churchname => 'St Mary', - :entry_count => 15, - :register_type => "BT", - :minimum_date => "1690", - :maximum_date => "1691", - :user => 'kirknorfolk' - }, - { - :filename => "artificial/deltas/v2/kirknorfolk/NFKALEBU.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/deltas/v2/", - :file => "NFKALEBU.csv", - :chapman_code => 'NFK', - :placename => 'Aldeby', - :churchname => 'St Mary', - :entry_count => 15, - :register_type => "BT", - :minimum_date => "1690", - :maximum_date => "1691", - :user => 'kirknorfolk' - }, - { - :filename => "artificial/deltas/v3/kirknorfolk/NFKALEBU.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/artificial/deltas/v3/", - :file => "NFKALEBU.csv", - :chapman_code => 'NFK', - :placename => 'Aldeby', - :churchname => 'St Mary', - :entry_count => 15, - :register_type => "BT", - :minimum_date => "1690", - :maximum_date => "1691", - :user => 'kirknorfolk' - } -] - - -EMBARGO_FILES = [ - { - :filename => "artificial/embargoed_baptism.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "embargoed_baptism.csv", - :chapman_code => 'NFK', - :placename => 'Norwich', - :churchname => 'Octagon Unitarian Chapel', - :entry_count => 2, - :register_type => "", - :minimum_date => "1691", - :maximum_date => "1941", - :user => 'artificial' - }, - { - :filename => "artificial/embargoed_marriage.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "embargoed_marriage.csv", - :chapman_code => 'LIN', - :placename => 'Great Hale', - :churchname => 'St John', - :entry_count => 2, - :register_type => "", - :minimum_date => "1915", - :maximum_date => "1949", - :user => 'artificial' - }, - { - :filename => "artificial/embargoed_burial.csv", - :basedir => "#{Rails.root}/test_data/freereg1_csvs/", - :file => "embargoed_burial.csv", - :chapman_code => 'NFK', - :placename => 'Ingham', - :churchname => 'St John', - :entry_count => 2, - :register_type => "AT", - :minimum_date => "1726", - :maximum_date => "2014", - :user => 'artificial' - } -] diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb new file mode 100644 index 000000000..c35f17f29 --- /dev/null +++ b/spec/support/capybara.rb @@ -0,0 +1,6 @@ +require 'capybara/rspec' + +RSpec.configure do |config| + # Include Capybara DSL so you can use `visit`, `fill_in`, etc. + config.include Capybara::DSL, type: :feature +end diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb new file mode 100644 index 000000000..92562e9ea --- /dev/null +++ b/spec/support/factory_bot.rb @@ -0,0 +1,4 @@ +RSpec.configure do |config| + # This lets you call `create(:user)` instead of `FactoryBot.create(:user)` + config.include FactoryBot::Syntax::Methods +end diff --git a/spec/support/mongoid-rspec.rb b/spec/support/mongoid-rspec.rb new file mode 100644 index 000000000..8c0347c9f --- /dev/null +++ b/spec/support/mongoid-rspec.rb @@ -0,0 +1,5 @@ +require 'mongoid-rspec' + +RSpec.configure do |config| + config.include Mongoid::Matchers, type: :model +end diff --git a/spec/system/search_queries_spec.rb b/spec/system/search_queries_spec.rb new file mode 100644 index 000000000..45ac4bfcb --- /dev/null +++ b/spec/system/search_queries_spec.rb @@ -0,0 +1,23 @@ +require 'rails_helper' + +RSpec.describe 'SearchQueries', type: :system do + before do + driven_by(:rack_test) + end + + it 'does a baptism search query' do + visit root_path + + expect(page).to have_content 'Search our Parish Registers' + expect(page).to have_content 'Search fields' + + fill_in 'last_name', with: 'pile' + fill_in 'start_year', with: '1730' + fill_in 'end_year', with: '1850' + choose 'ba' + click_button 'Search' + + expect(page).to have_content 'We found' + # expect(page).to have_content 'No results found' + end +end