rom-lotus 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.lotusrc +3 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +79 -0
  6. data/.travis.yml +22 -0
  7. data/CHANGELOG.md +3 -0
  8. data/Gemfile +25 -0
  9. data/LICENSE +20 -0
  10. data/README.md +36 -0
  11. data/Rakefile +25 -0
  12. data/db/migrate/20150325210143_create_posts.rb +8 -0
  13. data/lib/rom-lotus.rb +43 -0
  14. data/lib/rom/lotus/version.rb +5 -0
  15. data/log/.keep +0 -0
  16. data/rom-lotus.gemspec +26 -0
  17. data/spec/.lotusrc +3 -0
  18. data/spec/dummy/.gitignore +2 -0
  19. data/spec/dummy/.lotusrc +3 -0
  20. data/spec/dummy/.rspec +2 -0
  21. data/spec/dummy/Rakefile +5 -0
  22. data/spec/dummy/apps/web/application.rb +27 -0
  23. data/spec/dummy/apps/web/config/routes.rb +1 -0
  24. data/spec/dummy/apps/web/controllers/posts/index.rb +16 -0
  25. data/spec/dummy/apps/web/templates/application.html.erb +9 -0
  26. data/spec/dummy/apps/web/templates/posts/index.html.erb +7 -0
  27. data/spec/dummy/apps/web/views/application_layout.rb +7 -0
  28. data/spec/dummy/apps/web/views/posts/index.rb +5 -0
  29. data/spec/dummy/config.ru +3 -0
  30. data/spec/dummy/config/.env +1 -0
  31. data/spec/dummy/config/.env.development +4 -0
  32. data/spec/dummy/config/.env.test +4 -0
  33. data/spec/dummy/config/environment.rb +15 -0
  34. data/spec/dummy/db/.gitkeep +1 -0
  35. data/spec/dummy/lib/dummy.rb +0 -0
  36. data/spec/dummy/lib/dummy/relations/posts.rb +11 -0
  37. data/spec/dummy/spec/features_helper.rb +12 -0
  38. data/spec/dummy/spec/spec_helper.rb +102 -0
  39. data/spec/dummy/spec/support/.gitkeep +1 -0
  40. data/spec/dummy/spec/support/capybara.rb +8 -0
  41. data/spec/dummy/spec/web/features/.gitkeep +1 -0
  42. data/spec/dummy/spec/web/features/posts_spec.rb +12 -0
  43. data/spec/spec_helper.rb +28 -0
  44. metadata +190 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 03d69f0a0aeb863fd58fc3d62c9047e16f2d4035
