Commit 717420e6 by vulehuan

using rspec test driven development

parent c14b7f96
......@@ -5,10 +5,7 @@ ruby '2.0.0'
gem 'rails', '4.0.0'
# Use mysql as the database for Active Record
group :development, :test do
gem 'mysql2'
gem 'rspec-rails'
end
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
......@@ -37,7 +34,7 @@ group :doc do
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
......@@ -47,3 +44,13 @@ end
# Use debugger
# gem 'debugger', group: [:development, :test]
group :development, :test do
gem 'rspec-rails'
gem 'faker', '1.1.2'
end
group :test do
gem 'capybara'
gem 'factory_girl_rails'
end
gem 'will_paginate', '3.0.4'
gem 'will_paginate-bootstrap'
\ No newline at end of file
......@@ -25,12 +25,19 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
arel (4.0.0)
arel (4.0.1)
atomic (1.1.14)
bcrypt-ruby (3.0.1)
builder (3.1.4)
coffee-rails (4.0.0)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0.beta, < 5.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
......@@ -38,6 +45,13 @@ GEM
diff-lcs (1.2.4)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
hike (1.2.3)
i18n (0.6.5)
jbuilder (1.5.2)
......@@ -46,14 +60,17 @@ GEM
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.0)
json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25)
mini_portile (0.5.1)
minitest (4.7.5)
multi_json (1.8.2)
mysql2 (0.3.13)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
......@@ -115,12 +132,21 @@ GEM
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
will_paginate (3.0.4)
will_paginate-bootstrap (1.0.0)
will_paginate (>= 3.0.3)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bcrypt-ruby (~> 3.0.0)
capybara
coffee-rails (~> 4.0.0)
factory_girl_rails
faker (= 1.1.2)
jbuilder (~> 1.2)
jquery-rails
mysql2
......@@ -130,3 +156,5 @@ DEPENDENCIES
sdoc
turbolinks
uglifier (>= 1.3.0)
will_paginate (= 3.0.4)
will_paginate-bootstrap
......@@ -10,7 +10,5 @@
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
// Place all the styles related to the Users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
class UsersController < ApplicationController
def new
end
end
class User < ActiveRecord::Base
end
<h1>Users#new</h1>
<p>Find me in app/views/users/new.html.erb</p>
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
......
......@@ -13,8 +13,8 @@ development:
encoding: utf8
database: venshop_app_development
pool: 5
username: root
password: "123456"
username: venshop
password: "venshop"
socket: /var/run/mysqld/mysqld.sock
# Warning: The database defined as "test" will be erased and
......@@ -25,8 +25,8 @@ test:
encoding: utf8
database: venshop_app_test
pool: 5
username: root
password:
username: venshop
password: "venshop"
socket: /var/run/mysqld/mysqld.sock
production:
......@@ -34,6 +34,6 @@ production:
encoding: utf8
database: venshop_app_production
pool: 5
username: root
password:
username: venshop
password: "venshop"
socket: /var/run/mysqld/mysqld.sock
......@@ -9,4 +9,4 @@
# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
VenshopApp::Application.config.secret_key_base = 'c99843ae3bd89507ba8e8bae6e0a53ce47f000b8cb65dfc13e7df224c7a3520684877e6d334c03070a0e29bcb40db6639906056946736a33be79fc570886f875'
VenshopApp::Application.config.secret_key_base = 'f582eabd5f42252c282f086d70c79b04144b68b440be2a305dd5085c7a8ddffc376ef1870d7d2e41fa484deaab7ce0977db7c69524d308c2fe82cf3ac89918a3'
VenshopApp::Application.routes.draw do
get "users/new"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
......
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :email
t.string :password_digest
t.string :remember_token
t.boolean :admin
t.timestamps
end
end
end
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20131023020942) do
create_table "users", force: true do |t|
t.string "name"
t.string "email"
t.string "password_digest"
t.string "remember_token"
t.boolean "admin"
t.datetime "created_at"
t.datetime "updated_at"
end
end
require 'spec_helper'
describe User do
pending "add some examples to (or delete) #{__FILE__}"
end
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment