rails new test_app --skip-test-unit 不生成默认的test,稍后用rspec
cd test_app

修改Gemfile(大部分为自动生成)

source 'https://ruby.taobao.org' -- 使用淘宝镜像,因为连接不了rubygem

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1' --rails版本
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
gem "slim-rails" --能够让erb转slim
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7' # Use Capistrano for deployment
# gem 'capistrano-rails', group: :development group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
gem 'rspec-rails', '3.5.1' -- 此处添加最新rspec
  # Use sqlite3 as the database for Active Record
 gem 'sqlite3'
end

group :test do -- 添加capybara及其依赖gem,能够编写类英语交互语句
gem 'selenium-webdriver', '~> 2.53', '>= 2.53.4'
gem 'capybara', '2.8.0'
end group :production do
gem 'pg', '~> 0.18.4'
end group :development do --heroku部署用
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

bundle install

bundle install --without production
bundle update
bundle install

生成rspec测试模块

rails generate rspec:install

push至git上

git init
git add .
git commit -m "Initial commit"
git remote add origin url
git push -u origin master

设置rails,让其服务于静态资源文件

config/environments/production.rb

TestApp::Application.configure do
.
.
.
config.serve_static_assets = true
.
.
.
end

spec测试文件:

require 'rails_helper'

RSpec.describe "StaticPages", :type => :feature do
describe "Home page" do
it "should have the content 'Help'" do
visit '/static_pages/home'
expect(page).to have_content('Sample App')
end
end describe "Help page" do
it "should have the content 'Help'" do
visit '/static_pages/help'
expect(page).to have_content('Help')
end
end
end

测试语句

bundle exec rspec spec/requests/static_pages_spec.rb

启动rails

rails s

rails创建项目,部署,测试流程(rails5.0+ruby2.3.1)的更多相关文章

  1. vue- Vue-Cli脚手架工具安装 -创建项目-页面开发流程-组件生命周期- -03

    目录 Vue-Cli 项目环境搭建 与 python 基础环境对比 环境搭建 创建启动 vue 项目 命令创建项目(步骤小多) 启动 vue 项目(命令行方式) 启动 vue 项目(pycharm 方 ...

  2. JSP_运维_JSP项目部署到server(适合0经验新手)

    实战:真正server端部署jsp项目经验总结与记录(完整过程从0到10适合对server端部署0经验新手) jsp+tomcat+mysql项目部署到真正server; servermysql安装; ...

  3. 迷你商城后台管理系统————stage3项目部署测试汇总

    系统测试 在项目部署到云服务器之前,已通过本机启动springboot程序,访问localhost:8080,输入登陆的账户等一系列操作测试:功能测试.健壮性测试,系统已满足用户规定的需求. 系统部署 ...

  4. 迷你商城后台管理系统---------stage3项目部署测试汇总

    系统测试 在项目部署到云服务器之前,已通过本机启动springboot程序,访问localhost:8080,输入登陆的账户等一系列操作测试:功能测试.健壮性测试,系统已满足用户规定的需求. 系统部署 ...

  5. Web项目后台测试流程

    1. 本地下载项目源码 1. Git clone项目代码到本地(本地项目代码1)并fetch: 2. Switch到master分支: 3. Create测试分支(例如:test1)并勾选“Switc ...

  6. rails 创建项目、创建controller、model等

    rails2之前创建新项目: rails3以及更高版本创建新项目:rails new webname 创建数据表model:rails g model user name:string sex:str ...

  7. web手工项目01-系统组织框架-测试流程-需求评审-测试计划与方案

    回顾 SVN(定义,作用,使用操作) 软件缺陷(定义,表现形式,原因和根源,基本内容,跟踪流程) JIRA(基本介绍,使用者,工作流,问题,使用) 学习目标 掌握WAMP的环境搭建 掌握熟悉项目的步骤 ...

  8. web测试流程的总结及关注点

    项目的测试流程大只包含的几个阶段:立项.需求评审.用例评审.测试执行.测试报告文档 一.立项后测试需要拿到的文档 1.需求说明书 2.原型图(及UI图) 3.接口文档 4.数据库字典(表的数量.缓存机 ...

  9. vue-cli 3.0 安装和创建项目流程

    使用前我们先了解下3.0较2.0有哪些区别 一.3.0 新加入了 TypeScript 以及 PWA 的支持二.部分命令发生了变化: 1.下载安装  npm install -g vue@cli 2. ...

随机推荐

  1. Cygwin + CMake 测试

    https://www.cygwin.com/ apt-get for cygwin? wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg in ...

  2. Linux CentOS 编绎安装Python 3.5

    Linux CentOS 编绎安装Python 3.5 先决条件(若无安装,则不能编绎使用idle3):yum install tk-devel xz -d Python-3.5.0.tar.xzta ...

  3. appium关于定位元素

    Windows上定位元素我用的是uiautomatorviewer 这个工具在你的SDK-tools目录下,点击uiautomatorviewer.bat启动,注意appium在跑的时候是取不到的 工 ...

  4. js- 千分位分割

    // 千分位 console.log(split3str("123456789")) function splitByReg3(str) { var re = /(\d{1,3}) ...

  5. CDN的原理以及其中的一些技术

    本质:DNS解析CNAME时最终会请求到阿里CDN的DNS服务器上,阿里CDN的DNS服务器会判断请求ip的物理区域是哪里,同时根据各CDN节点的压力做全局的负载均衡 返回合适CDN节点的ip. ht ...

  6. Web service是什么?

    原文:http://www.ruanyifeng.com/blog/2009/08/what_is_web_service.html 我认为,下一代互联网软件将建立在Web service(也就是&q ...

  7. C#对象的声明与实例化

    在代码中我们经常能看到下面这样的语句. A a = new A();(1) B b = null;(2) C c;(3) 代码( 1 ) 创建 A 的对象并对其进行初始化. A :类: new A() ...

  8. C# 3.0 LINQ的准备工作

    局部变量 隐式类型允许你用var修饰类型.用var修饰只是编译器方便我们进行编码,类型本身仍然是强类型的,所以当编译器无法推断出类型时(例如你初始化一个变量却没有为其赋值,或赋予null,此时就无法推 ...

  9. nc 反弹链接

    nc -l -v -p 80在本机监听80端口,此时80端口是打开的,我们可以在浏览器输入127.0.0.1进行浏览,此时就会出现连接,我们再在监听窗口输入字符,就会在浏览器上显示了.知道上面的作用后 ...

  10. [BS-08]注意Xcode自动提示好用但极易出错,务必看清方法的名称

    今日在写一个UIBarButtonItem的分类时,在Xcode自动提示时,因未仔细查看,错将需要用到setBackgroundImage的地方,选择成setImage,结果导致button的boun ...