obvious_data 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'rake'
3
3
 
4
- describe ObviousData::SchemaMethods do
4
+ RSpec.describe ObviousData::SchemaMethods do
5
5
  after{ reset_db! }
6
6
  before(:context){ add_sql_sources }
7
7
  after(:context){ remove_sql_sources }
@@ -10,39 +10,39 @@ describe ObviousData::SchemaMethods do
10
10
 
11
11
  describe '#execute_function_file' do
12
12
  it 'executes specified function from the db/functions/ dir' do
13
- expect{ select_function(:one) }.to raise_error
13
+ expect { select_function(:one) }.to raise_error(/PG::UndefinedFunction/)
14
14
 
15
15
  migration.execute_function_file('one')
16
- expect( select_function(:one) ).to eq( {'one' => '1'} )
16
+ expect(select_function(:one)['one'].to_i).to eq(1)
17
17
  end
18
18
  end
19
19
 
20
20
  describe '#drop_function' do
21
21
  it 'drops the specified function' do
22
22
  migration.execute_function_file('one')
23
- expect( select_function(:one) ).to eq( {'one' => '1'} )
23
+ expect(select_function(:one)['one'].to_i).to eq(1)
24
24
 
25
25
  migration.drop_function('one()')
26
- expect{ select_function(:one) }.to raise_error
26
+ expect { select_function(:one) }.to raise_error(/PG::UndefinedFunction/)
27
27
  end
28
28
  end
29
29
 
30
30
  describe '#execute_view_file' do
31
31
  it 'executes specified view from the db/views/ dir' do
32
- expect{ select_view(:one_v) }.to raise_error
32
+ expect { select_view(:one_v) }.to raise_error(/PG::UndefinedTable/)
33
33
 
34
34
  migration.execute_view_file('one_v')
35
- expect( select_view(:one_v) ).to eq( '1' )
35
+ expect(select_view(:one_v).to_i).to eq 1
36
36
  end
37
37
  end
38
38
 
39
39
  describe '#drop_view' do
40
40
  it 'drops the specified view' do
41
41
  migration.execute_view_file('one_v')
42
- expect( select_view(:one_v) ).to eq( '1' )
42
+ expect(select_view(:one_v).to_i).to eq 1
43
43
 
44
44
  migration.drop_view('one_v')
45
- expect{ select_view(:one_v) }.to raise_error
45
+ expect { select_view(:one_v) }.to raise_error(/PG::UndefinedTable/)
46
46
  end
47
47
  end
48
48
 
data/spec/sanity_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'sanity' do
3
+ RSpec.describe 'sanity' do
4
4
  it 'checks sanity' do
5
5
  expect(ObviousData).to be_kind_of(Module)
6
6
  end
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,7 @@
8
8
  # Configure Rails Environment
9
9
  ENV["RAILS_ENV"] = "test"
10
10
  require 'pry'
11
+ require 'simplecov'
11
12
 
12
13
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
13
14
 
@@ -17,6 +18,7 @@ Rails.backtrace_cleaner.remove_silencers!
17
18
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
18
19
 
19
20
  RSpec.configure do |config|
21
+ config.disable_monkey_patching!
20
22
  config.run_all_when_everything_filtered = true
21
23
  config.filter_run :focus
22
24
 
metadata CHANGED
@@ -1,83 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obvious_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suan-Aik Yeo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
20
- - - "<"
19
+ version: 3.2.0
20
+ - - <
21
21
  - !ruby/object:Gem::Version
22
- version: 5.0.0
22
+ version: 5.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ">="
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 3.0.0
30
- - - "<"
29
+ version: 3.2.0
30
+ - - <
31
31
  - !ruby/object:Gem::Version
32
- version: 5.0.0
32
+ version: 5.1.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pg
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ~>
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '0.18'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '0.18'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 3.0.0
54
- - - "<"
55
- - !ruby/object:Gem::Version
56
- version: 4.0.0
53
+ version: '3.4'
57
54
  type: :development
58
55
  prerelease: false
59
56
  version_requirements: !ruby/object:Gem::Requirement
60
57
  requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: 3.0.0
64
- - - "<"
58
+ - - ~>
65
59
  - !ruby/object:Gem::Version
66
- version: 4.0.0
60
+ version: '3.4'
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: pry
69
63
  requirement: !ruby/object:Gem::Requirement
70
64
  requirements:
71
- - - "~>"
65
+ - - ~>
72
66
  - !ruby/object:Gem::Version
73
- version: '0'
67
+ version: '0.10'
74
68
  type: :development
75
69
  prerelease: false
76
70
  version_requirements: !ruby/object:Gem::Requirement
77
71
  requirements:
78
- - - "~>"
72
+ - - ~>
79
73
  - !ruby/object:Gem::Version
80
- version: '0'
74
+ version: '0.10'
75
+ - !ruby/object:Gem::Dependency
76
+ name: coveralls
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '0.8'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '0.8'
81
89
  description: Rails gem to treat DB functions, triggers, etc more like code, and make
82
90
  them more discoverable
83
91
  email:
@@ -95,21 +103,13 @@ files:
95
103
  - lib/obvious_data/railtie.rb
96
104
  - lib/obvious_data/schema_methods.rb
97
105
  - lib/obvious_data/version.rb
98
- - lib/tasks/obvious_data_tasks.rake
99
106
  - spec/dummy/README.rdoc
100
107
  - spec/dummy/Rakefile
101
- - spec/dummy/app/assets/javascripts/application.js
102
- - spec/dummy/app/assets/stylesheets/application.css
103
- - spec/dummy/app/controllers/application_controller.rb
104
- - spec/dummy/app/helpers/application_helper.rb
105
- - spec/dummy/app/views/layouts/application.html.erb
106
108
  - spec/dummy/config.ru
