preserves 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,120 @@
1
+ require "rspec"
2
+
3
+
4
+ $LOAD_PATH.push(File.expand_path(File.join(File.dirname(__FILE__), "../lib")))
5
+ require "preserves"
6
+
7
+
8
+ Preserves.data_store = Preserves.PostgreSQL("preserves_test")
9
+
10
+
11
+ def setup_db(db)
12
+ db.exec("DROP TABLE IF EXISTS groups")
13
+ db.exec("DROP TABLE IF EXISTS users")
14
+ db.exec("DROP TABLE IF EXISTS addresses")
15
+ db.exec("CREATE TABLE groups (id INTEGER NOT NULL,
16
+ name VARCHAR(255) NOT NULL)")
17
+ db.exec("CREATE TABLE users (username VARCHAR(255) NOT NULL,
18
+ name VARCHAR(255),
19
+ age INTEGER,
20
+ group_id INTEGER)")
21
+ db.exec("CREATE TABLE addresses (city VARCHAR(255) NOT NULL,
22
+ username VARCHAR(255) NOT NULL)")
23
+ end
24
+
25
+
26
+ # This file was generated by the `rspec --init` command. Conventionally, all
27
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
28
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
29
+ # file to always be loaded, without a need to explicitly require it in any files.
30
+ #
31
+ # Given that it is always loaded, you are encouraged to keep this file as
32
+ # light-weight as possible. Requiring heavyweight dependencies from this file
33
+ # will add to the boot time of your test suite on EVERY test run, even for an
34
+ # individual file that may not need all of that loaded. Instead, make a
35
+ # separate helper file that requires this one and then use it only in the specs
36
+ # that actually need it.
37
+ #
38
+ # The `.rspec` file also contains a few flags that are not defaults but that
39
+ # users commonly want.
40
+ #
41
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
42
+
43
+ RSpec.configure do |config|
44
+ # The settings below are suggested to provide a good initial experience
45
+ # with RSpec, but feel free to customize to your heart's content.
46
+ =begin
47
+ # These two settings work together to allow you to limit a spec run
48
+ # to individual examples or groups you care about by tagging them with
49
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
50
+ # get run.
51
+ config.filter_run :focus
52
+ config.run_all_when_everything_filtered = true
53
+
54
+ # Many RSpec users commonly either run the entire suite or an individual
55
+ # file, and it's useful to allow more verbose output when running an
56
+ # individual spec file.
57
+ if config.files_to_run.one?
58
+ # RSpec filters the backtrace by default so as not to be so noisy.
59
+ # This causes the full backtrace to be printed when running a single
60
+ # spec file (e.g. to troubleshoot a particular spec failure).
61
+ config.full_backtrace = true
62
+
63
+ # Use the documentation formatter for detailed output,
64
+ # unless a formatter has already been configured
65
+ # (e.g. via a command-line flag).
66
+ config.default_formatter = 'doc'
67
+ end
68
+
69
+ # Print the 10 slowest examples and example groups at the
70
+ # end of the spec run, to help surface which specs are running
71
+ # particularly slow.
72
+ config.profile_examples = 10
73
+
74
+ # Run specs in random order to surface order dependencies. If you find an
75
+ # order dependency and want to debug it, you can fix the order by providing
76
+ # the seed, which is printed after each run.
77
+ # --seed 1234
78
+ config.order = :random
79
+
80
+ # Seed global randomization in this process using the `--seed` CLI option.
81
+ # Setting this allows you to use `--seed` to deterministically reproduce
82
+ # test failures related to randomization by passing the same `--seed` value
83
+ # as the one that triggered the failure.
84
+ Kernel.srand config.seed
85
+
86
+ # rspec-expectations config goes here. You can use an alternate
87
+ # assertion/expectation library such as wrong or the stdlib/minitest
88
+ # assertions if you prefer.
89
+ config.expect_with :rspec do |expectations|
90
+ # Enable only the newer, non-monkey-patching expect syntax.
91
+ # For more details, see:
92
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
93
+ expectations.syntax = :expect
94
+ end
95
+
96
+ # rspec-mocks config goes here. You can use an alternate test double
97
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
98
+ config.mock_with :rspec do |mocks|
99
+ # Enable only the newer, non-monkey-patching expect syntax.
100
+ # For more details, see:
101
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
102
+ mocks.syntax = :expect
103
+
104
+ # Prevents you from mocking or stubbing a method that does not exist on
105
+ # a real object. This is generally recommended.
106
+ mocks.verify_partial_doubles = true
107
+ end
108
+ =end
109
+
110
+ db = Preserves.data_store
111
+
112
+ setup_db(db)
113
+
114
+ config.around do |example|
115
+ db.exec("BEGIN")
116
+ example.run
117
+ db.exec("ROLLBACK")
118
+ end
119
+
120
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: preserves
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Craig Buchek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pg
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.18.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.18.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubygems-tasks
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.2'
83
+ description: Experimental, opinionated, minimalist ORM (object-relational mapper)
84
+ for Ruby, using the Data Mapper pattern.
85
+ email:
86
+ - craig@boochtek.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".irbrc"
93
+ - ".rspec"
94
+ - Gemfile
95
+ - LICENSE
96
+ - README.md
97
+ - Rakefile
98
+ - SETUP.sh
99
+ - TODO.md
100
+ - lib/preserves.rb
101
+ - lib/preserves/mapper.rb
102
+ - lib/preserves/mapper/belongs_to.rb
103
+ - lib/preserves/mapper/has_many.rb
104
+ - lib/preserves/mapper/relation.rb
105
+ - lib/preserves/mapping.rb
106
+ - lib/preserves/repository.rb
107
+ - lib/preserves/selection.rb
108
+ - lib/preserves/sql.rb
109
+ - lib/preserves/sql/result_set.rb
110
+ - lib/preserves/version.rb
111
+ - preserves.gemspec
112
+ - spec/repository_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: https://github.com/boochtek/ruby_preserves
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.4.5.1
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Minimalist ORM, using the Data Mapper pattern
138
+ test_files:
139
+ - spec/repository_spec.rb
140
+ - spec/spec_helper.rb