framework_fixture 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/LICENSE +2 -2
- data/README.md +3 -2
- data/Rakefile +8 -0
- data/framework_fixture.gemspec +28 -0
- data/lib/framework_fixture.rb +3 -7
- data/spec/fixtures/frameworks.yml +20 -0
- data/spec/fixtures/rails2/application_controller.rb +14 -0
- data/spec/fixtures/rails2/environment.rb +42 -0
- data/spec/fixtures/rails2/routes.rb +46 -0
- data/spec/fixtures/rails3/Gemfile +31 -0
- data/spec/fixtures/rails3/application.rb +47 -0
- data/spec/fixtures/rails3/application_controller.rb +7 -0
- data/spec/fixtures/rails3/routes.rb +60 -0
- data/spec/fixtures/rails3/test.rb +37 -0
- data/spec/fixtures/sinatra/application.rb +8 -0
- data/spec/framework_fixture_spec.rb +96 -0
- data/spec/spec_helper.rb +9 -0
- metadata +135 -55
- data/lib/framework_fixture/gems.rb +0 -43
- data/lib/framework_fixture/version.rb +0 -3
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010
|
1
|
+
Copyright (c) 2010
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
4
|
this software and associated documentation files (the "Software"), to deal in
|
@@ -15,4 +15,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
15
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
16
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
17
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@ FrameworkFixture
|
|
3
3
|
|
4
4
|
Dynamically generate Rails and Sinatra apps to be tested by <code>Rack::Test</code>.
|
5
5
|
|
6
|
+
[![Build Status](https://secure.travis-ci.org/winton/framework_fixture.png)](http://travis-ci.org/winton/framework_fixture)
|
7
|
+
|
6
8
|
Why?
|
7
9
|
----
|
8
10
|
|
@@ -81,7 +83,6 @@ Run Tests With Framework Environment Variable
|
|
81
83
|
---------------------------------------------
|
82
84
|
|
83
85
|
<pre>
|
84
|
-
RAILS=
|
85
|
-
RAILS=3 spec spec
|
86
|
+
RAILS_ENV=test RAILS=3 spec spec
|
86
87
|
SINATRA=1 spec spec
|
87
88
|
</pre>
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
root = File.expand_path('../', __FILE__)
|
3
|
+
lib = "#{root}/lib"
|
4
|
+
|
5
|
+
$:.unshift lib unless $:.include?(lib)
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "framework_fixture"
|
9
|
+
s.version = '0.2.0'
|
10
|
+
s.platform = Gem::Platform::RUBY
|
11
|
+
s.authors = ["Winton Welsh"]
|
12
|
+
s.email = ["mail@wintoni.us"]
|
13
|
+
s.homepage = "http://github.com/winton/framework_fixture"
|
14
|
+
s.summary = "Dynamically generate Rails and Sinatra apps to be tested by Rack::Test"
|
15
|
+
s.description = "Dynamically generate Rails and Sinatra apps to be tested by Rack::Test."
|
16
|
+
|
17
|
+
s.executables = `cd #{root} && git ls-files bin/*`.split("\n").collect { |f| File.basename(f) }
|
18
|
+
s.files = `cd #{root} && git ls-files`.split("\n")
|
19
|
+
s.require_paths = %w(lib)
|
20
|
+
s.test_files = `cd #{root} && git ls-files -- {features,test,spec}/*`.split("\n")
|
21
|
+
|
22
|
+
s.add_development_dependency "rake"
|
23
|
+
s.add_development_dependency "rails", "~> 3.0"
|
24
|
+
s.add_development_dependency "sinatra", "~> 1.0"
|
25
|
+
s.add_development_dependency "rspec", "~> 1.0"
|
26
|
+
|
27
|
+
s.add_dependency "rack-test", "=0.6.1"
|
28
|
+
end
|
data/lib/framework_fixture.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/framework_fixture/gems'
|
2
|
-
|
3
|
-
FrameworkFixture::Gems.require(:lib)
|
4
|
-
|
5
1
|
require 'fileutils'
|
6
|
-
require 'rubygems'
|
7
2
|
require 'yaml'
|
8
3
|
|
9
|
-
|
4
|
+
require 'rubygems'
|
5
|
+
require 'rack/test'
|
10
6
|
|
11
|
-
|
7
|
+
$:.unshift File.dirname(__FILE__)
|
12
8
|
|
13
9
|
class FrameworkFixture
|
14
10
|
class <<self
|
@@ -0,0 +1,20 @@
|
|
1
|
+
rails:
|
2
|
+
<3:
|
3
|
+
rails2:
|
4
|
+
- app/controllers/application_controller.rb
|
5
|
+
- config/environment.rb
|
6
|
+
- config/routes.rb
|
7
|
+
<4:
|
8
|
+
rails3:
|
9
|
+
- app/controllers/application_controller.rb
|
10
|
+
- config/application.rb
|
11
|
+
- config/environments/test.rb
|
12
|
+
- config/routes.rb
|
13
|
+
- Gemfile
|
14
|
+
sinatra:
|
15
|
+
<1:
|
16
|
+
sinatra:
|
17
|
+
- application.rb
|
18
|
+
<2:
|
19
|
+
sinatra:
|
20
|
+
- application.rb
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
+
|
8
|
+
# Scrub sensitive parameters from your log
|
9
|
+
# filter_parameter_logging :password
|
10
|
+
|
11
|
+
def pulse
|
12
|
+
render :text => '1'
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
4
|
+
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
|
5
|
+
|
6
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
7
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
8
|
+
|
9
|
+
Rails::Initializer.run do |config|
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Add additional load paths for your own custom dirs
|
15
|
+
# config.autoload_paths += %W( #{RAILS_ROOT}/extras )
|
16
|
+
|
17
|
+
# Specify gems that this application depends on and have them installed with rake gems:install
|
18
|
+
# config.gem "bj"
|
19
|
+
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
20
|
+
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
21
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Skip frameworks you're not going to use. To use Rails without a database,
|
28
|
+
# you must remove the Active Record framework.
|
29
|
+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
30
|
+
config.frameworks -= [ :active_record ]
|
31
|
+
|
32
|
+
# Activate observers that should always be running
|
33
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
34
|
+
|
35
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
36
|
+
# Run "rake -D time" for a list of tasks for finding time zone names.
|
37
|
+
config.time_zone = 'UTC'
|
38
|
+
|
39
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
40
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
41
|
+
# config.i18n.default_locale = :de
|
42
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
|
4
|
+
# Sample of regular route:
|
5
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
6
|
+
# Keep in mind you can assign values other than :controller and :action
|
7
|
+
|
8
|
+
# Sample of named route:
|
9
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
10
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
11
|
+
|
12
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
13
|
+
# map.resources :products
|
14
|
+
|
15
|
+
# Sample resource route with options:
|
16
|
+
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
17
|
+
|
18
|
+
# Sample resource route with sub-resources:
|
19
|
+
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
20
|
+
|
21
|
+
# Sample resource route with more complex sub-resources
|
22
|
+
# map.resources :products do |products|
|
23
|
+
# products.resources :comments
|
24
|
+
# products.resources :sales, :collection => { :recent => :get }
|
25
|
+
# end
|
26
|
+
|
27
|
+
# Sample resource route within a namespace:
|
28
|
+
# map.namespace :admin do |admin|
|
29
|
+
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
30
|
+
# admin.resources :products
|
31
|
+
# end
|
32
|
+
|
33
|
+
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
34
|
+
# map.root :controller => "welcome"
|
35
|
+
|
36
|
+
# See how all your routes lay out with "rake routes"
|
37
|
+
|
38
|
+
# Install the default routes as the lowest priority.
|
39
|
+
# Note: These default routes make all actions in every controller accessible via GET requests. You should
|
40
|
+
# consider removing or commenting them out if you're using named routes and resources.
|
41
|
+
|
42
|
+
# map.connect ':controller/:action/:id'
|
43
|
+
# map.connect ':controller/:action/:id.:format'
|
44
|
+
|
45
|
+
map.connect 'pulse', :controller => 'application', :action => 'pulse'
|
46
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails'
|
4
|
+
gem 'rspec'
|
5
|
+
|
6
|
+
# Bundle edge Rails instead:
|
7
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
8
|
+
|
9
|
+
|
10
|
+
# Use unicorn as the web server
|
11
|
+
# gem 'unicorn'
|
12
|
+
|
13
|
+
# Deploy with Capistrano
|
14
|
+
# gem 'capistrano'
|
15
|
+
|
16
|
+
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
17
|
+
# gem 'ruby-debug'
|
18
|
+
# gem 'ruby-debug19'
|
19
|
+
|
20
|
+
# Bundle the extra gems:
|
21
|
+
# gem 'bj'
|
22
|
+
# gem 'nokogiri'
|
23
|
+
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
24
|
+
# gem 'aws-s3', :require => 'aws/s3'
|
25
|
+
|
26
|
+
# Bundle gems for the local environment. Make sure to
|
27
|
+
# put test-only gems in this group so their generators
|
28
|
+
# and rake tasks are available in development mode:
|
29
|
+
# group :development, :test do
|
30
|
+
# gem 'webrat'
|
31
|
+
# end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
# require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "active_resource/railtie"
|
8
|
+
require "rails/test_unit/railtie"
|
9
|
+
|
10
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
11
|
+
# you've limited to :test, :development, or :production.
|
12
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
13
|
+
|
14
|
+
module Rails3
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Activate observers that should always be running.
|
28
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
29
|
+
|
30
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
31
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
32
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
33
|
+
|
34
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
35
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
36
|
+
# config.i18n.default_locale = :de
|
37
|
+
|
38
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
39
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
40
|
+
|
41
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
42
|
+
config.encoding = "utf-8"
|
43
|
+
|
44
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
45
|
+
config.filter_parameters += [:password]
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Rails3::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get 'short'
|
20
|
+
# post 'toggle'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get 'sold'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get 'recent', :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
|
59
|
+
match 'pulse' => 'application#pulse'
|
60
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Rails3::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
29
|
+
# ActionMailer::Base.deliveries array.
|
30
|
+
config.action_mailer.delivery_method = :test
|
31
|
+
|
32
|
+
# Raise exception on mass assignment protection for Active Record models
|
33
|
+
# config.active_record.mass_assignment_sanitizer = :strict
|
34
|
+
|
35
|
+
# Print deprecation notices to the stderr
|
36
|
+
config.active_support.deprecation = :stderr
|
37
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if FrameworkFixture.framework
|
4
|
+
describe FrameworkFixture do
|
5
|
+
|
6
|
+
include Rack::Test::Methods
|
7
|
+
|
8
|
+
def app
|
9
|
+
FrameworkFixture.app.call
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:all) do
|
13
|
+
@framework = ENV['RAILS'] ? 'rails' : ENV['SINATRA'] ? 'sinatra' : nil
|
14
|
+
@exact_version = ENV['RAILS'] || ENV['SINATRA']
|
15
|
+
@loose_version = @exact_version ? "<#{@exact_version.to_i + 1}" : nil
|
16
|
+
end
|
17
|
+
|
18
|
+
describe :load_config do
|
19
|
+
|
20
|
+
it "should populate @config" do
|
21
|
+
FrameworkFixture.config.should == {"rails"=>
|
22
|
+
{"<3"=>
|
23
|
+
{"rails2"=>
|
24
|
+
["app/controllers/application_controller.rb",
|
25
|
+
"config/environment.rb",
|
26
|
+
"config/routes.rb"]},
|
27
|
+
"<4"=>
|
28
|
+
{"rails3"=>
|
29
|
+
["app/controllers/application_controller.rb",
|
30
|
+
"config/application.rb",
|
31
|
+
"config/environments/test.rb",
|
32
|
+
"config/routes.rb",
|
33
|
+
"Gemfile"]}},
|
34
|
+
"sinatra"=>
|
35
|
+
{"<1"=>{"sinatra"=>["application.rb"]},
|
36
|
+
"<2"=>{"sinatra"=>["application.rb"]}}}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe :require_gem do
|
41
|
+
|
42
|
+
it "should populate @framework" do
|
43
|
+
FrameworkFixture.framework.should == @framework
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should populate @loose_version" do
|
47
|
+
FrameworkFixture.loose_version.should == @loose_version
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should populate @exact_version" do
|
51
|
+
FrameworkFixture.exact_version[0..0].should == @exact_version
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should return @loose_version when framework method is called" do
|
55
|
+
FrameworkFixture.send(@framework).should == @loose_version
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe :create_build do
|
60
|
+
|
61
|
+
it "should create builds directory" do
|
62
|
+
File.exists?($root + '/spec/fixtures/builds').should == true
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should populate @build" do
|
66
|
+
FrameworkFixture.build.should == "#{$root}/spec/fixtures/builds/#{@framework}#{@exact_version}"
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should populate @app" do
|
70
|
+
FrameworkFixture.app.class.should == Proc
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should create framework build directory" do
|
74
|
+
File.exists?(FrameworkFixture.build).should == true
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should require the environment" do
|
78
|
+
req = "#{$root}/spec/fixtures/builds/#{@framework}#{@exact_version}"
|
79
|
+
if @framework == 'rails'
|
80
|
+
req += "/config/environment.rb"
|
81
|
+
elsif @framework == 'sinatra'
|
82
|
+
req += "/application.rb"
|
83
|
+
end
|
84
|
+
$".include?(req).should == true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe :rack_test do
|
89
|
+
|
90
|
+
it "should have a pulse" do
|
91
|
+
get "/pulse"
|
92
|
+
last_response.body.should == '1'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,83 +1,163 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: framework_fixture
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 3
|
9
|
-
version: 0.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Winton Welsh
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
24
33
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 1
|
30
|
-
- 3
|
31
|
-
- 1
|
32
|
-
version: 1.3.1
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.0'
|
33
38
|
type: :development
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sinatra
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rack-test
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - '='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.6.1
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - '='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.6.1
|
94
|
+
description: Dynamically generate Rails and Sinatra apps to be tested by Rack::Test.
|
95
|
+
email:
|
37
96
|
- mail@wintoni.us
|
38
97
|
executables: []
|
39
|
-
|
40
98
|
extensions: []
|
41
|
-
|
42
99
|
extra_rdoc_files: []
|
43
|
-
|
44
|
-
|
45
|
-
-
|
46
|
-
-
|
47
|
-
- lib/framework_fixture.rb
|
100
|
+
files:
|
101
|
+
- .gitignore
|
102
|
+
- .travis.yml
|
103
|
+
- Gemfile
|
48
104
|
- LICENSE
|
49
105
|
- README.md
|
50
|
-
|
106
|
+
- Rakefile
|
107
|
+
- framework_fixture.gemspec
|
108
|
+
- lib/framework_fixture.rb
|
109
|
+
- spec/fixtures/frameworks.yml
|
110
|
+
- spec/fixtures/rails2/application_controller.rb
|
111
|
+
- spec/fixtures/rails2/environment.rb
|
112
|
+
- spec/fixtures/rails2/routes.rb
|
113
|
+
- spec/fixtures/rails3/Gemfile
|
114
|
+
- spec/fixtures/rails3/application.rb
|
115
|
+
- spec/fixtures/rails3/application_controller.rb
|
116
|
+
- spec/fixtures/rails3/routes.rb
|
117
|
+
- spec/fixtures/rails3/test.rb
|
118
|
+
- spec/fixtures/sinatra/application.rb
|
119
|
+
- spec/framework_fixture_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
51
121
|
homepage: http://github.com/winton/framework_fixture
|
52
122
|
licenses: []
|
53
|
-
|
54
123
|
post_install_message:
|
55
124
|
rdoc_options: []
|
56
|
-
|
57
|
-
require_paths:
|
125
|
+
require_paths:
|
58
126
|
- lib
|
59
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
128
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
segments:
|
65
134
|
- 0
|
66
|
-
|
67
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
hash: -3136945747678737813
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
137
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
segments:
|
73
143
|
- 0
|
74
|
-
|
144
|
+
hash: -3136945747678737813
|
75
145
|
requirements: []
|
76
|
-
|
77
146
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.
|
147
|
+
rubygems_version: 1.8.24
|
79
148
|
signing_key:
|
80
149
|
specification_version: 3
|
81
|
-
summary:
|
82
|
-
test_files:
|
83
|
-
|
150
|
+
summary: Dynamically generate Rails and Sinatra apps to be tested by Rack::Test
|
151
|
+
test_files:
|
152
|
+
- spec/fixtures/frameworks.yml
|
153
|
+
- spec/fixtures/rails2/application_controller.rb
|
154
|
+
- spec/fixtures/rails2/environment.rb
|
155
|
+
- spec/fixtures/rails2/routes.rb
|
156
|
+
- spec/fixtures/rails3/Gemfile
|
157
|
+
- spec/fixtures/rails3/application.rb
|
158
|
+
- spec/fixtures/rails3/application_controller.rb
|
159
|
+
- spec/fixtures/rails3/routes.rb
|
160
|
+
- spec/fixtures/rails3/test.rb
|
161
|
+
- spec/fixtures/sinatra/application.rb
|
162
|
+
- spec/framework_fixture_spec.rb
|
163
|
+
- spec/spec_helper.rb
|
@@ -1,43 +0,0 @@
|
|
1
|
-
unless defined?(FrameworkFixture::Gems)
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
|
5
|
-
class FrameworkFixture
|
6
|
-
class Gems
|
7
|
-
|
8
|
-
VERSIONS = {
|
9
|
-
:'rack-test' => '=0.5.6',
|
10
|
-
:rake => '=0.8.7',
|
11
|
-
:rspec => '=1.3.1'
|
12
|
-
}
|
13
|
-
|
14
|
-
TYPES = {
|
15
|
-
:gemspec => [],
|
16
|
-
:gemspec_dev => [ :rspec ],
|
17
|
-
:lib => [],
|
18
|
-
:rake => [ :rake, :rspec ],
|
19
|
-
:spec => [ :'rack-test', :rspec ]
|
20
|
-
}
|
21
|
-
|
22
|
-
class <<self
|
23
|
-
|
24
|
-
def lockfile
|
25
|
-
file = File.expand_path('../../../gems', __FILE__)
|
26
|
-
unless File.exists?(file)
|
27
|
-
File.open(file, 'w') do |f|
|
28
|
-
Gem.loaded_specs.each do |key, value|
|
29
|
-
f.puts "#{key} #{value.version.version}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def require(type=nil)
|
36
|
-
(TYPES[type] || TYPES.values.flatten.compact).each do |name|
|
37
|
-
gem name.to_s, VERSIONS[name]
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|