spec/controllers/js_base_spec.rb in rhoconnect-4.0.0.beta.12 vs spec/controllers/js_base_spec.rb in rhoconnect-4.0.0.beta.24
- old
+ new
@@ -5,22 +5,22 @@
describe "Rhoconnect::Controller::JsBase" do
include Rack::Test::Methods
include Rhoconnect
it_behaves_like "SharedRhoconnectHelper", :rhoconnect_data => true do
+ def app
+ @app ||= Rack::URLMap.new Rhoconnect.url_map
+ end
+
before(:each) do
Rhoconnect::Server.set :environment, :test
Rhoconnect::Server.set :secret, "secure!"
Rhoconnect.use_node = true
Rhoconnect.bootstrap(get_testapp_path)
do_post "/rc/#{Rhoconnect::API_VERSION}/app/login", "login" => @u.login, "password" => 'testpass'
end
- def app
- @app ||= Rack::URLMap.new Rhoconnect.url_map
- end
-
after(:each) do
Rhoconnect::Node.kill_process
end
it "should get / of js controller with route overridden" do
@@ -68,9 +68,15 @@
it "should delete to js controller" do
@c1 = Client.create({:user_id => @u.id,:app_id => @a.id},{:source_name => 'JsSample'})
set_doc_state(@c1, :cd => @data)
delete '/app/v1/JsSample/2', {}, {Rhoconnect::CLIENT_ID_HEADER => @c1.id}
last_response.should be_ok
+ end
+
+ it "should call route that overrides default option" do
+ get '/app/v1/JsSample/no_client_route', {}
+ last_response.should be_ok
+ last_response.body.should == 'no client required!'
end
it "should upload blob in multipart post" do
file1,file2 = 'upload1.txt'
@product1['txtfile-rhoblob'] = file1
\ No newline at end of file