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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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 Player | |
REST_HEALTH = 15 | |
FLEE_HEALTH = 7 | |
def play_turn(warrior) | |
@last_known_health ||= warrior.health | |
@direction ||= :forward | |
feel_space = warrior.feel @direction | |
if clear_shot?(warrior) |
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
config.use_transactional_fixtures = false | |
config.before(:suite) do | |
DatabaseCleaner.clean_with :truncation #start the process by truncating all the tables | |
end | |
config.before(:each) do | |
if example.metadata[:js] | |
DatabaseCleaner.strategy = :truncation # for javascript tests using :truncation | |
else | |
DatabaseCleaner.strategy = :transaction #use the faster transaction strategy |
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
DEPLOY_PATH = { | |
:staging => 'app-name', | |
:production => 'app-name', | |
:uat => 'app-name-uat' | |
} | |
SERVICES = %w(app-name) | |
ENVIRONMENTS = [:staging, :uat] #这是测试环境的配置,对于产品环境可以改成[:production] | |
TIMEOUT = 30.seconds | |
LONG_TIMEOUT = 60.seconds |
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
# nginx.conf | |
http { | |
client_max_body_size 20M; #上传文件的大小 | |
} | |
------------------------------------------------------------------------------------ | |
#Nginx应用配置 | |
upstream app-name { | |
# 配置unicorn服务器器 | |
server unix:/opt/app-name/tmp/sockets/unicorn.sock |
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
# unicorn通过master进程管理worker进程,这里初始化工作进程的数量,默认为3个 | |
# 举例: AWS EC2 m3.2xlarge 设置30个worker | |
worker_processes Integer(ENV["UNICORN_CONCURRENCY"] || 3) | |
preload_app true | |
# 工作进程的响应超时时间(秒) | |
timeout 120 | |
listen "/tmp/sockets/unicorn.sock" | |
pid "/tmp/pids/unicorn.pid" | |
if ENV['RAILS_ENV'] == 'development' # 开发环境用于测试和验证一些配置 |
NewerOlder