
ruby on rails
zhupanos
这个作者很懒,什么都没留下…
展开
-
Exception: Bad file descriptor - connect(2)
Hi,allI am trying to test web application using the sample code:ruby 代码 require "selenium" require "test/unit" class NewTest < Test::Unit::TestCase def setup ...2007-08-07 15:59:48 · 592 阅读 · 0 评论 -
9.3. Working with Trees
I think that I shall never seeA poem as lovely as a tree..."Trees," [Alfred] Joyce KilmerTrees in computer science are a relatively intuitive concept (except that they are usually drawn with t...2008-01-19 15:06:24 · 156 阅读 · 0 评论 -
9.2. Working with Stacks and Queues
Stacks and queues are the first entities we have discussed that are not strictly built into Ruby. By this we mean that Ruby does not have Stack and Queue classes as it does Array and Hash classes (...2008-01-19 15:04:26 · 163 阅读 · 0 评论 -
9.1. Working with Sets
We've already seen how certain methods of the Array class let it serve as an acceptable representation of a mathematical set. But for a little more rigor and a little tighter coding, Ruby has a Set ...2008-01-19 15:03:27 · 126 阅读 · 0 评论 -
8.3. Enumerables in General
What makes a collection enumerable? Largely it is just the fact of being a collection. The module Enumerable has the requirement that the default iterator each should be defined. Sequence as such is...2008-01-19 14:26:40 · 191 阅读 · 0 评论 -
8.2. Working with Hashes
Hashes are known in some circles as associative arrays, dictionaries, and various other names. Perl and Java programmers in particular will be familiar with this data structure.Think of an array as...2008-01-19 14:25:20 · 195 阅读 · 0 评论 -
计算两个字符串之间的Levenshtein距离
Levenshtein距离 class String def levenshtein(other, ins=2, del=2, sub=1) return nil if self.nil? return nil if other.nil? dm = [] dm[0] = (0..self.length).collect { |i| ...2008-01-09 23:32:34 · 313 阅读 · 0 评论 -
字符串的编码和解码
rot13编码和解码 class String def rot13 self.tr("A-Ma-mN-Zn-z","N-Zn-zA-Ma-m") endendtest="test"test=test.rot13 #"grfg"test=test.rot13 #"test" base64字符串的编码和解码 str = "test"new_string=[str].2008-01-09 23:11:41 · 299 阅读 · 0 评论 -
rails应用自动化部署——使用capistrano2.0
昨天用capistrano2.0把应用部署搞的比较自动化了一点.capistrano2.0基本使用步骤是:1.install capistranoruby 代码 gem install capistrano 2.进入rails工程根目录执行 ruby 代码 capify . 这个命令会生成两个文件,一个是Capfile文件,在应用的根目...2007-10-10 18:59:43 · 190 阅读 · 0 评论 -
selenium和ajax的测试问题
Hi,allI am having doubts in selenium and ajax.比如:我选择省份,需要等待一点时间才会出现省份下面的市,我才能选择县市,县市是通过选择省份之后触发ajax异步加载的,所以需要等待一点时间,我试着用wait_for_page_to_load()等待,会抛出Time out异常,后来又发现了wait_for_condition(),我就试着用了:rub...2007-08-13 15:51:57 · 440 阅读 · 0 评论 -
在selenium测试中使用ActiveRecord
ActiveRecord是rails的框架,我们在selenium测试中肯定需要初始化数据或者清理数据库数据以保证各个测试之间的独立性,可以这样用ActiveRecord来初始化或清理数据库ruby 代码 require 'test/unit' require 'selenium' require 'active_record' ActiveR...2007-08-10 18:15:55 · 177 阅读 · 0 评论 -
关于rails应用的验收测试
ruby的测试运行的本来都慢,selenium的验收测试跑起来就更慢了,不知道大家都用什么进行集成测试?有没有改进的办法。看到还有一个Watir貌似可以干同样的事,但是没有像selenium ide一样的自动录入工具,自己写脚本比较繁琐。还有一个Selenium on Rails我就更不喜欢了,语法看着不爽不说,声称可以用selenium ide( If you don‘t want to wr...2007-08-08 18:26:24 · 146 阅读 · 0 评论 -
Fast Query
class System::FastQuery def self.sub_join_str(model) Util.is_submodel(model) ? " AND #{model.table_name}.#{model.inheritance_column} = '#{model.name.demodulize}'" : "" end class Conditions ...原创 2008-01-19 15:07:43 · 199 阅读 · 0 评论