Sha256: 4f7d85cb20bf742f7d28cc75cf77b8bf05626d19f4c4333748658b9ee2b5a98e

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

#
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'rack/test'
require 'backstage'
require 'json'

TEST_ROOT = File.expand_path( File.dirname( __FILE__ ) )

def app
  Backstage::Application
end

def resource_with_mock_mbean(klass)
  mock_mbean = mock('mbean')
  def mock_mbean.method_missing(method, *args, &block)
    method.to_s
  end

  if klass == Backstage::Log
    resource = Backstage::Log.new(File.join( TEST_ROOT, 'data', 'railsapp', 'log', 'production.log' ))
  else
    resource = klass.new('mock_mbean', mock_mbean)
    resource.stub(:app).and_return(resource_with_mock_mbean(Backstage::App)) unless klass == Backstage::App
  end

  resource.stub(:name).and_return('name')
  resource.stub(:app_name).and_return('app_name')

  resource
end

RSpec.configure do |conf|
  conf.include Rack::Test::Methods
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
torquebox-backstage-0.4.0 spec/spec_helper.rb
torquebox-backstage-0.3.2 spec/spec_helper.rb
torquebox-backstage-0.3.1 spec/spec_helper.rb
torquebox-backstage-0.3.0 spec/spec_helper.rb