Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
source 'http://rubygems.org'
gem 'rails', '3.1.1'
gemspec
gem 'test-unit'
gem 'rack-test'
gem 'actionpack'


gemspec
171 changes: 95 additions & 76 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,114 +1,133 @@
PATH
remote: .
specs:
vanna (0.1.0)
vanna (0.1.1)
json
minitest (>= 2.6.1)
rails (>= 3.0.0)

GEM
remote: http://rubygems.org/
specs:
ParseTree (3.0.6)
ParseTree (3.0.8)
RubyInline (>= 3.7.0)
sexp_processor (>= 3.0.0)
RubyInline (3.8.6)
RubyInline (3.11.0)
ZenTest (~> 4.3)
ZenTest (4.4.1)
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (= 3.0.3)
mail (~> 2.2.9)
actionpack (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.6)
tzinfo (~> 0.3.23)
activemodel (3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
arel (2.0.4)
builder (2.1.2)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
file-tail (1.0.5)
spruz (>= 0.1.0)
i18n (0.4.2)
json (1.4.6)
json (1.4.6-x86-mingw32)
mail (2.2.10)
activesupport (>= 2.3.6)
i18n (~> 0.4.1)
ZenTest (4.6.2)
actionmailer (3.1.1)
actionpack (= 3.1.1)
mail (~> 2.3.0)
actionpack (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.2)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.2)
activemodel (3.1.1)
activesupport (= 3.1.1)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
activesupport (3.1.1)
multi_json (~> 1.0)
arel (2.2.1)
builder (3.0.0)
diff-lcs (1.1.3)
erubis (2.7.0)
file-tail (1.0.7)
tins (~> 0.3)
hike (1.2.1)
i18n (0.6.0)
json (1.6.1)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
polyglot (0.3.1)
predicated (0.2.2)
rack (1.2.1)
rack-mount (0.6.13)
minitest (2.6.1)
multi_json (1.0.3)
polyglot (0.3.2)
predicated (0.2.6)
rack (1.3.5)
rack-cache (1.1)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-test (0.5.6)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.0.3)
actionmailer (= 3.0.3)
actionpack (= 3.0.3)
activerecord (= 3.0.3)
activeresource (= 3.0.3)
activesupport (= 3.0.3)
rails (3.1.1)
actionmailer (= 3.1.1)
actionpack (= 3.1.1)
activerecord (= 3.1.1)
activeresource (= 3.1.1)
activesupport (= 3.1.1)
bundler (~> 1.0)
railties (= 3.0.3)
railties (3.0.3)
actionpack (= 3.0.3)
activesupport (= 3.0.3)
railties (= 3.1.1)
railties (3.1.1)
actionpack (= 3.1.1)
activesupport (= 3.1.1)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
ruby2ruby (1.2.5)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.11)
json (~> 1.4)
ruby2ruby (1.3.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ruby_parser (2.0.5)
ruby_parser (2.0.6)
sexp_processor (~> 3.0)
sexp_processor (3.0.5)
sourcify (0.4.0)
sexp_processor (3.0.7)
sourcify (0.5.0)
file-tail (>= 1.0.5)
ruby2ruby (>= 1.2.5)
ruby_parser (>= 2.0.5)
sexp_processor (>= 3.0.5)
spruz (0.2.2)
thor (0.14.4)
treetop (1.4.9)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
test-unit (2.4.0)
thor (0.14.6)
tilt (1.3.3)
tins (0.3.1)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.23)
wrong (0.5.0)
tzinfo (0.3.30)
wrong (0.6.0)
ParseTree (~> 3.0)
diff-lcs (~> 1.1.2)
file-tail (~> 1.0)
predicated (>= 0.2.2)
predicated (>= 0.2.3)
ruby2ruby (~> 1.2)
ruby_parser (~> 2.0.4)
sexp_processor (~> 3.0)
sourcify (>= 0.3.0)

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
json
rack-test (>= 0.5.6)
rails (>= 3.0.0)
actionpack
rack-test
rails (= 3.1.1)
test-unit
vanna!
wrong (>= 0.5.0)
wrong
17 changes: 12 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
require 'rake/testtask'
task :default => :test

desc 'run all tests (in current ruby)'
task :test do
sh "ruby test/basic_test.rb"
sh "ruby test/personas_test.rb"
sh "ruby test/weapons_test.rb"
desc 'Generate test coverage report'
task :rcov do
sh "rcov -Ilib:test test/*_test.rb"
end

desc 'Run tests (default)'
Rake::TestTask.new(:test) do |t|
t.test_files = FileList['test/*_test.rb']
t.ruby_opts = ['-Itest']
t.ruby_opts << '-rubygems' if defined? Gem
end

13 changes: 12 additions & 1 deletion lib/vanna.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'action_controller'
require 'vanna/default_return_codes'
require 'vanna/default_redirects'
require 'pp'
module Vanna
def self.included(klass)
raise "#{klass.name} does not inherit from ActionController::Metal" unless klass.ancestors.include?(ActionController::Metal)
Expand Down Expand Up @@ -75,7 +76,17 @@ def self.inherited(subclass)
super
subclass.send(:include, DefaultReturnCodes) unless subclass.ancestors.member? DefaultReturnCodes
subclass.send(:include, DefaultRedirects) unless subclass.ancestors.member? DefaultRedirects
subclass.send(:include, Rails.application.routes.url_helpers)
# pp Rails.application
if (Rails.application)
if (Rails.application.routes)
# pp Rails.application.routes
subclass.send(:include, Rails.application.routes.url_helpers)
else
# print "no rails application routes defined!\n"
end
else
# print "no rails application defined!\n"
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tag %>
<title>Vanna Test</title>
</head>
Expand Down
10 changes: 8 additions & 2 deletions test/basic_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require './test/test_helper'
require 'welcome_controller'
require 'pp' #


WelcomeController.append_view_path "test/app/views"

class BasicTest < Test::Unit::TestCase
Expand All @@ -12,11 +15,14 @@ def app
def test_gets_json
header "Accept", 'application/json'
get "/"
assert{ JSON(last_response.body) == {"text" => "hello"} }
x = JSON(last_response.body)
y = {"text" => "hello"}
print "from response got:" +PP.pp(x, "") + " expected :" + PP.pp(y, "") + "\n"
assert (x == y)
end
def test_html_renders_template
get "/"
assert{ last_response.body =~ /Here is some text: hello/ }
assert (last_response.body =~ /Here is some text: hello/ )
end
end

22 changes: 17 additions & 5 deletions test/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
require 'rubygems'

gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)
Bundler.require(:default, Rails.env) if defined?(Bundler)
#Bundler.require(:default, Rails.env) if defined?(Bundler)


require "action_controller/railtie"
module ActionPresenter

class Controller < ApplicationController
def perform_caching
false
end
end

class Application < Rails::Application
# config.action_controller.perfom_caching=0
@c = Controller.new()
config.action_controller = @c

# @c = View.new()
# config.action_view = @v

config.active_support.deprecation = :stdout
config.secret_token = '8b9708cd5d4a96f541e04326467fc9c4b0c0a44c4d77b19632db2145fd1cf686d739f7d34a3ecce551c53dc8d31730e816cd332b3eececd95cc539b52e1aadde'
routes.draw do
root :to => "welcome#index"
match ':controller(/:action(/:id(.:format)))'
end

end
end
Loading