Friday, 15 March 2013

ruby on rails - How to define a Factory in FactoryGirl that uses an http request (get, post, etc) -



ruby on rails - How to define a Factory in FactoryGirl that uses an http request (get, post, etc) -

is there way utilize http requests when defining mill in factorygirl?

ex.

factorygirl.define mill :webobject object_handle { post "uri-to-create-object" json.parse (response.body)[object_handle] } end end mytestobject = factorygirl.build(:webobject)

the above results in factorygirl doesn't know post is:

nomethoderror: undefined methodpost' factorygirl::syntaxrunner:0x007fd9c6eeb3b0`

i tried adding 'open-uri' , 'net/http' mill file (spec->[factoryfile.rb]). tried adding require lines top of mill back upwards module (spec->support->model->[factoryfile.rb]). tried adding th require lines parent file (spec->support->spec_helper.rb) seems back upwards rspec tests.

ruby-on-rails rspec http-post factory-girl extend

No comments:

Post a Comment