Skip to content

Instantly share code, notes, and snippets.

View pobing's full-sized avatar

Jed pobing

View GitHub Profile
@pobing
pobing / rails deploying
Created December 9, 2011 10:22
Deploying a Ruby on Rails application Nginx & Apache
一 、Apache with passenger deploying rails project
1. 安装好 ror 环境
bundle exec rake RAILS_ENV=production db:create
bundle exec rake RAILS_ENV=production db:migrate
2. 安装apache
sudo apt-get install apache2 apache2-mpm-prefork apache2-prefork-dev
3.安装 passenger
sudo gem install passenger
sudo passenger-install-apache2-module
4. 按照提示 编辑 httpd.conf ,并添加如下配置
@pobing
pobing / gist:1369125
Last active September 28, 2015 02:18
Rspec+capybara get page Element
模拟浏览器,人工测试
1. 文本框:
直接填充 : fill_in("#{@user.id}_name",:with=>"jdo")
通过节点赋值 : find(:xpath,"//html/body/div[2]/div[2]/div/div/div[3]").set("123456")
获取文本框值: find(:xpath,"//html/body/div[2]/div[2]/div/div/div[3]").value.should=="expect value"
@pobing
pobing / gist:1369094
Last active September 28, 2015 02:18
Capybara 获取元素 支持JS &jquery
Scripting
一、In drivers which support it, you can easily execute JavaScript:
page.execute_script("$('body').empty()")
For simple expressions, you can return the result of the script. Note that this may break with more complicated expressions:
result = page.evaluate_script('4 + 4');
二、 page.execute_script("$('div:eq(0)').length")
page.execute_script("document.getElementById('wrapper')")
@pobing
pobing / gist:1369089
Last active July 12, 2018 09:34
Ubuntu下Git服务器安装与配置
Ubuntu下Git服务器安装与配置
1. 安装
1.1 安装Git-Core:
sudo apt-get install git-core
1.2 安装 Gitosis
sudo apt-get install python-setuptools
mkdir ~/src
cd ~/src
git clone git://eagain.net/gitosis