4
+ data.tar.gz: a5c5d099a9880bf2b5ad142ab6c37ffb825c33c6
5
+ SHA512:
6
+ metadata.gz: 9b138673a0cb70dbe971938a6d8605a76ac800a8504d52d0ca7337772cf9779d00201c8fec188b16f0a72566fc46aa3b80eab0d7eef006a8061bd6f0b720b573
7
+ data.tar.gz: ee61f970761cfbbb68f7173140f5576c6820e7c3213a0c716acc36526d782c91500854f69a1dc59a563dcb3f9359eaded5b87ab333492f5603b4d325250c72d8
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .ruby-version
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ spec/dummy/db/*.sqlite3
20
+ spec/dummy/tmp
21
+ spec/dummy/log
data/.lotusrc ADDED
@@ -0,0 +1,3 @@
1
+ architecture=container
2
+ test=minitest
3
+ template=erb
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,79 @@
1
+ # FIXME: Lower by refactoring biggest offenders
2
+ Metrics/AbcSize:
3
+ Max: 26
4
+
5
+ # FIXME: Lower by refactoring biggest offenders
6
+ Metrics/CyclomaticComplexity:
7
+ Max: 8
8
+
9
+ # FIXME: No clue how to fix that one line…
10
+ Metrics/LineLength:
11
+ Max: 100
12
+
13
+ # FIXME: Lower by refactoring biggest offenders
14
+ Metrics/MethodLength:
15
+ Max: 22
16
+
17
+ # FIXME: Lower by refactoring biggest offenders
18
+ Metrics/PerceivedComplexity:
19
+ Max: 10
20
+
21
+ # Don’t check temp and Lotus-generated files
22
+ AllCops:
23
+ Exclude:
24
+ - spec/dummy/Rakefile
25
+ - spec/dummy/config/**/*
26
+ - spec/dummy/db/schema.rb
27
+ - spec/dummy/db/seeds.rb
28
+ - tmp/**/*
29
+ - vendor/**/*
30
+
31
+ # The enforced style doesn’t match Vim’s defaults
32
+ Style/AlignParameters:
33
+ Enabled: false
34
+
35
+ # UTF-8 is perfectly fine in comments
36
+ Style/AsciiComments:
37
+ Enabled: false
38
+
39
+ # Allow using braces for value-returning blocks
40
+ Style/Blocks:
41
+ Enabled: false
42
+
43
+ Style/BracesAroundHashParameters:
44
+ Enabled: true
45
+ EnforcedStyle: context_dependent
46
+
47
+ # Documentation checked by Inch CI
48
+ Style/Documentation:
49
+ Enabled: false
50
+
51
+ # This is a shim file for those who require 'rom-lotus'
52
+ Style/FileName:
53
+ Exclude:
54
+ - lib/rom-lotus.rb
55
+
56
+ # Early returns have their vices
57
+ Style/GuardClause:
58
+ Enabled: false
59
+
60
+ # Multiline block chains are ok
61
+ Style/MultilineBlockChain:
62
+ Enabled: false
63
+
64
+ # Model::Validator uses Model::ValidationError for this
65
+ Style/RaiseArgs:
66
+ Exclude:
67
+ - lib/rom/model.rb
68
+
69
+ # Even a single escaped slash can be confusing
70
+ Style/RegexpLiteral:
71
+ MaxSlashes: 0
72
+
73
+ # Don’t introduce semantic fail/raise distinction
74
+ Style/SignalException:
75
+ EnforcedStyle: only_raise
76
+
77
+ # Accept both single and double quotes
78
+ Style/StringLiterals:
79
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,22 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ bundler_args: --without yard guard benchmarks
5
+ env:
6
+ - CODECLIMATE_REPO_TOKEN=TODO
7
+ script: "bundle exec rake db:migrate spec"
8
+ rvm:
9
+ - 2.0
10
+ - 2.1
11
+ - 2.2
12
+ - ruby-head
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: ruby-head
16
+ notifications:
17
+ webhooks:
18
+ urls:
19
+ - https://webhooks.gitter.im/e/39e1225f489f38b0bd09
20
+ on_success: change
21
+ on_failure: always
22
+ on_start: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## v0.0.1 2015-04-04
2
+
3
+ First public release \o/
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'sqlite3', platforms: [:mri, :rbx]
6
+
7
+ gem 'lotusrb'
8
+ gem 'lotus-controller'
9
+ gem 'lotus-router'
10
+ gem 'lotus-view'
11
+
12
+ platforms :jruby do
13
+ gem 'jdbc-sqlite3'
14
+ gem 'activerecord-jdbc-adapter'
15
+ end
16
+
17
+ group :test do
18
+ gem 'rom', github: 'rom-rb/rom', branch: 'master'
19
+ gem 'rom-sql', github: 'rom-rb/rom-sql', branch: 'master'
20
+ gem 'rspec', '~> 3.2'
21
+ gem 'codeclimate-test-reporter', require: nil
22
+ gem 'database_cleaner'
23
+ gem 'capybara'
24
+ gem 'byebug', platform: :mri
25
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Ruby Object Mapper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ [gem]: https://rubygems.org/gems/rom-lotus
2
+ [travis]: https://travis-ci.org/rom-rb/rom-lotus
3
+ [gemnasium]: https://gemnasium.com/rom-rb/rom-lotus
4
+ [codeclimate]: https://codeclimate.com/github/rom-rb/rom-lotus
5
+ [coveralls]: https://coveralls.io/r/rom-rb/rom-lotus
6
+ [inchpages]: http://inch-ci.org/github/rom-rb/rom-lotus
7
+
8
+ # rom-lotus
9
+
10
+ [![Gem Version](https://badge.fury.io/rb/rom-lotus.svg)][gem]
11
+ [![Build Status](https://travis-ci.org/rom-rb/rom-lotus.svg?branch=master)][travis]
12
+ [![Dependency Status](https://gemnasium.com/rom-rb/rom-lotus.png)][gemnasium]
13
+ [![Code Climate](https://codeclimate.com/github/rom-rb/rom-lotus/badges/gpa.svg)][codeclimate]
14
+ [![Test Coverage](https://codeclimate.com/github/rom-rb/rom-lotus/badges/coverage.svg)][codeclimate]
15
+ [![Inline docs](http://inch-ci.org/github/rom-rb/rom-lotus.svg?branch=master)][inchpages]
16
+
17
+ Lotus integration for [Ruby Object Mapper](https://github.com/rom-rb/rom).
18
+
19
+ ## Issues
20
+
21
+ Please report any issues in the main [rom-rb/rom](https://github.com/rom-rb/rom/issues) issue tracker.
22
+
23
+ ## Resources
24
+
25
+ You can read more about ROM and Lotus on the official website:
26
+
27
+ * [Introduction to ROM](http://rom-rb.org/introduction)
28
+
29
+ ## Community
30
+
31
+ * [![Gitter chat](https://badges.gitter.im/rom-rb/chat.png)](https://gitter.im/rom-rb/chat)
32
+ * [Ruby Object Mapper](https://groups.google.com/forum/#!forum/rom-rb) mailing list
33
+
34
+ ## License
35
+
36
+ See `LICENSE` file.
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'bundler/setup'
2
+ require 'rubocop/rake_task'
3
+ require 'rspec/core/rake_task'
4
+ require 'rom/sql/rake_task'
5
+
6
+ ENV['LOTUS_ENV'] = 'test'
7
+
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.rspec_opts = '-r ./spec/spec_helper'
10
+ t.pattern = 'spec/dummy/spec/**/*_spec.rb'
11
+ end
12
+
13
+ task default: %w(spec)
14
+
15
+ RuboCop::RakeTask.new do |task|
16
+ task.options << '--display-cop-names'
17
+ end
18
+
19
+ namespace :db do
20
+ task :setup do
21
+ require './spec/dummy/config/environment'
22
+ Lotus::Application.preload!
23
+ Lotus::Container.new
24
+ end
25
+ end
@@ -0,0 +1,8 @@
1
+ ROM::SQL.migration do
2
+ change do
3
+ create_table :posts do
4
+ primary_key :id
5
+ String :title
6
+ end
7
+ end
8
+ end
data/lib/rom-lotus.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'rom'
2
+ require 'rom/lotus/version'
3
+
4
+ module ROM
5
+ module Lotus
6
+ class << self
7
+ attr_reader :config
8
+ end
9
+
10
+ class Config
11
+ attr_reader :root
12
+
13
+ attr_reader :repositories
14
+
15
+ def initialize(root)
16
+ @root = root
17
+ @repositories = {}
18
+ end
19
+
20
+ def db_dir
21
+ root.join('db')
22
+ end
23
+ end
24
+
25
+ def self.setup(app)
26
+ app.synchronize do
27
+ @config = Config.new(app.configuration.root.join('../..').realpath)
28
+
29
+ yield(@config)
30
+
31
+ ROM.setup(config.repositories)
32
+
33
+ %w(relations mappers commands).each do |component|
34
+ Dir["#{config.root}/lib/*/#{component}/**/*.rb"].each do |file|
35
+ require file
36
+ end
37
+ end
38
+
39
+ ROM.finalize
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ module ROM
2
+ module Lotus
3
+ VERSION = '0.0.1'.freeze
4
+ end
5
+ end
data/log/.keep ADDED
File without changes
data/rom-lotus.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rom/lotus/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rom-lotus"
8
+ spec.version = ROM::Lotus::VERSION.dup
9
+ spec.authors = ["Piotr Solnica"]
10
+ spec.email = ["piotr.solnica@gmail.com"]
11
+ spec.summary = 'Integrate Ruby Object Mapper with Lotus'
12
+ spec.homepage = "http://rom-rb.org"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'rom', '~> 0.6.0', '>= 0.6.1'
21
+ spec.add_runtime_dependency 'inflecto'
22
+
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rubocop", "~> 0.28.0"
26
+ end
data/spec/.lotusrc ADDED
@@ -0,0 +1,3 @@
1
+ architecture=container
2
+ test=minitest
3
+ template=erb
@@ -0,0 +1,2 @@
1
+ /db/dummy_development
2
+ /db/dummy_test
@@ -0,0 +1,3 @@
1
+ architecture=container
2
+ test=rspec
3
+ template=erb
data/spec/dummy/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
@@ -0,0 +1,27 @@
1
+ module Web
2
+ class Application < Lotus::Application
3
+ configure do
4
+ root __dir__
5
+
6
+ routes 'config/routes'
7
+
8
+ load_paths << [
9
+ 'controllers',
10
+ 'views'
11
+ ]
12
+
13
+ layout :application
14
+
15
+ controller.prepare do
16
+
17
+ end
18
+
19
+ security.x_frame_options "DENY"
20
+ security.content_security_policy "default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self';"
21
+
22
+ configure :test do
23
+ handle_exceptions false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1 @@
1
+ get '/posts', to: 'posts#index'
@@ -0,0 +1,16 @@
1
+ module Web::Controllers::Posts
2
+ class Index
3
+ include Web::Action
4
+
5
+ expose :posts
6
+
7
+ def call(params)
8
+ @posts = rom.relation(:posts).latest
9
+ end
10
+
11
+ # Cutting corners like a boss, DI will be added soon
12
+ def rom
13
+ ROM.env
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ <!doctype HTML>
2
+ <html>
3
+ <head>
4
+ <title>Web</title>
5
+ </head>
6
+ <body>
7
+ <%= yield %>
8
+ </body>
9
+ </html>
@@ -0,0 +1,7 @@
1
+ <h1>Posts</h1>
2
+
3
+ <ul>
4
+ <% posts.each do |post| %>
5
+ <li><%= post[:title] %></li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1,7 @@
1
+ module Web
2
+ module Views
3
+ class ApplicationLayout
4
+ include Web::Layout
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Web::Views::Posts
2
+ class Index
3
+ include Web::View
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ require './config/environment'
2
+
3
+ run Lotus::Container.new
@@ -0,0 +1 @@
1
+ # Define ENV variables
@@ -0,0 +1,4 @@
1
+ # Define ENV variables for development environment
2
+ DUMMY_DATABASE_URL="file:///db/dummy_development"
3
+ WEB_DATABASE_URL="file:///db/web_development"
4
+ WEB_SESSIONS_SECRET="3e4282e5a963b28a6f106908226df1ad838ab0748479f33f7d3d677b6d033967"
@@ -0,0 +1,4 @@
1
+ # Define ENV variables for test environment
2
+ DUMMY_DATABASE_URL="file:///db/dummy_test"
3
+ WEB_DATABASE_URL="file:///db/web_test"
4
+ WEB_SESSIONS_SECRET="0f0d964deec60369443a89d062249a8ef04553db5f5f38a3c71026823bfbbdbf"
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'lotus/setup'
4
+ require 'rom-lotus'
5
+
6
+ require_relative '../lib/dummy'
7
+ require_relative '../apps/web/application'
8
+
9
+ Lotus::Container.configure do
10
+ mount Web::Application, at: '/'
11
+
12
+ ROM::Lotus.setup(Web::Application) do |setup|
13
+ setup.repositories[:default] = [:sql, "sqlite:///tmp/test.sqlite"]
14
+ end
15
+ end
@@ -0,0 +1 @@
1
+ #
File without changes
@@ -0,0 +1,11 @@
1
+ module Dummy
2
+ module Relations
3
+ class Posts < ROM::Relation[:sql]
4
+ dataset :posts
5
+
6
+ def latest
7
+ order(:id).reverse
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # Require this file for feature tests
2
+ require_relative './spec_helper'
3
+
4
+ require 'capybara'
5
+ require 'capybara/rspec'
6
+
7
+ RSpec.configure do |config|
8
+ config.include RSpec::FeatureExampleGroup
9
+
10
+ config.include Capybara::DSL, feature: true
11
+ config.include Capybara::RSpecMatchers, feature: true
12
+ end
@@ -0,0 +1,102 @@
1
+ # Require this file for unit tests
2
+ ENV['LOTUS_ENV'] ||= 'test'
3
+
4
+ require_relative '../config/environment'
5
+
6
+ Dir[__dir__ + '/support/**/*.rb'].each { |f| require f }
7
+
8
+ # This file was generated by the `rspec --init` command. Conventionally, all
9
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
10
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
11
+ # this file to always be loaded, without a need to explicitly require it in any
12
+ # files.
13
+ #
14
+ # Given that it is always loaded, you are encouraged to keep this file as
15
+ # light-weight as possible. Requiring heavyweight dependencies from this file
16
+ # will add to the boot time of your test suite on EVERY test run, even for an
17
+ # individual file that may not need all of that loaded. Instead, consider making
18
+ # a separate helper file that requires the additional dependencies and performs
19
+ # the additional setup, and require it from the spec files that actually need
20
+ # it.
21
+ #
22
+ # The `.rspec` file also contains a few flags that are not defaults but that
23
+ # users commonly want.
24
+ #
25
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
26
+ RSpec.configure do |config|
27
+ # Preload application for testing in isolation components
28
+ config.before(:suite) { Lotus::Application.preload! }
29
+
30
+ # rspec-expectations config goes here. You can use an alternate
31
+ # assertion/expectation library such as wrong or the stdlib/minitest
32
+ # assertions if you prefer.
33
+ config.expect_with :rspec do |expectations|
34
+ # This option will default to `true` in RSpec 4. It makes the `description`
35
+ # and `failure_message` of custom matchers include text for helper methods
36
+ # defined using `chain`, e.g.:
37
+ # be_bigger_than(2).and_smaller_than(4).description
38
+ # # => "be bigger than 2 and smaller than 4"
39
+ # ...rather than:
40
+ # # => "be bigger than 2"
41
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
42
+ end
43
+
44
+ # rspec-mocks config goes here. You can use an alternate test double
45
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
46
+ config.mock_with :rspec do |mocks|
47
+ # Prevents you from mocking or stubbing a method that does not exist on
48
+ # a real object. This is generally recommended, and will default to
49
+ # `true` in RSpec 4.
50
+ mocks.verify_partial_doubles = true
51
+ end
52
+
53
+ # The settings below are suggested to provide a good initial experience
54
+ # with RSpec, but feel free to customize to your heart's content.
55
+ =begin
56
+ # These two settings work together to allow you to limit a spec run
57
+ # to individual examples or groups you care about by tagging them with
58
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
59
+ # get run.
60
+ config.filter_run :focus
61
+ config.run_all_when_everything_filtered = true
62
+
63
+ # Limits the available syntax to the non-monkey patched syntax that is
64
+ # recommended. For more details, see:
65
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
66
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
68
+ config.disable_monkey_patching!
69
+
70
+ # This setting enables warnings. It's recommended, but in some cases may
71
+ # be too noisy due to issues in dependencies.
72
+ config.warnings = true
73
+
74
+ # Many RSpec users commonly either run the entire suite or an individual
75
+ # file, and it's useful to allow more verbose output when running an
76
+ # individual spec file.
77
+ if config.files_to_run.one?
78
+ # Use the documentation formatter for detailed output,
79
+ # unless a formatter has already been configured
80
+ # (e.g. via a command-line flag).
81
+ config.default_formatter = 'doc'
82
+ end
83
+
84
+ # Print the 10 slowest examples and example groups at the
85
+ # end of the spec run, to help surface which specs are running
86
+ # particularly slow.
87
+ config.profile_examples = 10
88
+
89
+ # Run specs in random order to surface order dependencies. If you find an
90
+ # order dependency and want to debug it, you can fix the order by providing
91
+ # the seed, which is printed after each run.
92
+ # --seed 1234
93
+ config.order = :random
94
+
95
+ # Seed global randomization in this process using the `--seed` CLI option.
96
+ # Setting this allows you to use `--seed` to deterministically reproduce
97
+ # test failures related to randomization by passing the same `--seed` value
98
+ # as the one that triggered the failure.
99
+ Kernel.srand config.seed
100
+ =end
101
+ end
102
+
@@ -0,0 +1 @@
1
+ #
@@ -0,0 +1,8 @@
1
+ module RSpec
2
+ module FeatureExampleGroup
3
+ def self.included(group)
4
+ group.metadata[:type] = :feature
5
+ Capybara.app = Lotus::Container.new
6
+ end
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ #
@@ -0,0 +1,12 @@
1
+ require 'features_helper'
2
+
3
+ feature 'Posts' do
4
+ background do
5
+ rom.relations[:posts].insert(title: 'Hello world')
6
+ end
7
+
8
+ scenario 'I can see a list of posts' do
9
+ visit '/posts'
10
+ expect(page).to have_content('Hello world')
11
+ end
12
+ end
@@ -0,0 +1,28 @@
1
+ if RUBY_ENGINE == 'rbx'
2
+ require "codeclimate-test-reporter"
3
+ CodeClimate::TestReporter.start
4
+ end
5
+
6
+ begin
7
+ require 'byebug'
8
+ rescue LoadError
9
+ end
10
+
11
+ root = Pathname(__FILE__).join('../../').expand_path
12
+ $LOAD_PATH.unshift(root.join('spec/dummy/spec'))
13
+
14
+ require 'database_cleaner'
15
+
16
+ Dir[root.join("spec/support/**/*.rb")].each { |f| require f }
17
+
18
+ RSpec.configure do |config|
19
+ config.order = "random"
20
+
21
+ config.before(:all) do
22
+ # DatabaseCleaner.clean_with(:truncation)
23
+ end
24
+ end
25
+
26
+ def rom
27
+ ROM.env
28
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rom-lotus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Solnica
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rom
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.6.0
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.6.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 0.6.0
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.6.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: inflecto
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.28.0
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 0.28.0
89
+ description:
90
+ email:
91
+ - piotr.solnica@gmail.com
92
+ executables: []
93
+ extensions: []
94
+ extra_rdoc_files: []
95
+ files:
96
+ - ".gitignore"
97
+ - ".lotusrc"
98
+ - ".rspec"
99
+ - ".rubocop.yml"
100
+ - ".travis.yml"
101
+ - CHANGELOG.md
102
+ - Gemfile
103
+ - LICENSE
104
+ - README.md
105
+ - Rakefile
106
+ - db/migrate/20150325210143_create_posts.rb
107
+ - lib/rom-lotus.rb
108
+ - lib/rom/lotus/version.rb
109
+ - log/.keep
110
+ - rom-lotus.gemspec
111
+ - spec/.lotusrc
112
+ - spec/dummy/.gitignore
113
+ - spec/dummy/.lotusrc
114
+ - spec/dummy/.rspec
115
+ - spec/dummy/Rakefile
116
+ - spec/dummy/apps/web/application.rb
117
+ - spec/dummy/apps/web/config/routes.rb
118
+ - spec/dummy/apps/web/controllers/posts/index.rb
119
+ - spec/dummy/apps/web/templates/application.html.erb
120
+ - spec/dummy/apps/web/templates/posts/index.html.erb
121
+ - spec/dummy/apps/web/views/application_layout.rb
122
+ - spec/dummy/apps/web/views/posts/index.rb
123
+ - spec/dummy/config.ru
124
+ - spec/dummy/config/.env
125
+ - spec/dummy/config/.env.development
126
+ - spec/dummy/config/.env.test
127
+ - spec/dummy/config/environment.rb
128
+ - spec/dummy/db/.gitkeep
129
+ - spec/dummy/lib/dummy.rb
130
+ - spec/dummy/lib/dummy/relations/posts.rb
131
+ - spec/dummy/spec/features_helper.rb
132
+ - spec/dummy/spec/spec_helper.rb
133
+ - spec/dummy/spec/support/.gitkeep
134
+ - spec/dummy/spec/support/capybara.rb
135
+ - spec/dummy/spec/web/features/.gitkeep
136
+ - spec/dummy/spec/web/features/posts_spec.rb
137
+ - spec/spec_helper.rb
138
+ homepage: http://rom-rb.org
139
+ licenses:
140
+ - MIT
141
+ metadata: {}
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 2.4.5
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: Integrate Ruby Object Mapper with Lotus
162
+ test_files:
163
+ - spec/.lotusrc
164
+ - spec/dummy/.gitignore
165
+ - spec/dummy/.lotusrc
166
+ - spec/dummy/.rspec
167
+ - spec/dummy/Rakefile
168
+ - spec/dummy/apps/web/application.rb
169
+ - spec/dummy/apps/web/config/routes.rb
170
+ - spec/dummy/apps/web/controllers/posts/index.rb
171
+ - spec/dummy/apps/web/templates/application.html.erb
172
+ - spec/dummy/apps/web/templates/posts/index.html.erb
173
+ - spec/dummy/apps/web/views/application_layout.rb
174
+ - spec/dummy/apps/web/views/posts/index.rb
175
+ - spec/dummy/config.ru
176
+ - spec/dummy/config/.env
177
+ - spec/dummy/config/.env.development
178
+ - spec/dummy/config/.env.test
179
+ - spec/dummy/config/environment.rb
180
+ - spec/dummy/db/.gitkeep
181
+ - spec/dummy/lib/dummy.rb
182
+ - spec/dummy/lib/dummy/relations/posts.rb
183
+ - spec/dummy/spec/features_helper.rb
184
+ - spec/dummy/spec/spec_helper.rb
185
+ - spec/dummy/spec/support/.gitkeep
186
+ - spec/dummy/spec/support/capybara.rb
187
+ - spec/dummy/spec/web/features/.gitkeep
188
+ - spec/dummy/spec/web/features/posts_spec.rb
189
+ - spec/spec_helper.rb
190
+ has_rdoc: