rspec-sequel 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f0ff2a3c8c1cb80b37128f84fa5708440e4c7257
4
- data.tar.gz: b4cb8c94e9751b9f6b9c42c34bdaddb21238097c
2
+ SHA256:
3
+ metadata.gz: 7a76240a3d2c00d21d97556a4e27d4f0e7c27348c8eb74702e6b748b5b145607
4
+ data.tar.gz: 927293935f2df1d0fb4a46b1afcf16b77a17b9123a7fcff4e1520ab0ae03a96c
5
5
  SHA512:
6
- metadata.gz: 34dcb0569b1c3f07b4d575ccf2ee772ee1d03e332a70ccd3eb0a477b03d9ba2022fe3e1e6ff3dbebf377b88674fad9b891771167c8b02a4596040436b71ba662
7
- data.tar.gz: 11f09fa00b5e8c3f532b1ea9455fbbc6fb16f6fe26fd492810fa55ee934d0a2244c7048acf328d01abddc406198142a85e53d286562bc9e7421e3ef26987cece
6
+ metadata.gz: 45b65156a6ec375d71d5babb597ac90eb0f819b71255023d3e2cdec7e4b13082a011c88ac1912e0b1a9198efe57e826452593a2c500f4eb0cc2063518d06c04b
7
+ data.tar.gz: f5bf486d289ce5d1b70f4b59cc85102fa98b77f7624ea242d46b1ca939d9b99625086bd14a3118164d984e7d78b14998ae7a00e2b0267bfdcebd91946927cd06
@@ -9,11 +9,11 @@ Feature: migration specs
9
9
 
10
10
  describe 'db/migrations/001_create_users.rb' do
11
11
  it "creates the users table" do
12
- db.table_exists?(:users).should be_false
12
+ expect(db.table_exists?(:users)).to be false
13
13
  migrate! :up
14
- db.table_exists?(:users).should be_true
14
+ expect(db.table_exists?(:users)).to be true
15
15
  migrate! :down
16
- db.table_exists?(:users).should be_false
16
+ expect(db.table_exists?(:users)).to be false
17
17
  end
18
18
  end
19
19
  """
@@ -28,7 +28,7 @@ Feature: migration specs
28
28
  describe 'db/migrations/001_create_users.rb' do
29
29
  it "creates the users table" do
30
30
  migrate! :up
31
- db.table_exists?(:users).should be_true
31
+ expect(db.table_exists?(:users)).to be true
32
32
  end
33
33
 
34
34
  it "makes an id column in users table" do
@@ -18,15 +18,15 @@ Feature: postgres schema
18
18
 
19
19
  describe "down" do
20
20
  it "drops the table" do
21
- db.table_exists?(:users).should be_true
21
+ db.table_exists?(:users).should be true
22
22
  migrate! :down
23
- db.table_exists?(:users).should be_false
23
+ db.table_exists?(:users).should be false
24
24
  end
25
25
 
26
26
  it "drops the table even when there are still records" do
27
27
  db[:users].insert id: 42
28
28
  migrate! :down
29
- db.table_exists?(:users).should be_false
29
+ db.table_exists?(:users).should be false
30
30
  end
31
31
  end
32
32
  end
@@ -71,5 +71,3 @@ Feature: postgres schema
71
71
  """
72
72
  When I run `rspec spec`
73
73
  Then the examples should pass
74
-
75
-
@@ -1,7 +1,7 @@
1
1
  require 'aruba/cucumber'
2
- require_relative 'postgres'
3
2
 
4
3
  Before do
