Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ group :production do
gem 'thin', '~> 1.8'
gem 'rails_12factor', '~> 0.0'
gem 'puma', '~> 5.2'
gem 'pg', '~> 1.2'
end

group :development, :test do
Expand All @@ -53,8 +54,7 @@ group :development, :test do
gem 'poltergeist', '~> 1.6'
gem 'vcr', '~> 6.0'
gem 'cucumber-api-steps', require: false, git: 'https://github.com/Data-Liberation-Front/cucumber-api-steps.git', branch: 'feature-test-content-type'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
gem 'sqlite3', '~> 1.3.0'
end

group :development do
Expand Down
6 changes: 4 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ GEM
open_uri_redirections (0.2.1)
optimist (3.0.1)
origin (2.3.1)
pg (1.2.3)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
Expand Down Expand Up @@ -726,7 +727,7 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.4.2)
sqlite3 (1.3.13)
sxp (1.1.0)
rdf (~> 3.1)
sync (0.5.0)
Expand Down Expand Up @@ -821,6 +822,7 @@ DEPENDENCIES
mongo (~> 2.1)!
mongoid (~> 5.1)
nokogiri (~> 1.10)
pg (~> 1.2)
poltergeist (~> 1.6)
pry (~> 0.14)
puma (~> 5.2)
Expand All @@ -839,7 +841,7 @@ DEPENDENCIES
sidekiq (~> 4.2)
simplecov (~> 0.16)
spring (~> 2.1)
sqlite3 (~> 1.4)
sqlite3 (~> 1.3.0)
therubyracer (~> 0.12)
thin (~> 1.8)
timecop (~> 0.9)
Expand Down
6 changes: 5 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
#require "active_record/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
Expand Down Expand Up @@ -30,6 +30,10 @@ class Application < Rails::Application
config.middleware.use("Rack::GoogleAnalytics", :tracker => ENV['CSVLINT_ANALYTICS_KEY'])
end

config.generators do |g|
g.orm :active_record
end

config.middleware.use Rack::Cors do
allow do
origins '*'
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/fixture_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

Given(/^there are (\d+) schemas in the database$/) do |num|
num.to_i.times do |n|
FactoryBot.create :schema
FactoryBot.create :legacy_schema
end
end

Expand All @@ -45,7 +45,7 @@
end

Given(/^"(.*?)" has been previously used for validation$/) do |url|
FactoryBot.create :schema, url: url
FactoryBot.create :legacy_schema, url: url
end

Given(/^the data exceeds the amount the proxy can handle/) do
Expand Down
18 changes: 2 additions & 16 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,12 @@
# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
begin
DatabaseCleaner.strategy = :truncation
DatabaseCleaner[:mongoid].strategy = :truncation
DatabaseCleaner[:active_record].strategy = :truncation
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
# See the DatabaseCleaner documentation for details. Example:
#
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
# # { :except => [:widgets] } may not do what you expect here
# # as Cucumber::Rails::Database.javascript_strategy overrides
# # this setting.
# DatabaseCleaner.strategy = :truncation
# end
#
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
# DatabaseCleaner.strategy = :transaction
# end
#

Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, {debug: false})
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/application_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end

it "returns 303 redirect if validation is in DB" do
validation = FactoryBot.create :validation, url: "http://data.com/data.csv"
validation = FactoryBot.create :legacy_validation, url: "http://data.com/data.csv"
get 'index', uri: "http://data.com/data.csv"
expect(response).to be_redirect
expect(response.code).to eq("303")
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/schemas_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
describe "GET 'index' with uri arg" do

it "returns 303 redirect if schema is in DB" do
schema = FactoryBot.create :schema, url: "http://data.com/schema.json"
schema = FactoryBot.create :legacy_schema, url: "http://data.com/schema.json"
get 'index', uri: "http://data.com/schema.json"
expect(response).to be_redirect
expect(response.code).to eq("303")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FactoryBot.define do
factory :validation, class: 'legacy/validation' do
factory :legacy_schema, class: 'legacy/schema' do
url { Faker::Internet.url }
end
end
5 changes: 5 additions & 0 deletions spec/factories/legacy_validations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FactoryBot.define do
factory :legacy_validation, class: 'legacy/validation' do
url { Faker::Internet.url }
end
end
7 changes: 0 additions & 7 deletions spec/factories/schemas.rb

This file was deleted.

6 changes: 4 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
ENV['AWS_SECRET_ACCESS_KEY'] = 'fakesecret'
ENV['AWS_BUCKET_NAME'] = 'buckethead'

DatabaseCleaner.strategy = :truncation
DatabaseCleaner[:mongoid].strategy = :truncation
DatabaseCleaner[:active_record].strategy = :truncation

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Expand Down Expand Up @@ -81,7 +82,8 @@
config.order = "random"

config.after(:each) do
DatabaseCleaner.clean
DatabaseCleaner[:mongoid].clean
DatabaseCleaner[:active_record].clean
end

config.after(:all) do
Expand Down