Hye Eggie,
what’s that @campaign object contain?, if it’s your server, then you
have to just write one mock server,
and i am assuming this code is in some controller.,
def test_preview_for_3gp
get :preview, :device_id => test_device # send what ever you
want.
assert_response :success
assert_not_nil @response.headers[“Content-Type”].index(‘video/
3gpp’) # write different set of Functional TestCases for your if/else
ladder.
expected_file_name = "/tmp/test.3gpp"
assert_equal expected_file_name, assigns(:path) # i just
assumed the path variable can be made instance variable.
assert_not_nil @response
assert_kind_of String, @response.body # i don't know what put
in place of String here, if you do some google you may get some idea.
Sorry, here
end
and one more thing is you can add some more assertions provided if you
know what’s the 3gp format, so if you want your FT’s(Functional-Test-
Cases) to
cover even the content delivered, then you have to parse the 3gp
file(or find any equivalent Ruby class, [i don’t know any such class])
and write assertions
for response.body to contain like header, tags etc. of 3gp format.
I guess it helps you, sorry if not.
Good Luck,
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.