Skip to content

Instantly share code, notes, and snippets.

@rainchen
rainchen / gist:7fd55e4a4aced4aff144
Created August 26, 2014 02:38
佛祖保佑 永无BUG
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
Feature: Items in scheduled
As an singed up user
I want to manage my todos or projects which placed in scheduled
Background:
Given I am a confirmed user and signed in as "tom@iamtom.com" with password "iamtom"
Scenario: Move a new todo to Scheduled
When I create a todo "To meet David" on "" about "About trip planning"
And I drag todo "To meet David" to place Scheduled
Scenario: Move a project which have some todos to Scheduled
Given I create a project "Project A"
And I create todos "Todo A"
When I drag todo "Todo A" to project "Project A"
Then the todo "Todo A" should be placed in "Next"
When I drag project "Project A" to place Scheduled
Then I should see "Schedule"
When I fill in "Scheduled at" with the date "tomorrow"
And I fill in "Scheduled Action" with "move_to_today"
And I press "OK"
# Cucumber helper for multiple forms in one page by RainChen @ 2009-11-06
# more detail: http://hi.baidu.com/rainchen/blog/item/dfad7931f77e2413ebc4afc1.html
# select a form as current scope
When /^I focus on the form which "([^\"]*)" is "([^\"]*)"$/ do |attr, value|
selector = "form[@#{attr}='#{value}']"
# within using: Webrat::XML.css_at(@scope.dom, @selector)
# p webrat_session.within("form[@action='/pages/search']") {|scope| scope.dom }
# xpath_search requried ".//" , for example:
Scenario: Searching pages
Given I create a sub page "About us" for "/"
And I create a sub page "Contact us" for "About us"
When I go to "/pages/admin"
Then I should see "Search pages"
When I focus on the form which "action" is "/pages/search"
And I select "title" from "scope"
And I fill in "query" with "us"
And I press "search"
Then I should see "About us"
# Rails i18n helpers by RainChen @ 2009-11-09
# more detail: http://hi.baidu.com/rainchen/blog/item/b393fc03589f4b82d53f7c37.html
class String
# short curt for I18n.t
# This returns the translation for foo or default if no translation was found:
# "foo".t # => "foo"
# "hello".t "en" # => "hello"
# "hello".t :default => 'halo'
*** LOCAL GEMS ***
actionmailer (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
actionpack (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
activerecord (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
activeresource (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
activesupport (2.3.4, 2.3.3, 2.3.2, 2.2.2, 2.1.2)
acts_as_paranoid (0.3.1)
class1 = function() {
// private fields
var m_first = 1;
var m_second = 2;
// public attributes
this.p_3 = 3;
// private methods
function constructor() {
console.info(this.p_3);
// jquery ajax helper by RainChen @ 2009-11-4
// more detail: http://hi.baidu.com/rainchen/blog/item/8877861821904abe4bedbc07.html
// show the ajax result
app.ajax.showResult = function(options){
options = $.extend({title: '', body: '', width: 350, height: 200, iframe: false, zIndex: 7000}, options);
if(!$("#app_ajax_result").get(0)){
$(document.body).append('<div id="app_ajax_result"></div>');
$("#app_ajax_result").dialog({
title: '',
# debugging helper for cucumber by RainChen @ 2009-11-18
# more detail: http://hi.baidu.com/rainchen/blog/item/ee410708d2f5a63ae8248823.html
if Cucumber::VERSION == '0.4.4'
Then /^(.+) for debugging$/ do |whatever|
ENV['DEBUGGING'] = whatever
warn(%{Debuging: Then #{whatever}})
Then %{#{whatever}}
end