dry-web-roda 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +4 -3
- data/README.md +1 -1
- data/dry-web-roda.gemspec +0 -2
- data/lib/dry/web/roda/cli.rb +2 -2
- data/lib/dry/web/roda/cli/generate.rb +1 -1
- data/lib/dry/web/roda/generate.rb +32 -34
- data/lib/dry/web/roda/generators/abstract_generator.rb +54 -0
- data/lib/dry/web/roda/generators/abstract_project.rb +118 -0
- data/lib/dry/web/roda/generators/flat_project.rb +20 -14
- data/lib/dry/web/roda/generators/sub_app.rb +34 -13
- data/lib/dry/web/roda/generators/umbrella_project.rb +10 -19
- data/lib/dry/web/roda/templates/.env.test.tt +1 -0
- data/lib/dry/web/roda/templates/.env.tt +2 -0
- data/lib/dry/web/roda/templates/.gitignore +8 -0
- data/lib/dry/web/roda/{skeletons/flat_project/lib/__underscored_app_name__ → templates}/.keep +0 -0
- data/lib/dry/web/roda/templates/.rspec +2 -0
- data/lib/dry/web/roda/{skeletons/flat_project → templates}/Gemfile +4 -3
- data/lib/dry/web/roda/{skeletons/umbrella_project → templates}/README.md.tt +2 -2
- data/lib/dry/web/roda/templates/Rakefile.tt +66 -0
- data/lib/dry/web/roda/{skeletons/flat_project/web/templates/layouts → templates}/application.html.slim +0 -0
- data/lib/dry/web/roda/templates/boot__settings.rb.tt +10 -0
- data/lib/dry/web/roda/{skeletons/flat_project → templates}/config.ru.tt +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/bin → templates}/console.tt +0 -0
- data/lib/dry/web/roda/templates/container.rb.tt +14 -0
- data/lib/dry/web/roda/{skeletons/flat_project/web/routes/example.rb.tt → templates/example_routes.rb.tt} +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/__underscored_app_name__ → templates/flat_project}/application.rb.tt +6 -1
- data/lib/dry/web/roda/templates/flat_project/boot.rb.tt +10 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/__underscored_app_name__ → templates}/import.rb.tt +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/boot → templates}/monitor.rb.tt +0 -0
- data/lib/dry/web/roda/templates/operation.rb.tt +9 -0
- data/lib/dry/web/roda/{skeletons/flat_project/system/__underscored_app_name__ → templates}/repository.rb.tt +4 -2
- data/lib/dry/web/roda/templates/rom.rb.tt +39 -0
- data/lib/dry/web/roda/{skeletons/flat_project/db → templates}/sample_data.rb +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/db → templates}/seed.rb +0 -0
- data/lib/dry/web/roda/templates/settings.rb.tt +9 -0
- data/lib/dry/web/roda/{skeletons/flat_project/bin → templates}/setup +0 -0
- data/lib/dry/web/roda/{skeletons/umbrella_project/spec/db_helper.rb.tt → templates/spec/db_spec_helper.rb.tt} +2 -3
- data/lib/dry/web/roda/templates/spec/factories/example.rb +9 -0
- data/lib/dry/web/roda/{skeletons/flat_project → templates}/spec/spec_helper.rb.tt +1 -1
- data/lib/dry/web/roda/templates/spec/support/db/factory.rb +8 -0
- data/lib/dry/web/roda/templates/spec/support/db/helpers.rb.tt +13 -0
- data/lib/dry/web/roda/templates/spec/support/web/helpers.rb.tt +9 -0
- data/lib/dry/web/roda/{skeletons/umbrella_project/spec/app_helper.rb → templates/spec/web_spec_helper.rb} +8 -6
- data/lib/dry/web/roda/{skeletons/sub_app/system/__underscored_app_name__ → templates/subapp}/application.rb.tt +6 -1
- data/lib/dry/web/roda/templates/subapp/boot.rb.tt +5 -0
- data/lib/dry/web/roda/{skeletons/sub_app/system/__underscored_app_name__ → templates/subapp}/container.rb.tt +6 -9
- data/lib/dry/web/roda/{skeletons/sub_app/system/__underscored_app_name__ → templates/subapp}/transactions.rb.tt +2 -3
- data/lib/dry/web/roda/templates/subapp/view_context.rb.tt +8 -0
- data/lib/dry/web/roda/templates/subapp/view_controller.rb.tt +17 -0
- data/lib/dry/web/roda/{skeletons/flat_project/lib → templates}/types.rb +0 -0
- data/lib/dry/web/roda/{skeletons/umbrella_project/system/__underscored_app_name__ → templates/umbrella_project}/application.rb.tt +6 -1
- data/lib/dry/web/roda/templates/umbrella_project/boot.rb.tt +16 -0
- data/lib/dry/web/roda/templates/view_context.rb.tt +43 -0
- data/lib/dry/web/roda/templates/view_controller.rb.tt +17 -0
- data/lib/dry/web/roda/{skeletons/flat_project/web/templates → templates}/welcome.html.slim +0 -0
- data/lib/dry/web/roda/{skeletons/flat_project/lib/__underscored_app_name__/views → templates}/welcome.rb.tt +2 -2
- data/lib/dry/web/roda/version.rb +1 -1
- data/lib/roda/plugins/dry_view.rb +1 -1
- data/spec/support/project.rb +1 -1
- metadata +51 -116
- data/lib/dry/web/roda/skeletons/flat_project/README.md.tt +0 -12
- data/lib/dry/web/roda/skeletons/flat_project/Rakefile.tt +0 -81
- data/lib/dry/web/roda/skeletons/flat_project/config/settings.yml.tt +0 -8
- data/lib/dry/web/roda/skeletons/flat_project/lib/persistence/commands/.keep +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/lib/persistence/relations/.keep +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/log/.keep +0 -0
- data/lib/dry/web/roda/skeletons/flat_project/spec/app_helper.rb +0 -35
- data/lib/dry/web/roda/skeletons/flat_project/spec/db_helper.rb.tt +0 -24
- data/lib/dry/web/roda/skeletons/flat_project/spec/support/db/test_factories.rb +0 -3
- data/lib/dry/web/roda/skeletons/flat_project/spec/support/test_helpers.rb.tt +0 -15
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/container.rb.tt +0 -23
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/settings.rb.tt +0 -17
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/transactions.rb.tt +0 -34
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/view_context.rb.tt +0 -39
- data/lib/dry/web/roda/skeletons/flat_project/system/__underscored_app_name__/view_controller.rb.tt +0 -13
- data/lib/dry/web/roda/skeletons/flat_project/system/boot.rb.tt +0 -11
- data/lib/dry/web/roda/skeletons/flat_project/system/boot/rom.rb.tt +0 -32
- data/lib/dry/web/roda/skeletons/flat_project/system/boot/view.rb.tt +0 -3
- data/lib/dry/web/roda/skeletons/flat_project/transactions/example.rb.tt +0 -10
- data/lib/dry/web/roda/skeletons/sub_app/lib/__underscored_app_name__/.keep +0 -0
- data/lib/dry/web/roda/skeletons/sub_app/lib/__underscored_app_name__/views/welcome.rb.tt +0 -11
- data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/import.rb.tt +0 -5
- data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/view_context.rb.tt +0 -6
- data/lib/dry/web/roda/skeletons/sub_app/system/__underscored_app_name__/view_controller.rb.tt +0 -13
- data/lib/dry/web/roda/skeletons/sub_app/system/boot.rb.tt +0 -8
- data/lib/dry/web/roda/skeletons/sub_app/system/boot/view.rb.tt +0 -3
- data/lib/dry/web/roda/skeletons/sub_app/transactions/example.rb.tt +0 -9
- data/lib/dry/web/roda/skeletons/sub_app/web/routes/example.rb.tt +0 -7
- data/lib/dry/web/roda/skeletons/sub_app/web/templates/layouts/application.html.slim +0 -3
- data/lib/dry/web/roda/skeletons/sub_app/web/templates/welcome.html.slim +0 -1
- data/lib/dry/web/roda/skeletons/umbrella_project/.gitignore +0 -8
- data/lib/dry/web/roda/skeletons/umbrella_project/Gemfile +0 -40
- data/lib/dry/web/roda/skeletons/umbrella_project/Rakefile.tt +0 -81
- data/lib/dry/web/roda/skeletons/umbrella_project/bin/console.tt +0 -7
- data/lib/dry/web/roda/skeletons/umbrella_project/bin/setup +0 -7
- data/lib/dry/web/roda/skeletons/umbrella_project/config.ru.tt +0 -2
- data/lib/dry/web/roda/skeletons/umbrella_project/config/settings.yml.tt +0 -8
- data/lib/dry/web/roda/skeletons/umbrella_project/db/sample_data.rb +0 -1
- data/lib/dry/web/roda/skeletons/umbrella_project/db/seed.rb +0 -1
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/repository.rb.tt +0 -11
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/transactions.rb.tt +0 -33
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/__underscored_app_name__/view_context.rb.tt +0 -39
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/persistence/commands/.keep +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/persistence/relations/.keep +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/lib/types.rb +0 -6
- data/lib/dry/web/roda/skeletons/umbrella_project/log/.keep +0 -0
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/spec_helper.rb.tt +0 -61
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/support/db/test_factories.rb +0 -3
- data/lib/dry/web/roda/skeletons/umbrella_project/spec/support/test_helpers.rb.tt +0 -15
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/container.rb.tt +0 -18
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/import.rb.tt +0 -5
- data/lib/dry/web/roda/skeletons/umbrella_project/system/__underscored_app_name__/settings.rb.tt +0 -17
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot.rb.tt +0 -12
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot/monitor.rb.tt +0 -9
- data/lib/dry/web/roda/skeletons/umbrella_project/system/boot/rom.rb.tt +0 -32
@@ -1,36 +1,27 @@
|
|
1
1
|
require "securerandom"
|
2
|
-
require "dry/web/roda/
|
3
|
-
require "dry/web/roda/generators/inflections"
|
2
|
+
require "dry/web/roda/generators/abstract_project"
|
4
3
|
require "dry/web/roda/generators/sub_app"
|
5
4
|
|
6
5
|
module Dry
|
7
6
|
module Web
|
8
7
|
module Roda
|
9
8
|
module Generators
|
10
|
-
class UmbrellaProject
|
11
|
-
|
9
|
+
class UmbrellaProject < AbstractProject
|
10
|
+
private
|
12
11
|
|
13
|
-
def
|
14
|
-
|
15
|
-
@sub_app_generator = Generators::SubApp.new
|
12
|
+
def add_boot
|
13
|
+
add_template("umbrella_project/boot.rb.tt", "system/boot.rb")
|
16
14
|
end
|
17
15
|
|
18
|
-
def
|
19
|
-
|
16
|
+
def add_application
|
17
|
+
add_template("umbrella_project/application.rb.tt", "system/#{underscored_project_name}/application.rb")
|
18
|
+
end
|
20
19
|
|
20
|
+
def post_process_callback
|
21
21
|
Dir.chdir(target_dir) do
|
22
|
-
|
22
|
+
Generators::SubApp.new("main", umbrella: target_dir).call
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def prepare_scope(target_dir)
|
29
|
-
{
|
30
|
-
underscored_app_name: Inflections.underscored_name(target_dir),
|
31
|
-
camel_cased_app_name: Inflections.camel_cased_name(target_dir)
|
32
|
-
}
|
33
|
-
end
|
34
25
|
end
|
35
26
|
end
|
36
27
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
DATABASE_URL='postgres://localhost/<%= config[:underscored_project_name] %>_test'
|
data/lib/dry/web/roda/{skeletons/flat_project/lib/__underscored_app_name__ → templates}/.keep
RENAMED
File without changes
|
@@ -3,7 +3,8 @@ source "https://rubygems.org"
|
|
3
3
|
gem "rake"
|
4
4
|
|
5
5
|
# Web framework
|
6
|
-
gem "dry-
|
6
|
+
gem "dry-system", ">= 0.7.1"
|
7
|
+
gem "dry-web", ">= 0.7.0"
|
7
8
|
gem "dry-web-roda", ">= 0.6.0"
|
8
9
|
gem "puma"
|
9
10
|
gem "rack_csrf"
|
@@ -21,10 +22,10 @@ gem "rom-sql", ">= 1.1.0"
|
|
21
22
|
gem "dry-matcher"
|
22
23
|
gem "dry-monads"
|
23
24
|
gem "dry-struct"
|
24
|
-
gem "dry-transaction"
|
25
|
+
gem "dry-transaction", ">= 0.10.0"
|
25
26
|
gem "dry-types"
|
26
27
|
gem "dry-validation"
|
27
|
-
gem "dry-view", ">= 0.
|
28
|
+
gem "dry-view", ">= 0.3.0"
|
28
29
|
gem "slim"
|
29
30
|
|
30
31
|
group :development, :test do
|
@@ -5,8 +5,8 @@ Welcome! You’ve generated an app using dry-web-roda.
|
|
5
5
|
## First steps
|
6
6
|
|
7
7
|
1. Run `bundle`
|
8
|
-
1. Review `
|
9
|
-
1. Create a
|
8
|
+
1. Review `.env` & `.env.test` (and make a copy to e.g. `.example.env` if you want example settings checked in)
|
9
|
+
1. Create a `blog_development` database
|
10
10
|
1. Add your own steps to `bin/setup`
|
11
11
|
1. Run the app with `bundle exec shotgun -p 3000 -o 0.0.0.0 config.ru`
|
12
12
|
1. Initialize git with `git init` and make your initial commit
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "byebug" unless ENV["RACK_ENV"] == "production"
|
3
|
+
require "rom/sql/rake_task"
|
4
|
+
require "shellwords"
|
5
|
+
require_relative "system/<%= config[:underscored_project_name] %>/container"
|
6
|
+
|
7
|
+
begin
|
8
|
+
require "rspec/core/rake_task"
|
9
|
+
RSpec::Core::RakeTask.new :spec
|
10
|
+
task default: [:spec]
|
11
|
+
rescue LoadError
|
12
|
+
end
|
13
|
+
|
14
|
+
def db
|
15
|
+
<%= config[:camel_cased_app_name] %>::Container["persistence.db"]
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :db do
|
19
|
+
task :setup do
|
20
|
+
<%= config[:camel_cased_app_name] %>::Container.boot :rom
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Prints current schema version"
|
24
|
+
task version: :setup do
|
25
|
+
version =
|
26
|
+
if db.tables.include?(:schema_migrations)
|
27
|
+
db[:schema_migrations].order(:filename).last[:filename]
|
28
|
+
else
|
29
|
+
"not available"
|
30
|
+
end
|
31
|
+
|
32
|
+
puts "Current schema version: #{version}"
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Perform migration up to latest migration available"
|
36
|
+
task :migrate do
|
37
|
+
# Enhance the migration task provided by ROM
|
38
|
+
|
39
|
+
# Once it finishes, dump the db structure
|
40
|
+
Rake::Task["db:structure:dump"].execute
|
41
|
+
|
42
|
+
# And print the current migration version
|
43
|
+
Rake::Task["db:version"].execute
|
44
|
+
end
|
45
|
+
|
46
|
+
namespace :structure do
|
47
|
+
desc "Dump database structure to db/structure.sql"
|
48
|
+
task :dump do
|
49
|
+
if system("which pg_dump", out: File::NULL)
|
50
|
+
system(%(pg_dump -s -x -O #{Shellwords.escape(db.url)} > db/structure.sql))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Load seed data into the database"
|
56
|
+
task :seed do
|
57
|
+
seed_data = File.join("db", "seed.rb")
|
58
|
+
load(seed_data) if File.exist?(seed_data)
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Load a small, representative set of data so that the application can start in a useful state (for development)."
|
62
|
+
task :sample_data do
|
63
|
+
sample_data = File.join("db", "sample_data.rb")
|
64
|
+
load(sample_data) if File.exist?(sample_data)
|
65
|
+
end
|
66
|
+
end
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= config[:camel_cased_app_name] %>::Container.finalize :settings do |container|
|
2
|
+
init do
|
3
|
+
require "<%= config[:underscored_project_name] %>/settings"
|
4
|
+
end
|
5
|
+
|
6
|
+
start do
|
7
|
+
settings = <%= config[:camel_cased_app_name] %>::Settings.load(container.config.root, container.config.env)
|
8
|
+
container.register "settings", settings
|
9
|
+
end
|
10
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "dry/web/container"
|
2
|
+
|
3
|
+
module <%= config[:camel_cased_app_name] %>
|
4
|
+
class Container < Dry::Web::Container
|
5
|
+
configure do
|
6
|
+
config.name = :<%= config[:underscored_project_name] %>
|
7
|
+
config.listeners = true
|
8
|
+
config.default_namespace = "<%= config[:underscored_project_name] %>"
|
9
|
+
config.auto_register = %w[lib/<%= config[:underscored_project_name] %>]
|
10
|
+
end
|
11
|
+
|
12
|
+
load_paths! "lib"
|
13
|
+
end
|
14
|
+
end
|
File without changes
|
@@ -10,7 +10,7 @@ module <%= config[:camel_cased_app_name] %>
|
|
10
10
|
|
11
11
|
opts[:root] = Pathname(__FILE__).join("../..").realpath.dirname
|
12
12
|
|
13
|
-
use Rack::Session::Cookie, key: "<%= config[:
|
13
|
+
use Rack::Session::Cookie, key: "<%= config[:underscored_project_name] %>.session", secret: self["settings"].session_secret
|
14
14
|
|
15
15
|
plugin :csrf, raise: true
|
16
16
|
plugin :flash
|
@@ -24,6 +24,11 @@ module <%= config[:camel_cased_app_name] %>
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
error do |e|
|
28
|
+
self.class[:rack_monitor].instrument(:error, exception: e)
|
29
|
+
raise e
|
30
|
+
end
|
31
|
+
|
27
32
|
load_routes!
|
28
33
|
end
|
29
34
|
end
|
File without changes
|
File without changes
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# auto_register: false
|
2
|
+
|
1
3
|
require "rom-repository"
|
2
|
-
require "<%= config[:
|
3
|
-
require "<%= config[:
|
4
|
+
require "<%= config[:underscored_project_name] %>/container"
|
5
|
+
require "<%= config[:underscored_project_name] %>/import"
|
4
6
|
|
5
7
|
<%= config[:camel_cased_app_name] %>::Container.boot! :rom
|
6
8
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= config[:camel_cased_app_name] %>::Container.namespace "persistence" do |container|
|
2
|
+
container.finalize :rom do
|
3
|
+
init do
|
4
|
+
require "sequel"
|
5
|
+
require "rom"
|
6
|
+
require "rom/sql"
|
7
|
+
|
8
|
+
use :settings
|
9
|
+
use :monitor
|
10
|
+
|
11
|
+
ROM::SQL.load_extensions :postgres
|
12
|
+
|
13
|
+
Sequel.database_timezone = :utc
|
14
|
+
Sequel.application_timezone = :local
|
15
|
+
|
16
|
+
rom_config = ROM::Configuration.new(
|
17
|
+
:sql,
|
18
|
+
container["settings"].database_url,
|
19
|
+
extensions: %i[error_sql pg_array pg_json],
|
20
|
+
)
|
21
|
+
|
22
|
+
rom_config.plugin :sql, relations: :instrumentation do |plugin_config|
|
23
|
+
plugin_config.notifications = notifications
|
24
|
+
end
|
25
|
+
|
26
|
+
rom_config.plugin :sql, relations: :auto_restrictions
|
27
|
+
|
28
|
+
container.register "config", rom_config
|
29
|
+
container.register "db", rom_config.gateways[:default].connection
|
30
|
+
end
|
31
|
+
|
32
|
+
start do
|
33
|
+
config = container["persistence.config"]
|
34
|
+
config.auto_registration container.root.join("lib/persistence")
|
35
|
+
|
36
|
+
container.register "rom", ROM.container(config)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require "dry/web/settings"
|
2
|
+
require "types"
|
3
|
+
|
4
|
+
module <%= config[:camel_cased_app_name] %>
|
5
|
+
class Settings < Dry::Web::Settings
|
6
|
+
setting :database_url, Types::Strict::String.constrained(filled: true)
|
7
|
+
setting :session_secret, Types::Strict::String.constrained(filled: true)
|
8
|
+
end
|
9
|
+
end
|
File without changes
|
@@ -6,11 +6,10 @@ Dir[SPEC_ROOT.join("support/db/*.rb").to_s].each(&method(:require))
|
|
6
6
|
Dir[SPEC_ROOT.join("shared/db/*.rb").to_s].each(&method(:require))
|
7
7
|
|
8
8
|
require "database_cleaner"
|
9
|
-
DatabaseCleaner[:sequel, connection:
|
9
|
+
DatabaseCleaner[:sequel, connection: Test::DatabaseHelpers.db].strategy = :truncation
|
10
10
|
|
11
11
|
RSpec.configure do |config|
|
12
|
-
config.include
|
13
|
-
config.include TestFactories
|
12
|
+
config.include Test::DatabaseHelpers
|
14
13
|
|
15
14
|
config.before :suite do
|
16
15
|
DatabaseCleaner.clean_with :truncation
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Define your factories here, e.g.
|
2
|
+
#
|
3
|
+
# Factory.define :article do |f|
|
4
|
+
# f.sequence(:slug) { |i| "article-#{i}" }
|
5
|
+
# f.title { fake(:lorem, :words, 5) }
|
6
|
+
# f.body { fake(:lorem, :paragraphs, 1) }
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# See https://github.com/rom-rb/rom-factory for more.
|
@@ -7,7 +7,7 @@ SPEC_ROOT = Pathname(__FILE__).dirname
|
|
7
7
|
Dir[SPEC_ROOT.join("support/*.rb").to_s].each(&method(:require))
|
8
8
|
Dir[SPEC_ROOT.join("shared/*.rb").to_s].each(&method(:require))
|
9
9
|
|
10
|
-
require SPEC_ROOT.join("../system/<%= config[:
|
10
|
+
require SPEC_ROOT.join("../system/<%= config[:underscored_project_name] %>/container")
|
11
11
|
|
12
12
|
RSpec.configure do |config|
|
13
13
|
config.disable_monkey_patching!
|
@@ -1,16 +1,16 @@
|
|
1
|
-
require_relative "
|
1
|
+
require_relative "db_spec_helper"
|
2
2
|
|
3
3
|
require "rack/test"
|
4
4
|
require "capybara/rspec"
|
5
5
|
require "capybara-screenshot/rspec"
|
6
6
|
require "capybara/poltergeist"
|
7
7
|
|
8
|
-
Dir[SPEC_ROOT.join("support/
|
9
|
-
Dir[SPEC_ROOT.join("shared/
|
8
|
+
Dir[SPEC_ROOT.join("support/web/*.rb").to_s].each(&method(:require))
|
9
|
+
Dir[SPEC_ROOT.join("shared/web/*.rb").to_s].each(&method(:require))
|
10
10
|
|
11
11
|
require SPEC_ROOT.join("../system/boot").realpath
|
12
12
|
|
13
|
-
Capybara.app =
|
13
|
+
Capybara.app = Test::WebHelpers.app
|
14
14
|
Capybara.server_port = 3001
|
15
15
|
Capybara.save_and_open_page_path = "#{File.dirname(__FILE__)}/../tmp/capybara-screenshot"
|
16
16
|
Capybara.javascript_driver = :poltergeist
|
@@ -21,15 +21,17 @@ Capybara.register_driver :poltergeist do |app|
|
|
21
21
|
app,
|
22
22
|
js_errors: false,
|
23
23
|
phantomjs_logger: File.open(SPEC_ROOT.join("../log/phantomjs.log"), "w"),
|
24
|
-
phantomjs_options: %w(--load-images=no)
|
24
|
+
phantomjs_options: %w(--load-images=no),
|
25
|
+
window_size: [1600, 768],
|
25
26
|
)
|
26
27
|
end
|
27
28
|
|
28
29
|
RSpec.configure do |config|
|
29
30
|
config.include Rack::Test::Methods, type: :request
|
30
31
|
config.include Rack::Test::Methods, Capybara::DSL, type: :feature
|
32
|
+
config.include Test::WebHelpers
|
31
33
|
|
32
34
|
config.before :suite do
|
33
|
-
|
35
|
+
Test::WebHelpers.app.freeze
|
34
36
|
end
|
35
37
|
end
|