4
+ ENV['RUBYLIB'] = File.expand_path '../../lib', __dir__
5
5
  step %q{a file named "spec/spec_helper.rb" with:}, %Q{
6
6
  require 'rspec/sequel'
7
7
  Sequel::connect '#{RSpec::Sequel::Test::postgres.uri}'
@@ -0,0 +1 @@
1
+ features/support/../../spec/support/postgres.rb
@@ -7,5 +7,5 @@ require "rspec/sequel/migration_example_group"
7
7
 
8
8
  RSpec::configure do |c|
9
9
  c.include RSpec::Sequel::MigrationExampleGroup, type: :migration,
10
- example_group: { file_path: %r{spec/migration} }
10
+ file_path: %r{spec/migration}
11
11
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Sequel
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "sequel", "~> 4.0"
22
- spec.add_dependency "rspec", "~> 2.13"
22
+ spec.add_dependency "rspec", "~> 3.9"
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.3"
25
- spec.add_development_dependency "rake", "~> 10.1"
24
+ spec.add_development_dependency "bundler", "~> 2"
25
+ spec.add_development_dependency "rake", "~> 12.3"
26
26
  spec.add_development_dependency "cucumber", "~> 1.3"
27
27
  spec.add_development_dependency "aruba", "~> 0.5"
28
28
  spec.add_development_dependency "sqlite3", "~> 1.3"
@@ -2,9 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  module RSpec::Sequel
4
4
  describe MigrationExampleGroup do
5
-
6
- it { should be_included_in_files_in('./spec/migrations/') }
7
-
8
5
  let :group do
9
6
  RSpec::Core::ExampleGroup.describe do
10
7
  include MigrationExampleGroup
@@ -15,44 +12,44 @@ module RSpec::Sequel
15
12
 
16
13
  describe '::db' do
17
14
  it "is an in-memory sqlite db by default" do
18
- instance.db.uri.should == 'sqlite:/'
15
+ expect(instance.db.uri).to eq 'sqlite:/'
19
16
  end
20
17
 
21
18
  it "can be overriden" do
22
19
  group.let(:db) { 'notreallyadb' }
23
- instance.db.should == 'notreallyadb'
20
+ expect(instance.db).to eq 'notreallyadb'
24
21
  end
25
22
  end
26
23
 
27
24
  describe "#migrate!" do
28
25
  it "applies the migration in the proper direction" do
29
26
  migration = double "migration"
30
- instance.stub migration: migration, db: 'notreallyadb'
27
+ allow(instance).to receive_messages migration: migration, db: 'notreallyadb'
31
28
 
32
- migration.should_receive(:apply).with('notreallyadb', :dir)
29
+ expect(migration).to receive(:apply).with('notreallyadb', :dir)
33
30
  instance.migrate! :dir
34
31
  end
35
32
  end
36
33
 
37
34
  describe "::migration" do
38
35
  it "loads the migration from the migration_path" do
39
- instance.stub migration_path: File.expand_path("../test_migration.rb", __FILE__)
36
+ allow(instance).to receive_messages migration_path: File.expand_path("../test_migration.rb", __FILE__)
40
37
 
41
- instance.migration.up.call.should == "I'm up!"
42
- instance.migration.down.call.should == "I'm down!"
38
+ expect(instance.migration.up.call).to eq "I'm up!"
39
+ expect(instance.migration.down.call).to eq "I'm down!"
43
40
  end
44
41
  end
45
42
 
46
43
  describe "::migration_path" do
47
44
  it "defaults to the group title" do
48
- group.stub description: 'some/migration/path'
49
- instance.migration_path.should == "#{Dir.pwd}/some/migration/path"
45
+ allow(group).to receive_messages description: 'some/migration/path'
46
+ expect(instance.migration_path).to eq "#{Dir.pwd}/some/migration/path"
50
47
  end
51
48
 
52
49
  it "uses the Rails root if available" do
53
50
  stub_const 'Rails', double(root: '/railroot')
54
- group.stub description: 'some/migration/path'
55
- instance.migration_path.should == "/railroot/some/migration/path"
51
+ allow(group).to receive_messages description: 'some/migration/path'
52
+ expect(instance.migration_path).to eq "/railroot/some/migration/path"
56
53
  end
57
54
  end
58
55
 
@@ -62,7 +59,7 @@ module RSpec::Sequel
62
59
  it "connects to the same database as the model, only with 'spec' schema" do
63
60
  stub_const 'Sequel::DATABASES', [postgres]
64
61
  group.postgres_schema
65
- instance.db.opts.but(:orig_opts).should == postgres.opts.merge(search_path: %w(spec)).but(:orig_opts)
62
+ expect(instance.db.opts.but(:orig_opts)).to eq postgres.opts.merge(search_path: %w(spec)).but(:orig_opts)
66
63
  end
67
64
 
68
65
  it "runs the code inside on the database with a clean schema before running the context" do
@@ -73,14 +70,16 @@ module RSpec::Sequel
73
70
  end
74
71
  end
75
72
 
76
- postgres.table_exists?(:spec__some_table).should be_false
73
+ table_name = Sequel.qualify 'spec', 'some_table'
74
+ expect(postgres.table_exists?(table_name)).to be false
77
75
 
78
- group.example { postgres.table_exists?(:spec__some_table).should be_true }
79
- reporter = RSpec::Core::Reporter.new
80
- reporter.should_receive :example_passed
76
+ pg = postgres # ensure it's captured by the closure below
77
+ group.example { expect(pg.table_exists?(table_name)).to be true }
78
+ reporter = instance_double(RSpec::Core::Reporter).as_null_object
79
+ expect(reporter).to receive :example_passed
81
80
  group.run(reporter)
82
81
 
83
- postgres.table_exists?(:spec__some_table).should be_false
82
+ expect(postgres.table_exists?(table_name)).to be false
84
83
  end
85
84
  end
86
85
 
@@ -1,7 +1,7 @@
1
1
  require 'sequel'
2
+ require 'rspec/sequel'
2
3
 
3
4
  module RSpec::Sequel::Test
4
-
5
5
  def self.postgres
6
6
  @pg_db ||= connect_to_postgres
7
7
  end
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafał Rzepecki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2020-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.13'
33
+ version: '3.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.13'
40
+ version: '3.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.1'
61
+ version: '12.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.1'
68
+ version: '12.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aruba
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0.5'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.5'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sqlite3
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.3'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.3'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pg
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0.16'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.16'
125
125
  description: Ever wanted to actually test that tricky migration? rspec-sequel will
@@ -130,10 +130,10 @@ executables: []
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - .gitignore
134
- - .kateproject
135
- - .rspec
136
- - .travis.yml
133
+ - ".gitignore"
134
+ - ".kateproject"
135
+ - ".rspec"
136
+ - ".travis.yml"
137
137
  - Gemfile
138
138
  - LICENSE.txt
139
139
  - README.md
@@ -152,7 +152,6 @@ files:
152
152
  - spec/rspec/sequel/test_migration.rb
153
153
  - spec/spec_helper.rb
154
154
  - spec/support/helpers.rb
155
- - spec/support/matchers.rb
156
155
  - spec/support/postgres.rb
157
156
  homepage: https://github.com/conjurinc/rspec-sequel
158
157
  licenses:
@@ -164,17 +163,17 @@ require_paths:
164
163
  - lib
165
164
  required_ruby_version: !ruby/object:Gem::Requirement
166
165
  requirements:
167
- - - '>='
166
+ - - ">="
168
167
  - !ruby/object:Gem::Version
169
168
  version: '0'
170
169
  required_rubygems_version: !ruby/object:Gem::Requirement
171
170
  requirements:
172
- - - '>='
171
+ - - ">="
173
172
  - !ruby/object:Gem::Version
174
173
  version: '0'
175
174
  requirements: []
176
175
  rubyforge_project:
177
- rubygems_version: 2.0.3
176
+ rubygems_version: 2.7.6.2
178
177
  signing_key:
179
178
  specification_version: 4
180
179
  summary: Easily spec Sequel migrations
@@ -189,5 +188,4 @@ test_files:
189
188
  - spec/rspec/sequel/test_migration.rb
190
189
  - spec/spec_helper.rb
191
190
  - spec/support/helpers.rb
192
- - spec/support/matchers.rb
193
191
  - spec/support/postgres.rb
@@ -1,21 +0,0 @@
1
- require 'sequel'
2
-
3
- module RSpec::Sequel::Test
4
-
5
- def self.postgres
6
- @pg_db ||= connect_to_postgres
7
- end
8
-
9
- private
10
- DEFAULT_TEST_DATABASE = 'postgres:///rspec-sequel-test'
11
-
12
- def self.connect_to_postgres
13
- test_database = unless ENV['TEST_DATABASE']
14
- STDERR.puts "TEST_DATABASE environment variable not found, defaulting to #{DEFAULT_TEST_DATABASE}"
15
- DEFAULT_TEST_DATABASE
16
- end
17
-
18
- Sequel::connect test_database
19
- end
20
-
21
- end
@@ -1,9 +0,0 @@
1
- RSpec::Matchers::define :be_included_in_files_in do |path|
2
- match do |mod|
3
- stub_metadata(
4
- :example_group => {:file_path => "#{path}whatever_spec.rb:15"}
5
- )
6
- group = RSpec::Core::ExampleGroup.describe
7
- group.included_modules.include?(mod)
8
- end
9
- end