make the database used for specs a global variable

Didier Lafforgue committed Apr 30, 2018
commit 5f1ec25d027b3e4aab0c42e11a5d2ec29835cc49
Showing 35 changed files with 32 additions and 27 deletions
Rakefile +2 -2
@@ @@ -28,8 +28,8 @@ namespace :mongodb do
`mv #{dump_path} #{db_path}`
end
- `mongo steam_test --eval "db.dropDatabase()"`
- `mongorestore -d steam_test #{db_path}`
+ `mongo steam_test_1_4_x --eval "db.dropDatabase()"`
+ `mongorestore -d steam_test_1_4_x #{db_path}`
puts "Done! Update now the spec/support/helpers.rb file by setting the new id of the site returned by the mongodb_site_id method"
end
spec/fixtures/default/app/content_types/songs.yml +1 -1
@@ @@ -15,7 +15,7 @@ fields:
label: Cover
type: file
required: false
- #localized: true # required when pushing the site with Wagon
+ # localized: true # required when pushing the site with Wagon
- short_description:
type: text
text_formatting: html
locomotive_accounts.bson b/spec/fixtures/mongodb/locomotive_accounts.bson +0 -0
locomotive_accounts.metadata.json b/spec/fixtures/mongodb/locomotive_accounts.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_accounts"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_accounts"}]}
\ No newline at end of file
locomotive_activities.bson b/spec/fixtures/mongodb/locomotive_activities.bson +0 -0
locomotive_activities.metadata.json b/spec/fixtures/mongodb/locomotive_activities.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_activities"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_activities"}]}
\ No newline at end of file
locomotive_content_assets.bson b/spec/fixtures/mongodb/locomotive_content_assets.bson +0 -0
locomotive_content_assets.metadata.json b/spec/fixtures/mongodb/locomotive_content_assets.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_content_assets"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_content_assets"}]}
\ No newline at end of file
locomotive_content_entries.bson b/spec/fixtures/mongodb/locomotive_content_entries.bson +0 -0
locomotive_content_entries.metadata.json b/spec/fixtures/mongodb/locomotive_content_entries.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_content_entries"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_content_entries"}]}
\ No newline at end of file
locomotive_content_types.bson b/spec/fixtures/mongodb/locomotive_content_types.bson +0 -0
locomotive_content_types.metadata.json b/spec/fixtures/mongodb/locomotive_content_types.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_content_types"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_content_types"}]}
\ No newline at end of file
locomotive_pages.bson b/spec/fixtures/mongodb/locomotive_pages.bson +0 -0
locomotive_pages.metadata.json b/spec/fixtures/mongodb/locomotive_pages.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_pages"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_pages"}]}
\ No newline at end of file
locomotive_sites.bson b/spec/fixtures/mongodb/locomotive_sites.bson +0 -0
locomotive_sites.metadata.json b/spec/fixtures/mongodb/locomotive_sites.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_sites"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_sites"}]}
\ No newline at end of file
locomotive_snippets.bson b/spec/fixtures/mongodb/locomotive_snippets.bson +0 -0
locomotive_snippets.metadata.json b/spec/fixtures/mongodb/locomotive_snippets.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_snippets"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_snippets"}]}
\ No newline at end of file
locomotive_theme_assets.bson b/spec/fixtures/mongodb/locomotive_theme_assets.bson +0 -0
locomotive_theme_assets.metadata.json b/spec/fixtures/mongodb/locomotive_theme_assets.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_theme_assets"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_theme_assets"}]}
\ No newline at end of file
locomotive_translations.bson b/spec/fixtures/mongodb/locomotive_translations.bson +0 -0
locomotive_translations.metadata.json b/spec/fixtures/mongodb/locomotive_translations.metadata.json +1 -1
@@ @@ -1 +1 @@
- {"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_wagon_dev.locomotive_translations"}]}
\ No newline at end of file
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.locomotive_translations"}]}
\ No newline at end of file
sessions.bson b/spec/fixtures/mongodb/sessions.bson +0 -0
sessions.metadata.json b/spec/fixtures/mongodb/sessions.metadata.json +1 -0
@@ @@ -0,0 +1 @@
+ {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"locomotive_engine_test.sessions"}]}
\ No newline at end of file
spec/integration/adapters/mongodb_spec.rb +1 -1
@@ @@ -4,7 +4,7 @@ require_relative '../../../lib/locomotive/steam/adapters/mongodb.rb'
describe Locomotive::Steam::MongoDBAdapter do
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017'], min_pool_size: 2, max_pool_size: 5) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017'], min_pool_size: 2, max_pool_size: 5) }
before(:all) do
described_class.disconnect_session
spec/integration/liquid/tags/paginate_spec.rb +1 -1
@@ @@ -70,7 +70,7 @@ EOF
it_should_behave_like 'pagination' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
end
spec/integration/repositories/content_entry_repository_spec.rb +2 -2
@@ @@ -115,8 +115,8 @@ describe Locomotive::Steam::ContentEntryRepository do
it_should_behave_like 'a repository' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
- let(:entry_id) { BSON::ObjectId.from_string('5943b4dd87f6430cf23b814d') }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
+ let(:entry_id) { BSON::ObjectId.from_string('5ae73458e051bb4f5525c92f') }
end
spec/integration/repositories/content_type_repository_spec.rb +1 -1
@@ @@ -47,7 +47,7 @@ describe Locomotive::Steam::ContentTypeRepository do
it_should_behave_like 'a repository' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
end
spec/integration/repositories/page_repository_spec.rb +1 -1
@@ @@ -94,7 +94,7 @@ describe Locomotive::Steam::PageRepository do
it_should_behave_like 'a repository' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
end
spec/integration/repositories/site_repository_spec.rb +1 -1
@@ @@ -23,7 +23,7 @@ describe Locomotive::Steam::SiteRepository do
context 'MongoDB' do
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
it_behaves_like 'a repository'
spec/integration/repositories/snippet_repository_spec.rb +1 -1
@@ @@ -28,7 +28,7 @@ describe Locomotive::Steam::SnippetRepository do
it_should_behave_like 'a repository' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
end
spec/integration/repositories/theme_asset_repository_spec.rb +2 -2
@@ @@ -11,7 +11,7 @@ describe Locomotive::Steam::ThemeAssetRepository do
context 'MongoDB' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
describe '#all' do
subject { repository.all }
@@ @@ -26,7 +26,7 @@ describe Locomotive::Steam::ThemeAssetRepository do
describe '#checksums' do
subject { repository.checksums }
it { expect(subject.size).to eq 16 }
- it { expect(subject['stylesheets/application.css']).to eq 'f06835e254f0d1b8363aae754525c723' }
+ it { expect(subject['stylesheets/application.css']).to eq '15161ceeb93a9d26027a8a38862be47b' }
end
end
spec/integration/repositories/translation_repository_spec.rb +1 -1
@@ @@ -28,7 +28,7 @@ describe Locomotive::Steam::TranslationRepository do
it_should_behave_like 'a repository' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
end
spec/integration/services/content_entry_service_spec.rb +2 -2
@@ @@ -44,8 +44,8 @@ describe Locomotive::Steam::ContentEntryService do
it_should_behave_like 'a content entry service' do
let(:site_id) { mongodb_site_id }
- let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: 'steam_test', hosts: ['127.0.0.1:27017']) }
- let(:entry_id) { BSON::ObjectId.from_string('5943b4dd87f6430cf23b814d') }
+ let(:adapter) { Locomotive::Steam::MongoDBAdapter.new(database: mongodb_database, hosts: ['127.0.0.1:27017']) }
+ let(:entry_id) { BSON::ObjectId.from_string('5ae73458e051bb4f5525c92f') }
describe '#create' do
subject { service.create('messages', { name: 'John', email: 'john@doe.net', message: 'Hello world!' }) }
spec/support/helpers.rb +5 -1
@@ @@ -3,8 +3,12 @@ require 'locomotive/common'
module Spec
module Helpers
+ def mongodb_database
+ 'steam_test_1_4_x'
+ end
+
def mongodb_site_id
- BSON::ObjectId.from_string('5943b49287f6430cadd748a3')
+ BSON::ObjectId.from_string('5ae73303e051bb4f2bcbeefa')
end
def reset!