active-fixtures 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 +4 -4
- data/README.md +2 -2
- data/lib/active-fixtures.rb +5 -0
- data/lib/active-fixtures/state_dumper.rb +1 -1
- data/lib/active-fixtures/version.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b69301ab1a203ec833323814e43e8ee21bc8c37
|
4
|
+
data.tar.gz: b635e04c2a4b1c96aeb1128d3271127f1fdce4ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c38ed1954911e634d7123c4d6c267d33102666ebe17f9a152297541138c23403f6f2100712ba944689c62d75c29141f1aab1d37c4179405a1d1543df54e6023b
|
7
|
+
data.tar.gz: ddee513aea13b074d52b7c1f0365327060cb34c869054308c626c753b9dcd477a0bc31cc315e04a8867f2b4687a545d9e62adf04f7e388d007f4692ead7d8f12
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ which entities he understand, how he affects to such entities.
|
|
33
33
|
In general case, tests in isolation are at least useless, at max - hurtful.
|
34
34
|
Lets write acceptance tests instead!
|
35
35
|
|
36
|
-
##
|
36
|
+
## Requirements
|
37
37
|
Currently works with Poltergeist and PostgreSQL.
|
38
38
|
|
39
39
|
## Getting started
|
@@ -41,7 +41,7 @@ Currently works with Poltergeist and PostgreSQL.
|
|
41
41
|
Add to your Gemfile:
|
42
42
|
|
43
43
|
```ruby
|
44
|
-
gem '
|
44
|
+
gem 'active-fixtures', group: :test
|
45
45
|
```
|
46
46
|
|
47
47
|
Add to your rspec helper:
|
data/lib/active-fixtures.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active-fixtures/version'
|
2
|
+
require 'active_attr'
|
2
3
|
|
3
4
|
module ActiveFixtures
|
4
5
|
autoload :Resource, 'active-fixtures/resource'
|
@@ -8,6 +9,8 @@ module ActiveFixtures
|
|
8
9
|
autoload :State, 'active-fixtures/state'
|
9
10
|
autoload :StateDumper, 'active-fixtures/state_dumper'
|
10
11
|
|
12
|
+
class PrepareStateError < StandardError; end
|
13
|
+
|
11
14
|
mattr_accessor :state_builders
|
12
15
|
self.state_builders = {}
|
13
16
|
|
@@ -25,6 +28,8 @@ module ActiveFixtures
|
|
25
28
|
end
|
26
29
|
|
27
30
|
def prepare!(name)
|
31
|
+
raise PrepareStateError.new("Undefined active fixture: #{name.inspect}") unless state_builders.key?(name)
|
32
|
+
|
28
33
|
self.current_state = State.new(name)
|
29
34
|
current_state.prepare!(state_builders[name])
|
30
35
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActiveFixtures
|
2
2
|
module StateDumper
|
3
3
|
FIXTURES_PATH = Rails.root.join('spec/fixtures/active').freeze
|
4
|
-
DB_NAME =
|
4
|
+
DB_NAME = Rails.configuration.database_configuration[Rails.env]['database'].freeze
|
5
5
|
CLEAN_STATE_NAME = :__clean
|
6
6
|
|
7
7
|
class << self
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fixtures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Tokarenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: active_attr
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: active-fixtures provides the way how to populate the server state (DB,
|
14
42
|
sessions) as an application user but not as programmer.
|
15
43
|
email: private.tokarenko.sergey@gmail.com
|