1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

creating test app

This commit is contained in:
kparagua 2012-12-17 18:50:23 +08:00
parent b87dd9b3b4
commit 732ccca576
14 changed files with 261 additions and 2 deletions

3
Gemfile Normal file
View file

@ -0,0 +1,3 @@
source "http://rubygems.org"
gemspec

133
Gemfile.lock Normal file
View file

@ -0,0 +1,133 @@
PATH
remote: .
specs:
paloma (0.0.1)
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.9)
actionpack (= 3.2.9)
mail (~> 2.4.4)
actionpack (3.2.9)
activemodel (= 3.2.9)
activesupport (= 3.2.9)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.9)
activesupport (= 3.2.9)
builder (~> 3.0.0)
activerecord (3.2.9)
activemodel (= 3.2.9)
activesupport (= 3.2.9)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.9)
activemodel (= 3.2.9)
activesupport (= 3.2.9)
activesupport (3.2.9)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
arel (3.0.2)
builder (3.0.4)
capybara (2.0.1)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 1.0.0)
childprocess (0.3.6)
ffi (~> 1.0, >= 1.0.6)
database_cleaner (0.9.1)
diff-lcs (1.1.3)
erubis (2.7.0)
ffi (1.2.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
json (1.7.5)
libwebsocket (0.1.7.1)
addressable
websocket
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.5.0)
nokogiri (1.5.5)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.9)
actionmailer (= 3.2.9)
actionpack (= 3.2.9)
activerecord (= 3.2.9)
activeresource (= 3.2.9)
activesupport (= 3.2.9)
bundler (~> 1.0)
railties (= 3.2.9)
railties (3.2.9)
actionpack (= 3.2.9)
activesupport (= 3.2.9)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.0)
rubyzip (0.9.9)
selenium-webdriver (2.27.2)
childprocess (>= 0.2.5)
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
websocket (1.0.4)
xpath (1.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bundler (>= 1.0.0)
capybara (>= 1.0)
database_cleaner
paloma!
rails (>= 3.1.0)
rake
rspec
sqlite3

16
Rakefile Normal file
View file

@ -0,0 +1,16 @@
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/*_spec.rb']
end
desc "Run tests"
task :test do
puts "Testing..."
sh "bundle exec rake spec"
end

View file

@ -10,4 +10,4 @@ require 'rails/all'
require 'paloma/paloma_generator'
require 'paloma/action_controller_filters'
require 'paloma/action_controller_extensions'
require 'paloma/action_controller_extension'

View file

@ -45,6 +45,7 @@ module Paloma
end
::ActionController::Base.send :include, ActionControllerFilters
end

View file

@ -8,4 +8,12 @@ Gem::Specification.new do |s|
s.email = 'kb.paragua@gmail.com'
s.files = `git ls-files`.split("\n")
s.homepage = 'https://github.com/kbparagua/paloma'
s.add_development_dependency 'rails', ['>= 3.1.0']
s.add_development_dependency 'bundler', ['>= 1.0.0']
s.add_development_dependency 'rake', ['>= 0']
s.add_development_dependency 'sqlite3', ['>= 0']
s.add_development_dependency 'rspec', ['>= 0']
s.add_development_dependency 'capybara', ['>= 1.0']
s.add_development_dependency 'database_cleaner', ['>= 0']
end

3
spec/callback_spec.rb Normal file
View file

@ -0,0 +1,3 @@
require 'spec_helper'

View file

@ -0,0 +1,29 @@
# Dummy Controllers
class ApplicationController < ActionController::Base
end
class ArticlesController < ApplicationController
def show
@article = Article.find params[:id]
end
def new
@article = Article.new
end
def create
@article = Article.new params[:article]
if @article.save
redirect_to @article
else
js_callback false
render :new
end
end
end

29
spec/sample_app/init.rb Normal file
View file

@ -0,0 +1,29 @@
require 'action_controller/railtie'
require 'action_view/railtie'
# Database Configuration
ActiveRecord::Base.configurations = {'test' => {
:adapter => 'sqlite3',
:database => ':memory:'}
}
ActiveRecord::Base.establish_connection('test')
# Dummy Rails Configurations
app = Class.new(Rails::Application)
app.config.secret_token = '3b7cd727ee24e8444053437c36cc66c4'
app.config.session_store :cookie_store, :key => '_myapp_session'
app.config.active_support.deprecation = :log
app.config.root = File.dirname(__FILE__)
Rails.backtrace_cleaner.remove_silencers!
app.initialize!
app.routes.draw do
resources :articles
end
require 'models'
require 'controllers'

View file

19
spec/sample_app/model.rb Normal file
View file

@ -0,0 +1,19 @@
# Model
class Article
attr_accessible :title, :body
end
# Migration
class CreateArticles < ActiveRecord::Migration
def self.up
create_table :articles do |t|
t.string :title
t.string :body
end
end
end
ActiveRecord::Migration.verbose = false
CreateArticles.up

View file

@ -0,0 +1,9 @@
<%= form_for @article do |f| %>
Title:
<%= f.text_field :title %>
Body:
<%= f.text_area :body %>
<%= f.submit %>
<% end %>

View file

@ -0,0 +1,2 @@
<h1><%= @article.title %></h1>
<p><%= @article.body %></p>

7
spec/spec_helper.rb Normal file
View file

@ -0,0 +1,7 @@
require 'rails'
require 'bundler/setup'
Bundler.require
require 'sample_app/init'
require 'rspec/rails'