Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Commit 8d32876

Browse files
authored
Merge pull request #607 from Data-Liberation-Front/reenable-activerecord
Re-enable PostgreSQL and ActiveRecord
2 parents c768a58 + f4f76fe commit 8d32876

File tree

14 files changed

+27
-35
lines changed

14 files changed

+27
-35
lines changed

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ group :production do
3434
gem 'thin', '~> 1.8'
3535
gem 'rails_12factor', '~> 0.0'
3636
gem 'puma', '~> 5.2'
37+
gem 'pg', '~> 1.2'
3738
end
3839

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

6060
group :development do

Gemfile.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ GEM
522522
open_uri_redirections (0.2.1)
523523
optimist (3.0.1)
524524
origin (2.3.1)
525+
pg (1.2.3)
525526
poltergeist (1.6.0)
526527
capybara (~> 2.1)
527528
cliver (~> 0.3.1)
@@ -726,7 +727,7 @@ GEM
726727
actionpack (>= 4.0)
727728
activesupport (>= 4.0)
728729
sprockets (>= 3.0.0)
729-
sqlite3 (1.4.2)
730+
sqlite3 (1.3.13)
730731
sxp (1.1.0)
731732
rdf (~> 3.1)
732733
sync (0.5.0)
@@ -821,6 +822,7 @@ DEPENDENCIES
821822
mongo (~> 2.1)!
822823
mongoid (~> 5.1)
823824
nokogiri (~> 1.10)
825+
pg (~> 1.2)
824826
poltergeist (~> 1.6)
825827
pry (~> 0.14)
826828
puma (~> 5.2)
@@ -839,7 +841,7 @@ DEPENDENCIES
839841
sidekiq (~> 4.2)
840842
simplecov (~> 0.16)
841843
spring (~> 2.1)
842-
sqlite3 (~> 1.4)
844+
sqlite3 (~> 1.3.0)
843845
therubyracer (~> 0.12)
844846
thin (~> 1.8)
845847
timecop (~> 0.9)

config/application.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require File.expand_path('../boot', __FILE__)
22

33
# Pick the frameworks you want:
4-
#require "active_record/railtie"
4+
require "active_record/railtie"
55
require "action_controller/railtie"
66
require "action_mailer/railtie"
77
require "sprockets/railtie"
@@ -30,6 +30,10 @@ class Application < Rails::Application
3030
config.middleware.use("Rack::GoogleAnalytics", :tracker => ENV['CSVLINT_ANALYTICS_KEY'])
3131
end
3232

33+
config.generators do |g|
34+
g.orm :active_record
35+
end
36+
3337
config.middleware.use Rack::Cors do
3438
allow do
3539
origins '*'

features/step_definitions/fixture_steps.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

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

@@ -45,7 +45,7 @@
4545
end
4646

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

5151
Given(/^the data exceeds the amount the proxy can handle/) do

features/support/env.rb

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,12 @@
4545
# Remove/comment out the lines below if your app doesn't have a database.
4646
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
4747
begin
48-
DatabaseCleaner.strategy = :truncation
48+
DatabaseCleaner[:mongoid].strategy = :truncation
49+
DatabaseCleaner[:active_record].strategy = :truncation
4950
rescue NameError
5051
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
5152
end
5253

53-
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
54-
# See the DatabaseCleaner documentation for details. Example:
55-
#
56-
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
57-
# # { :except => [:widgets] } may not do what you expect here
58-
# # as Cucumber::Rails::Database.javascript_strategy overrides
59-
# # this setting.
60-
# DatabaseCleaner.strategy = :truncation
61-
# end
62-
#
63-
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
64-
# DatabaseCleaner.strategy = :transaction
65-
# end
66-
#
67-
6854
Capybara.register_driver :poltergeist do |app|
6955
Capybara::Poltergeist::Driver.new(app, {debug: false})
7056
end

spec/controllers/application_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
end
1010

1111
it "returns 303 redirect if validation is in DB" do
12-
validation = FactoryBot.create :validation, url: "http://data.com/data.csv"
12+
validation = FactoryBot.create :legacy_validation, url: "http://data.com/data.csv"
1313
get 'index', uri: "http://data.com/data.csv"
1414
expect(response).to be_redirect
1515
expect(response.code).to eq("303")

spec/controllers/schemas_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
describe "GET 'index' with uri arg" do
1313

1414
it "returns 303 redirect if schema is in DB" do
15-
schema = FactoryBot.create :schema, url: "http://data.com/schema.json"
15+
schema = FactoryBot.create :legacy_schema, url: "http://data.com/schema.json"
1616
get 'index', uri: "http://data.com/schema.json"
1717
expect(response).to be_redirect
1818
expect(response.code).to eq("303")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FactoryBot.define do
2-
factory :validation, class: 'legacy/validation' do
2+
factory :legacy_schema, class: 'legacy/schema' do
33
url { Faker::Internet.url }
44
end
55
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FactoryBot.define do
2+
factory :legacy_validation, class: 'legacy/validation' do
3+
url { Faker::Internet.url }
4+
end
5+
end

spec/factories/schemas.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)