This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require_gem 'activerecord' | |
MIGRATIONS_PATH="#{File.dirname(__FILE__)}/db/migrate/" | |
# Set up ActiveRecord::Base.connection | |
# Migrate | |
database_type = ARGV[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_table "billing_accounts", :id => false, :force => true do |t| | |
t.column "id", :string, :limit => '36' | |
t.column "name", :string | |
end | |
execute "ALTER TABLE billing_accounts ADD PRIMARY KEY (id)" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class APLMoveDocWrapper < DocWrapperBase | |
property :description, :string, "./td[1]", :parser => lambda { |x| x.sub(' ', '') } | |
property :location, :string, "./td[2]/a" | |
property :date, :time, "./td[5]", :parser => APL_DATE_PARSER | |
property :vessel, :string, "./td[3]/a" | |
property :voyage, :string, "./td[3]/a" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First Request to get login form: | |
GET /mori/ HTTP/1.1 | |
Accept-Language: en-us,en;q=0.5 | |
Accept: */* | |
User-Agent: WWW-Mechanize/0.9.0 (http://rubyforge.org/projects/mechanize/) | |
Connection: keep-alive | |
Accept-Encoding: gzip,identity | |
Host: mori.demo.vitarara.net | |
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Login # features/login.feature | |
In order to secure access to the application. | |
I want all users to have to login. | |
Scenario: Present login page to unauthenticated users. # features/login.feature:5 | |
Given I have an account for "test" # features/step_definitions/global_steps.rb:3 | |
And I go to "account root" # features/step_definitions/webrat_steps.rb:6 | |
Then I should see "Login" # features/step_definitions/webrat_steps.rb:94 | |
expected: /Login/m, | |
got: "<html><body>You are being <a href=\"http://test.localhost/session/new\">redirected</a>.</body></html>" (using =~) | |
Diff: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
World do | |
session = Webrat::MechanizeSession.new | |
session.extend(Webrat::Matchers) | |
session.extend(Webrat::HaveTagMatcher) | |
session | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2009-10-06 15:02:58.980::WARN: Error for /quadran/ | |
java.lang.NoClassDefFoundError: org/jruby/RubyTempfile | |
at java.lang.Class.getDeclaredMethods0(Native Method) | |
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395) | |
at java.lang.Class.getDeclaredMethods(Class.java:1763) | |
at org.jruby.RubyModule$MethodClumper.clump(RubyModule.java:574) | |
at org.jruby.anno.TypePopulator$DefaultTypePopulator.populate(TypePopulator.java:47) | |
at org.jruby.RubyModule.defineAnnotatedMethodsIndividually(RubyModule.java:660) | |
at org.jruby.RubyModule.defineAnnotatedMethods(RubyModule.java:562) | |
at org.jruby.rack.input.RackBaseInput.getClass(RackBaseInput.java:36) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
end | |
class RatingEvent < ActiveRecord::Base | |
end | |
class PostRatingObserver < ActiveRecord::Base | |
observer :post | |
def after_save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
# This way of calling define_method works. | |
define_method(:bar) do | |
puts self | |
end | |
# This fails saying define_method is a private method. | |
# Why, when self is obviously the object receiving the define_method message...? | |
self.define_method(:foo) do | |
puts self | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Member < ActiveRecord::Base | |
class << self | |
def new (attributes = nil, &block) | |
if self == Member | |
klass = Object.const_get("#{(ENV['MORI_ENV'] ? ENV['MORI_ENV'] : "").camelize}Member".to_sym) | |
if klass != Member | |
return klass.new(attributes, &block) | |
end | |
end |
OlderNewer