offshore 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/offshore/client/factory_offshore.rb +7 -0
- data/lib/offshore/client/host.rb +8 -0
- data/lib/offshore/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -25,7 +25,7 @@ You might need something like this to your test.rb application config:
|
|
25
25
|
|
26
26
|
Then run something like this on the command line
|
27
27
|
|
28
|
-
rails s thin -e test -p
|
28
|
+
OFFSHORE=true rails s thin -e test -p 6001
|
29
29
|
|
30
30
|
In you want it anything but blank, you must create a rake task called offshore:seed that creates the test database referenced in the database.yml file in the test environment.
|
31
31
|
Something like this would work.
|
@@ -1,8 +1,15 @@
|
|
1
1
|
class FactoryOffshore
|
2
|
+
# return the object
|
2
3
|
def self.create(*args)
|
3
4
|
host = Offshore.suite.default
|
4
5
|
host.factory_create(*args)
|
5
6
|
end
|
6
7
|
|
8
|
+
# return the id
|
9
|
+
def self.create_id(*args)
|
10
|
+
host = Offshore.suite.default
|
11
|
+
host.factory_create_id(*args)
|
12
|
+
end
|
13
|
+
|
7
14
|
# TODO: multiple hosts
|
8
15
|
end
|
data/lib/offshore/client/host.rb
CHANGED
@@ -104,10 +104,18 @@ module Offshore
|
|
104
104
|
factory_object(hash)
|
105
105
|
end
|
106
106
|
|
107
|
+
def factory_create_id(name, attributes={})
|
108
|
+
data = { :name => name }
|
109
|
+
data[:attributes] = attributes
|
110
|
+
hash = post(:factory_create, data)
|
111
|
+
hash["id"].to_i
|
112
|
+
end
|
113
|
+
|
107
114
|
# TODO: move this to a config block
|
108
115
|
def factory_object(hash)
|
109
116
|
hash["class_name"].constantize.find(hash["id"])
|
110
117
|
end
|
111
118
|
|
119
|
+
|
112
120
|
end
|
113
121
|
end
|
data/lib/offshore/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: offshore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|