107
109
  - spec/dummy/config/application.rb
108
110
  - spec/dummy/config/boot.rb
109
111
  - spec/dummy/config/database.yml
110
112
  - spec/dummy/config/environment.rb
111
- - spec/dummy/config/environments/development.rb
112
- - spec/dummy/config/environments/production.rb
113
113
  - spec/dummy/config/environments/test.rb
114
114
  - spec/dummy/config/initializers/backtrace_silencers.rb
115
115
  - spec/dummy/config/initializers/inflections.rb
@@ -123,13 +123,11 @@ files:
123
123
  - spec/dummy/db/migrate/20140724192457_create_dummy_trigger_func.rb
124
124
  - spec/dummy/db/structure.sql
125
125
  - spec/dummy/db/test.sqlite3
126
- - spec/dummy/log/development.log
127
126
  - spec/dummy/log/test.log
128
127
  - spec/dummy/public/404.html
129
128
  - spec/dummy/public/422.html
130
129
  - spec/dummy/public/500.html
131
130
  - spec/dummy/public/favicon.ico
132
- - spec/dummy/script/rails
133
131
  - spec/migrations_spec.rb
134
132
  - spec/sanity_spec.rb
135
133
  - spec/spec_helper.rb
@@ -146,32 +144,28 @@ require_paths:
146
144
  - lib
147
145
  required_ruby_version: !ruby/object:Gem::Requirement
148
146
  requirements:
149
- - - ">="
147
+ - - ! '>='
150
148
  - !ruby/object:Gem::Version
151
149
  version: '0'
152
150
  required_rubygems_version: !ruby/object:Gem::Requirement
153
151
  requirements:
154
- - - ">="
152
+ - - ! '>='
155
153
  - !ruby/object:Gem::Version
156
154
  version: '0'
157
155
  requirements: []
158
156
  rubyforge_project:
159
- rubygems_version: 2.2.0
157
+ rubygems_version: 2.4.5
160
158
  signing_key:
161
159
  specification_version: 4
162
160
  summary: Treat DB functions, triggers, etc more like code, and make them more discoverable
163
161
  test_files:
164
- - spec/dummy/app/assets/javascripts/application.js
165
- - spec/dummy/app/assets/stylesheets/application.css
166
- - spec/dummy/app/controllers/application_controller.rb
167
- - spec/dummy/app/helpers/application_helper.rb
168
- - spec/dummy/app/views/layouts/application.html.erb
162
+ - spec/dummy/README.rdoc
163
+ - spec/dummy/Rakefile
164
+ - spec/dummy/config.ru
169
165
  - spec/dummy/config/application.rb
170
166
  - spec/dummy/config/boot.rb
171
167
  - spec/dummy/config/database.yml
172
168
  - spec/dummy/config/environment.rb
173
- - spec/dummy/config/environments/development.rb
174
- - spec/dummy/config/environments/production.rb
175
169
  - spec/dummy/config/environments/test.rb
176
170
  - spec/dummy/config/initializers/backtrace_silencers.rb
177
171
  - spec/dummy/config/initializers/inflections.rb
@@ -181,20 +175,15 @@ test_files:
181
175
  - spec/dummy/config/initializers/wrap_parameters.rb
182
176
  - spec/dummy/config/locales/en.yml
183
177
  - spec/dummy/config/routes.rb
184
- - spec/dummy/config.ru
185
178
  - spec/dummy/db/migrate/20140724185749_create_dummy_table.rb
186
179
  - spec/dummy/db/migrate/20140724192457_create_dummy_trigger_func.rb
187
180
  - spec/dummy/db/structure.sql
188
181
  - spec/dummy/db/test.sqlite3
189
- - spec/dummy/log/development.log
190
182
  - spec/dummy/log/test.log
191
183
  - spec/dummy/public/404.html
192
184
  - spec/dummy/public/422.html
193
185
  - spec/dummy/public/500.html
194
186
  - spec/dummy/public/favicon.ico
195
- - spec/dummy/Rakefile
196
- - spec/dummy/README.rdoc
197
- - spec/dummy/script/rails
198
187
  - spec/migrations_spec.rb
199
188
  - spec/sanity_spec.rb
200
189
  - spec/spec_helper.rb
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :obvious_data do
3
- # # Task goes here
4
- # end
@@ -1,15 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // the compiled file.
9
- //
10
- // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
- // GO AFTER THE REQUIRES BELOW.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require_tree .
@@ -1,13 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
10
- *
11
- *= require_self
12
- *= require_tree .
13
- */
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,37 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
-
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger
20
- config.active_support.deprecation = :log
21
-
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
24
-
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
27
-
28
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
31
-
32
- # Do not compress assets
33
- config.assets.compress = false
34
-
35
- # Expands the lines which load the assets
36
- config.assets.debug = true
37
- end
@@ -1,67 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
3
-
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
6
-
7
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
13
-
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
16
-
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
19
-
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
22
-
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
25
-
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
-
30
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
32
-
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
35
-
36
- # Prepend all log lines with the following tags
37
- # config.log_tags = [ :subdomain, :uuid ]
38
-
39
- # Use a different logger for distributed setups
40
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
-
42
- # Use a different cache store in production
43
- # config.cache_store = :mem_cache_store
44
-
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
- # config.action_controller.asset_host = "http://assets.example.com"
47
-
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- # config.assets.precompile += %w( search.js )
50
-
51
- # Disable delivery errors, bad email addresses will be ignored
52
- # config.action_mailer.raise_delivery_errors = false
53
-
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
59
- config.i18n.fallbacks = true
60
-
61
- # Send deprecation notices to registered listeners
62
- config.active_support.deprecation = :notify
63
-
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
- end