Permalink
Browse files

use minitest for testing. rename cuba helpers module. use cuba and cu…

…ba-contrib pre releases
  • Loading branch information...
1 parent 036f0f2 commit 4a4b4d9d8807a51877f8c2ce36fbb6534e44157f @DamianCaruso committed Mar 9, 2012
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use --create ruby-1.9.3-p0@eskel
View
9 Gemfile
@@ -2,16 +2,15 @@ source "http://rubygems.org"
gem 'thin', '~> 1.3.1'
-gem 'cuba', git: 'git://github.com/soveran/cuba.git'
-gem 'cuba-contrib', git: 'git://github.com/cyx/cuba-contrib.git'
+gem 'cuba', '~> 3.0.0.rc4'
+gem 'cuba-contrib', '~> 3.0.0.rc2'
gem 'mote', '~> 0.2.0'
gem 'hashie', '~> 1.2.0'
-gem 'foreman', '~> 0.31.0'
+gem 'foreman', '~> 0.40.0'
group :development, :test do
+ gem 'capybara', '~> 1.1.2'
gem 'rake', '~> 0.9.2.2'
- gem 'rspec', '~> 2.8.0'
- gem 'rack-test', '~> 0.6.1'
gem 'shotgun', '~> 0.9'
end
View
65 Gemfile.lock
@@ -1,62 +1,61 @@
-GIT
- remote: git://github.com/cyx/cuba-contrib.git
- revision: f439207ed5b569ba61331357e205bc2ae7356f64
- specs:
- cuba-contrib (3.0.0.rc2)
- cuba
-
-GIT
- remote: git://github.com/soveran/cuba.git
- revision: 7166a9bc510ea9bf6ffa4d6a881f8b7739b01b95
- specs:
- cuba (3.0.0.rc1)
- rack
- tilt
-
GEM
remote: http://rubygems.org/
specs:
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.1)
+ ffi (~> 1.0.6)
+ cuba (3.0.0.rc4)
+ rack
+ cuba-contrib (3.0.0.rc2)
+ cuba
daemons (1.1.5)
- diff-lcs (1.1.3)
eventmachine (0.12.10)
- foreman (0.31.0)
- term-ansicolor (~> 1.0.5)
+ ffi (1.0.11)
+ foreman (0.40.0)
+ term-ansicolor (~> 1.0.7)
thor (>= 0.13.6)
hashie (1.2.0)
+ mime-types (1.17.2)
mote (0.2.0)
+ multi_json (1.1.0)
+ nokogiri (1.5.0)
rack (1.4.1)
rack-test (0.6.1)
rack (>= 1.0)
rake (0.9.2.2)
- rspec (2.8.0)
- rspec-core (~> 2.8.0)
- rspec-expectations (~> 2.8.0)
- rspec-mocks (~> 2.8.0)
- rspec-core (2.8.0)
- rspec-expectations (2.8.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.8.0)
+ rubyzip (0.9.6.1)
+ selenium-webdriver (2.20.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0)
+ multi_json (~> 1.0)
+ rubyzip
shotgun (0.9)
rack (>= 1.0)
- term-ansicolor (1.0.5)
+ term-ansicolor (1.0.7)
thin (1.3.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.14.6)
- tilt (1.3.3)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
- cuba!
- cuba-contrib!
- foreman (~> 0.31.0)
+ capybara (~> 1.1.2)
+ cuba (~> 3.0.0.rc4)
+ cuba-contrib (~> 3.0.0.rc2)
+ foreman (~> 0.40.0)
hashie (~> 1.2.0)
mote (~> 0.2.0)
- rack-test (~> 0.6.1)
rake (~> 0.9.2.2)
- rspec (~> 2.8.0)
shotgun (~> 0.9)
thin (~> 1.3.1)
View
2 Procfile
@@ -1 +1 @@
-web: bundle exec thin start -p $PORT -e $RACK_ENV
+web: bundle exec thin start -p $PORT
View
26 Rakefile
@@ -7,12 +7,28 @@ rescue Bundler::BundlerError => e
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
-require 'rake'
-require 'rspec/core'
-require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec) do |spec|
- spec.pattern = FileList['spec/**/*_spec.rb']
+require 'rake/testtask'
+
+Rake::TestTask.new do |t|
+ t.libs = ["lib", "spec"]
+ t.name = "spec:unit"
+ t.test_files = FileList['spec/unit/*_spec.rb']
+ t.verbose = true
+end
+
+Rake::TestTask.new do |t|
+ t.libs = ["lib", "spec"]
+ t.name = "spec:integration"
+ t.test_files = FileList['spec/integration/*_spec.rb']
+ t.verbose = true
+end
+
+Rake::TestTask.new do |t|
+ t.libs = ["lib", "spec"]
+ t.name = "spec"
+ t.test_files = FileList['spec/**/*_spec.rb']
+ t.verbose = true
end
task :default => :spec
View
8 app/router.rb
@@ -5,11 +5,11 @@
Cuba.use Rack::Session::Cookie
Cuba.use Rack::Static, urls: ["/css", "/img", "/js"], root: root_path("public")
-Cuba.settings[:views] = root_path("app/views")
-
Cuba.plugin Cuba::Prelude
Cuba.plugin Cuba::Mote
-Cuba.plugin Eskel::Helpers
+Cuba.plugin Eskel::Cuba
+
+Cuba.settings[:views] = root_path("app/views")
Dir[root_path('app/routes/*.rb')].each { |f| require f }
@@ -18,7 +18,7 @@
run Home
end
- on get, "" do
+ on default do
redirect "/home"
end
end
View
4 app/routes/home.rb
@@ -1,4 +1,6 @@
-Home = Cuba.new do
+class Home < Cuba; end
+
+Home.define do
on get do
res.write view("home")
end
View
9 init.rb
@@ -12,12 +12,9 @@ def root_path(*args)
require "bundler"
Bundler.setup(:default, RACK_ENV.to_sym)
-$LOAD_PATH.unshift root_path('lib')
-require 'eskel'
+$LOAD_PATH.unshift root_path("lib")
+require "eskel"
-if defined? Encoding
- Encoding.default_external = Encoding::UTF_8
- Encoding.default_internal = Encoding::UTF_8
-end
+Encoding.default_internal = Encoding.default_external = Encoding::UTF_8 if defined? Encoding
require root_path("app/router")
View
2 lib/eskel.rb
@@ -18,5 +18,5 @@ def logger
end
end
- autoload :Helpers, "eskel/helpers"
+ autoload :Cuba, "eskel/cuba"
end
View
4 lib/eskel/helpers.rb → lib/eskel/cuba.rb
@@ -1,7 +1,7 @@
module Eskel
- module Helpers
+ module Cuba
def redirect(*args)
- run Cuba.new { on(default) { res.redirect(*args) }}
+ run ::Cuba.new { on(default) { res.redirect(*args) }}
end
def settings
View
3 spec/helper.rb
@@ -0,0 +1,3 @@
+ENV["RACK_ENV"] ||= "test"
+require File.expand_path('../init', File.dirname(__FILE__))
+require 'minitest/autorun'
View
10 spec/site_spec.rb → spec/integration/home_spec.rb
@@ -1,12 +1,8 @@
-require "spec_helper"
+require 'integration_helper'
describe "As a developer I want to see the homepage so I know this is correctly installed" do
- def app
- Cuba
- end
-
it "should respond to /home" do
- get '/home'
- last_response.should be_ok
+ visit '/home'
+ page.status_code.must_equal 200
end
end
View
7 spec/integration_helper.rb
@@ -0,0 +1,7 @@
+require 'helper'
+require 'capybara'
+require 'capybara/dsl'
+
+Capybara.app = Cuba
+Capybara.current_driver = :rack_test
+include Capybara::DSL
View
13 spec/spec_helper.rb
@@ -1,13 +0,0 @@
-ENV["RACK_ENV"] ||= "test"
-require File.expand_path('../init', File.dirname(__FILE__))
-require 'rspec'
-require 'rack/test'
-
-# Requires supporting files with custom matchers and macros, etc,
-# in ./support/ and its subdirectories.
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
-
-RSpec.configure do |config|
- config.include Rack::Test::Methods
- config.mock_with :rspec
-end
View
0 spec/support/.gitkeep → spec/unit/.gitignore
File renamed without changes.

0 comments on commit 4a4b4d9

Please sign in to comment.