sequel-fixture 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +1 -7
- data/README.md +5 -3
- data/lib/sequel-fixture.rb +0 -5
- data/lib/sequel-fixture/version.rb +1 -1
- data/sequel-fixture.gemspec +4 -4
- data/spec/sequel/fixture_spec.rb +1 -55
- metadata +18 -34
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 63f072ac09a46209d5d8d188614e9f9ba678593a
|
|
4
|
+
data.tar.gz: 45cd8b9eec2d7c894ba8e30238238cbd1cc0ddd6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5b5b6505da4ec8f791fcfef4ccfe009f98fd6a0b99bbbd7642a3ac4c23841eaf7338a531e070cb4dae1a467b004ea1567f0531b0b9b5d6fde4708321ed58302f
|
|
7
|
+
data.tar.gz: 8464bd93b118a031d1fd6466bfd9e098740263c4cf88dc8eec812fad30f2eca0ed29cebdd6ec49249877cd5cdceb4ed52668d988bea4d250d20761daef15a09e
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Sequel::Fixture
|
|
2
2
|
===============
|
|
3
|
-
[](http://travis-ci.org/whitepages/sequel-fixture) [](https://codeclimate.com/github/whitepages/sequel-fixture)
|
|
4
4
|
|
|
5
5
|
Just like Rails fixtures, but for Sequel.
|
|
6
6
|
|
|
@@ -69,9 +69,11 @@ Sequel::Fixture.path = File.join(File.dirname(__FILE__), "fixtures")
|
|
|
69
69
|
fixture = Sequel::Fixture.new :simple, DB # Will load all the data in the fixture into the database
|
|
70
70
|
|
|
71
71
|
fixture.users # == fixture[:users]
|
|
72
|
-
fixture.users.
|
|
72
|
+
fixture.users[0].name # => "John"
|
|
73
73
|
# The YAML files are parsed into a SymbolMatrix
|
|
74
74
|
# http://github.com/Fetcher/symbolmatrix
|
|
75
|
+
# Each table contains an array of Rows.
|
|
76
|
+
# Within each row the columns can be accessed by name (.name)
|
|
75
77
|
|
|
76
78
|
fixture.rollback # returns users and messages to pristine status ('TRUNCATE')
|
|
77
79
|
|
|
@@ -114,7 +116,7 @@ And then execute:
|
|
|
114
116
|
|
|
115
117
|
## License
|
|
116
118
|
|
|
117
|
-
Copyright (C) 2012
|
|
119
|
+
Copyright (C) 2012 Whitepages
|
|
118
120
|
|
|
119
121
|
This program is free software: you can redistribute it and/or modify
|
|
120
122
|
it under the terms of the GNU General Public License as published by
|
data/lib/sequel-fixture.rb
CHANGED
|
@@ -102,11 +102,6 @@ class Sequel::Fixture
|
|
|
102
102
|
raise MissingFixtureError, "No fixture has been loaded, nothing to check" unless @data.length > 0
|
|
103
103
|
raise MissingConnectionError, "No connection has been provided, impossible to check" unless @connection
|
|
104
104
|
|
|
105
|
-
@data.each_key do |table|
|
|
106
|
-
if @connection[table].count != 0
|
|
107
|
-
raise TablesNotEmptyError, "Table '#{table}' is not empty, tables must be empty prior to testing"
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
105
|
return @checked = true
|
|
111
106
|
end
|
|
112
107
|
|
data/sequel-fixture.gemspec
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
require File.expand_path('../lib/sequel-fixture/version', __FILE__)
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |gem|
|
|
5
|
-
gem.authors = ["
|
|
6
|
-
gem.email = ["
|
|
5
|
+
gem.authors = ["Sebastian Beresniewicz"]
|
|
6
|
+
gem.email = ["sebastianb@whitepages.com"]
|
|
7
7
|
gem.description = %q{Flexible fixtures for the Sequel Gem inspired in Rails 2 fixtures}
|
|
8
8
|
gem.summary = %q{Flexible fixtures for the Sequel Gem inspired in Rails 2 fixtures}
|
|
9
|
-
gem.homepage = "http://github.com/
|
|
9
|
+
gem.homepage = "http://github.com/whitepages/sequel-fixture"
|
|
10
10
|
|
|
11
11
|
gem.add_dependency "sequel" # Stating the obvious
|
|
12
|
-
gem.add_dependency "symbolmatrix" # Because
|
|
12
|
+
gem.add_dependency "symbolmatrix" # Because its easy to use
|
|
13
13
|
gem.add_dependency "fast" # Fast was needed. This is a testing gem, there's no problem with extra load
|
|
14
14
|
|
|
15
15
|
gem.add_development_dependency "rspec"
|
data/spec/sequel/fixture_spec.rb
CHANGED
|
@@ -164,61 +164,7 @@ describe Sequel::Fixture do
|
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
-
describe "#check" do
|
|
168
|
-
it "should count records on all the used tables" do
|
|
169
|
-
Sequel::Fixture.any_instance.stub :push # push doesn't get called
|
|
170
|
-
|
|
171
|
-
database = Sequel::Database.new # Fake database connection
|
|
172
|
-
counter = stub # fake table
|
|
173
|
-
|
|
174
|
-
database.should_receive(:[]).with(:users).and_return counter
|
|
175
|
-
database.should_receive(:[]).with(:actions).and_return counter
|
|
176
|
-
counter.should_receive(:count).twice.and_return 0
|
|
177
|
-
|
|
178
|
-
Sequel.stub(:connect).and_return database
|
|
179
|
-
fix = Sequel::Fixture.new nil, Sequel.connect
|
|
180
|
-
tables = [:users, :actions]
|
|
181
|
-
def fix.stub_data
|
|
182
|
-
@data = { :users => nil, :actions => nil }
|
|
183
|
-
end
|
|
184
|
-
fix.stub_data
|
|
185
|
-
|
|
186
|
-
fix.check
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
it "should raise error if the count is different from 0" do
|
|
190
|
-
database = Sequel::Database.new
|
|
191
|
-
counter = stub
|
|
192
|
-
counter.should_receive(:count).and_return 4
|
|
193
|
-
database.stub(:[]).and_return counter
|
|
194
|
-
Sequel::Fixture.any_instance.stub :push
|
|
195
|
-
|
|
196
|
-
fix = Sequel::Fixture.new nil, database
|
|
197
|
-
def fix.stub_data
|
|
198
|
-
@data = { :users => nil}
|
|
199
|
-
end
|
|
200
|
-
fix.stub_data
|
|
201
|
-
|
|
202
|
-
expect { fix.check }.to raise_error Sequel::Fixture::TablesNotEmptyError,
|
|
203
|
-
"Table 'users' is not empty, tables must be empty prior to testing"
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
it "should return true if all tables count equals 0" do
|
|
207
|
-
counter = stub :count => 0
|
|
208
|
-
database = stub
|
|
209
|
-
database.should_receive(:[]).with(:users).and_return counter
|
|
210
|
-
database.should_receive(:[]).with(:actions).and_return counter
|
|
211
|
-
|
|
212
|
-
Sequel::Fixture.any_instance.stub :push
|
|
213
|
-
|
|
214
|
-
fix = Sequel::Fixture.new nil, database
|
|
215
|
-
def fix.stub_data
|
|
216
|
-
@data = { :users => nil, :actions => nil }
|
|
217
|
-
end
|
|
218
|
-
fix.stub_data
|
|
219
|
-
|
|
220
|
-
fix.check.should === true
|
|
221
|
-
end
|
|
167
|
+
describe "#check" do
|
|
222
168
|
|
|
223
169
|
context "the check has been done and it passed before" do
|
|
224
170
|
it "should return true even if now tables don't pass" do
|
metadata
CHANGED
|
@@ -1,83 +1,74 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sequel-fixture
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 2.0.1
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
|
-
-
|
|
7
|
+
- Sebastian Beresniewicz
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
11
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: sequel
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
|
-
- -
|
|
17
|
+
- - '>='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: '0'
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
|
-
- -
|
|
24
|
+
- - '>='
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
26
|
version: '0'
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: symbolmatrix
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- -
|
|
31
|
+
- - '>='
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: '0'
|
|
38
34
|
type: :runtime
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- -
|
|
38
|
+
- - '>='
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: '0'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: fast
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
|
-
- -
|
|
45
|
+
- - '>='
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
47
|
version: '0'
|
|
54
48
|
type: :runtime
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
|
-
- -
|
|
52
|
+
- - '>='
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
54
|
version: '0'
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: rspec
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
|
-
- -
|
|
59
|
+
- - '>='
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
61
|
version: '0'
|
|
70
62
|
type: :development
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
|
-
- -
|
|
66
|
+
- - '>='
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
77
68
|
version: '0'
|
|
78
69
|
description: Flexible fixtures for the Sequel Gem inspired in Rails 2 fixtures
|
|
79
70
|
email:
|
|
80
|
-
-
|
|
71
|
+
- sebastianb@whitepages.com
|
|
81
72
|
executables: []
|
|
82
73
|
extensions: []
|
|
83
74
|
extra_rdoc_files: []
|
|
@@ -101,35 +92,28 @@ files:
|
|
|
101
92
|
- spec/sequel/fixtures/test/actions.yaml
|
|
102
93
|
- spec/sequel/fixtures/test/users.yaml
|
|
103
94
|
- spec/sequel/util_spec.rb
|
|
104
|
-
homepage: http://github.com/
|
|
95
|
+
homepage: http://github.com/whitepages/sequel-fixture
|
|
105
96
|
licenses: []
|
|
97
|
+
metadata: {}
|
|
106
98
|
post_install_message:
|
|
107
99
|
rdoc_options: []
|
|
108
100
|
require_paths:
|
|
109
101
|
- lib
|
|
110
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
|
-
none: false
|
|
112
103
|
requirements:
|
|
113
|
-
- -
|
|
104
|
+
- - '>='
|
|
114
105
|
- !ruby/object:Gem::Version
|
|
115
106
|
version: '0'
|
|
116
|
-
segments:
|
|
117
|
-
- 0
|
|
118
|
-
hash: -2872414278293677799
|
|
119
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
|
-
none: false
|
|
121
108
|
requirements:
|
|
122
|
-
- -
|
|
109
|
+
- - '>='
|
|
123
110
|
- !ruby/object:Gem::Version
|
|
124
111
|
version: '0'
|
|
125
|
-
segments:
|
|
126
|
-
- 0
|
|
127
|
-
hash: -2872414278293677799
|
|
128
112
|
requirements: []
|
|
129
113
|
rubyforge_project:
|
|
130
|
-
rubygems_version:
|
|
114
|
+
rubygems_version: 2.0.0
|
|
131
115
|
signing_key:
|
|
132
|
-
specification_version:
|
|
116
|
+
specification_version: 4
|
|
133
117
|
summary: Flexible fixtures for the Sequel Gem inspired in Rails 2 fixtures
|
|
134
118
|
test_files:
|
|
135
119
|
- spec/sequel/fixture_spec.rb
|