Commit f27cab5b by tady

Merge pull request #93 from tadyjp/update_ruby_and_rails

[WIP] rubyとrailsのバージョンアップ
parents 3ccd8e08 18b8e10a
bundler_args: "--without development --path=~/.bundle" bundler_args: "--without development --path=~/.bundle"
language: ruby language: ruby
rvm: rvm:
- 2.0.0 - 2.1.2
env: env:
matrix: matrix:
- DB_TEST_DATABASE=rendezvous_test DB_TEST_USER=travis - DB_TEST_DATABASE=rendezvous_test DB_TEST_USER=travis
......
source 'https://rubygems.org' source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4' gem 'rails', '~> 4.1'
# Use SCSS for stylesheets # Use SCSS for stylesheets
gem 'sass-rails' gem 'sass-rails'
...@@ -17,9 +17,6 @@ gem 'jquery-rails' ...@@ -17,9 +17,6 @@ gem 'jquery-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes # See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
# gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks' # gem 'turbolinks'
...@@ -48,9 +45,6 @@ gem 'mysql2' ...@@ -48,9 +45,6 @@ gem 'mysql2'
gem 'devise' gem 'devise'
# http://d.hatena.ne.jp/tkawa/20130812/p1
gem 'devise-better_routes'
gem 'omniauth-google-oauth2' gem 'omniauth-google-oauth2'
# Markdown # Markdown
......
...@@ -18,27 +18,27 @@ GIT ...@@ -18,27 +18,27 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (4.1.0.rc2) actionmailer (4.1.0)
actionpack (= 4.1.0.rc2) actionpack (= 4.1.0)
actionview (= 4.1.0.rc2) actionview (= 4.1.0)
mail (~> 2.5.4) mail (~> 2.5.4)
actionpack (4.1.0.rc2) actionpack (4.1.0)
actionview (= 4.1.0.rc2) actionview (= 4.1.0)
activesupport (= 4.1.0.rc2) activesupport (= 4.1.0)
rack (~> 1.5.2) rack (~> 1.5.2)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
actionview (4.1.0.rc2) actionview (4.1.0)
activesupport (= 4.1.0.rc2) activesupport (= 4.1.0)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
activemodel (4.1.0.rc2) activemodel (4.1.0)
activesupport (= 4.1.0.rc2) activesupport (= 4.1.0)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.1.0.rc2) activerecord (4.1.0)
activemodel (= 4.1.0.rc2) activemodel (= 4.1.0)
activesupport (= 4.1.0.rc2) activesupport (= 4.1.0)
arel (~> 5.0.0) arel (~> 5.0.0)
activesupport (4.1.0.rc2) activesupport (4.1.0)
i18n (~> 0.6, >= 0.6.9) i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
...@@ -90,10 +90,10 @@ GEM ...@@ -90,10 +90,10 @@ GEM
coffee-rails (4.0.1) coffee-rails (4.0.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0) coffee-script (2.3.0)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.7.0) coffee-script-source (1.7.1)
colorize (0.7.3) colorize (0.7.3)
coveralls (0.7.0) coveralls (0.7.0)
multi_json (~> 1.3) multi_json (~> 1.3)
...@@ -112,9 +112,6 @@ GEM ...@@ -112,9 +112,6 @@ GEM
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
devise-better_routes (0.0.4)
devise (>= 3.0.0.rc)
rails (>= 4.0.0.rc1)
diff-lcs (1.2.5) diff-lcs (1.2.5)
docile (1.1.5) docile (1.1.5)
domain_name (0.5.19) domain_name (0.5.19)
...@@ -153,10 +150,10 @@ GEM ...@@ -153,10 +150,10 @@ GEM
guard-rubocop (1.1.0) guard-rubocop (1.1.0)
guard (~> 2.0) guard (~> 2.0)
rubocop (~> 0.20) rubocop (~> 0.20)
guard-teaspoon (0.0.4) guard-teaspoon (0.8.0)
guard (>= 1.6.1) guard (~> 2.2)
teaspoon (>= 0.5.3) teaspoon (>= 0.8.0)
hashie (3.1.0) hashie (3.2.0)
hike (1.2.3) hike (1.2.3)
htmlentities (4.3.2) htmlentities (4.3.2)
http-cookie (1.0.2) http-cookie (1.0.2)
...@@ -165,7 +162,7 @@ GEM ...@@ -165,7 +162,7 @@ GEM
i18n_generators (1.2.1) i18n_generators (1.2.1)
mechanize mechanize
rails (>= 3.0.0) rails (>= 3.0.0)
jbuilder (2.1.2) jbuilder (2.1.3)
activesupport (>= 3.0.0, < 5) activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-rails (3.1.1) jquery-rails (3.1.1)
...@@ -258,19 +255,19 @@ GEM ...@@ -258,19 +255,19 @@ GEM
rack (>= 1.1.3) rack (>= 1.1.3)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.1.0.rc2) rails (4.1.0)
actionmailer (= 4.1.0.rc2) actionmailer (= 4.1.0)
actionpack (= 4.1.0.rc2) actionpack (= 4.1.0)
actionview (= 4.1.0.rc2) actionview (= 4.1.0)
activemodel (= 4.1.0.rc2) activemodel (= 4.1.0)
activerecord (= 4.1.0.rc2) activerecord (= 4.1.0)
activesupport (= 4.1.0.rc2) activesupport (= 4.1.0)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.1.0.rc2) railties (= 4.1.0)
sprockets-rails (~> 2.0.0) sprockets-rails (~> 2.0)
railties (4.1.0.rc2) railties (4.1.0)
actionpack (= 4.1.0.rc2) actionpack (= 4.1.0)
activesupport (= 4.1.0.rc2) activesupport (= 4.1.0)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.0.0) rainbow (2.0.0)
...@@ -281,8 +278,8 @@ GEM ...@@ -281,8 +278,8 @@ GEM
rdoc (4.1.1) rdoc (4.1.1)
json (~> 1.4) json (~> 1.4)
ref (1.0.5) ref (1.0.5)
request_store (1.0.6) request_store (1.0.7)
rest-client (1.7.1) rest-client (1.7.2)
mime-types (>= 1.16, < 3.0) mime-types (>= 1.16, < 3.0)
netrc (~> 0.7) netrc (~> 0.7)
rspec (3.0.0) rspec (3.0.0)
...@@ -312,16 +309,17 @@ GEM ...@@ -312,16 +309,17 @@ GEM
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
ruby-progressbar (1.5.1) ruby-progressbar (1.5.1)
sass (3.3.9) sass (3.2.19)
sass-rails (4.0.1) sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10) sass (~> 3.2.0)
sprockets-rails (~> 2.0.0) sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0)
sdoc (0.4.0) sdoc (0.4.0)
json (~> 1.8) json (~> 1.8)
rdoc (~> 4.0, < 5.0) rdoc (~> 4.0, < 5.0)
settingslogic (2.0.9) settingslogic (2.0.9)
simplecov (0.8.2) simplecov (0.9.0)
docile (~> 1.1.0) docile (~> 1.1.0)
multi_json multi_json
simplecov-html (~> 0.8.0) simplecov-html (~> 0.8.0)
...@@ -329,13 +327,13 @@ GEM ...@@ -329,13 +327,13 @@ GEM
slim (2.0.3) slim (2.0.3)
temple (~> 0.6.6) temple (~> 0.6.6)
tilt (>= 1.3.3, < 2.1) tilt (>= 1.3.3, < 2.1)
slop (3.5.0) slop (3.6.0)
sprockets (2.12.1) sprockets (2.11.0)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0) multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1) sprockets-rails (2.1.3)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (~> 2.8) sprockets (~> 2.8)
...@@ -363,12 +361,12 @@ GEM ...@@ -363,12 +361,12 @@ GEM
treetop (1.4.15) treetop (1.4.15)
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
turnip (1.2.1) turnip (1.2.2)
gherkin (>= 2.5) gherkin (>= 2.5)
rspec (>= 2.0, < 4.0) rspec (>= 2.0, < 4.0)
tzinfo (1.2.1) tzinfo (1.2.1)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (2.5.1) uglifier (2.5.3)
execjs (>= 0.3.0) execjs (>= 0.3.0)
json (>= 1.8.0) json (>= 1.8.0)
unf (0.1.4) unf (0.1.4)
...@@ -403,7 +401,6 @@ DEPENDENCIES ...@@ -403,7 +401,6 @@ DEPENDENCIES
coveralls coveralls
database_rewinder database_rewinder
devise devise
devise-better_routes
draper (~> 1.3) draper (~> 1.3)
factory_girl_rails factory_girl_rails
faraday faraday
...@@ -427,7 +424,7 @@ DEPENDENCIES ...@@ -427,7 +424,7 @@ DEPENDENCIES
premailer premailer
pry-rails pry-rails
rack-mini-profiler rack-mini-profiler
rails (~> 4) rails (~> 4.1)
rspec-rails rspec-rails
rubocop rubocop
sass-rails sass-rails
......
class MeController < ApplicationController class UsersController < ApplicationController
before_action :set_user, only: [:edit, :update] before_action :set_user, only: [:edit, :update]
def edit def edit
...@@ -6,21 +7,20 @@ class MeController < ApplicationController ...@@ -6,21 +7,20 @@ class MeController < ApplicationController
def update def update
respond_to do |format| respond_to do |format|
if @me.update(user_params) if @user.update(user_params)
format.html { redirect_to edit_me_path, flash: { notice: 'Post was successfully updated.' } } format.html { redirect_to edit_user_path, flash: { notice: 'Post was successfully updated.' } }
format.json { head :no_content } format.json { head :no_content }
else else
format.html { render action: 'edit' } format.html { render action: 'edit' }
format.json { render json: @me.errors, status: :unprocessable_entity } format.json { render json: @user.errors, status: :unprocessable_entity }
end end
end end
end end
private private
# Use callbacks to share common setup or constraints between actions.
def set_user def set_user
@me = current_user @user = current_user
end end
def user_params def user_params
......
# == Schema Information
#
# Table name: notifications
#
# id :integer not null, primary key
# user_id :integer
# read_at :datetime
# is_read :boolean default(FALSE), not null
# detail_path :string(255)
# body :text
# created_at :datetime
# updated_at :datetime
#
class Notification < ActiveRecord::Base class Notification < ActiveRecord::Base
belongs_to :user belongs_to :user
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
# #
# Table name: tags # Table name: tags
# #
# id :integer not null, primary key # id :integer not null, primary key
# name :string(255) # name :string(255)
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# ancestry :string(255) # ancestry :string(255)
# body :text # body :text
# posts_count :integer default(0), not null
# #
class Tag < ActiveRecord::Base class Tag < ActiveRecord::Base
......
...@@ -37,10 +37,10 @@ nav.navbar.navbar-default.navbar-fixed-top role="navigation" ...@@ -37,10 +37,10 @@ nav.navbar.navbar-default.navbar-fixed-top role="navigation"
| 下書き | 下書き
span.badge.pull-right = current_user.decorate.draft_count span.badge.pull-right = current_user.decorate.draft_count
li li
a href=edit_me_path マイページ a href=edit_user_path マイページ
li.divider li.divider
li li
a href=me_session_path data-method="delete" rel="nofollow" SignOut a href=destroy_user_session_path data-method="delete" rel="nofollow" SignOut
li.dropdown li.dropdown
a.dropdown-toggle data-toggle="dropdown" a.dropdown-toggle data-toggle="dropdown"
| 通知 | 通知
......
#post-form #post-form
= form_for(@me, url: me_path) do |f| = form_for(@user, url: user_path) do |f|
- if @me.errors.any? - if @user.errors.any?
#error_explanation #error_explanation
h2 h2
= pluralize(@me.errors.count, "error") = pluralize(@user.errors.count, "error")
| prohibited this post from being saved: | prohibited this post from being saved:
ul ul
- @me.errors.full_messages.each do |msg| - @user.errors.full_messages.each do |msg|
li= msg li= msg
.row .row
......
Teaspoon.setup do |config|
# This determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to
# http://localhost:3000/jasmine to run your specs.
config.mount_at = "/teaspoon"
# This defaults to Rails.root if left nil. If you're testing an engine using a dummy application it can be useful to
# set this to your engines root.. E.g. `Teaspoon::Engine.root`
config.root = nil
# These paths are appended to the Rails assets paths (relative to config.root), and by default is an array that you
# can replace or add to.
config.asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets"]
# Fixtures are rendered through a standard controller. This means you can use things like HAML or RABL/JBuilder, etc.
# to generate fixtures within this path.
config.fixture_path = "spec/javascripts/fixtures"
# You can modify the default suite configuration and create new suites here. Suites can be isolated from one another.
# When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can
# omit various directives and the defaults will be used.
#
# To run a specific suite
# - in the browser: http://localhost/teaspoon/[suite_name]
# - from the command line: rake teaspoon suite=[suite_name]
config.suite do |suite|
# You can specify a file matcher and all matching files will be loaded when the suite is run. It's important that
# these files are serve-able from sprockets.
#
# Note: Can also be set to nil.
suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
# Each suite can load a different helper, which can in turn require additional files. This file is loaded before
# your specs are loaded, and can be used as a manifest.
suite.helper = "spec_helper"
# These are the core Teaspoon javascripts. It's strongly encouraged to include only the base files here. You can
# require other support libraries in your spec helper, which allows you to change them without having to restart the
# server.
#
# Available frameworks: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
#
# Note: To use the CoffeeScript source files use `"teaspoon/jasmine"` etc.
suite.javascripts = ["teaspoon-jasmine"]
# If you want to change how Teaspoon looks, or include your own stylesheets you can do that here. The default is the
# stylesheet for the HTML reporter.
suite.stylesheets = ["teaspoon"]
# When running coverage reports, you probably want to exclude libraries that you're not testing.
# Accepts an array of filenames or regular expressions. The default is to exclude assets from vendors or gems.
suite.no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
# suite.no_coverage << "jquery.min.js" # excludes jquery from coverage reports
end
# Example suite. Since we're just filtering to files already within the root spec/javascripts, these files will also
# be run in the default suite -- but can be focused into a more specific suite.
#config.suite :targeted do |suite|
# suite.matcher = "spec/javascripts/targeted/*_spec.{js,js.coffee,coffee}"
#end
end if defined?(Teaspoon) && Teaspoon.respond_to?(:setup) # let Teaspoon be undefined outside of development/test/asset groups
...@@ -26,8 +26,16 @@ Rendezvous::Application.routes.draw do ...@@ -26,8 +26,16 @@ Rendezvous::Application.routes.draw do
devise_for :users, devise_for :users,
path_names: { current_user: 'me' }, path_names: { current_user: 'me' },
controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }, controllers: {
skip: [:passwords] omniauth_callbacks: 'users/omniauth_callbacks',
registrations: 'users/registrations'
},
skip: [
:passwords,
:registrations,
]
resource :user
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.
......
...@@ -4,10 +4,16 @@ ...@@ -4,10 +4,16 @@
defaults: &defaults defaults: &defaults
rendezvous: rendezvous:
# For amil body
app_host: "http://rendezvous.dev" app_host: "http://rendezvous.dev"
# For login
google_api: google_api:
client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com" client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# For file upload
s3: s3:
access_key_id: "xxxxxxxxxxxxxxxxxxxxx" access_key_id: "xxxxxxxxxxxxxxxxxxxxx"
secret_access_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" secret_access_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
......
require 'spec_helper' require 'spec_helper'
describe ApisController do describe ApisController, type: :controller do
describe "GET 'markdown_preview'" do describe "GET 'markdown_preview'" do
it "returns http redirect" do it "returns http redirect" do
...@@ -10,9 +10,9 @@ describe ApisController do ...@@ -10,9 +10,9 @@ describe ApisController do
end end
describe "GET 'markdown_preview'" do describe "GET 'markdown_preview'" do
login_user
it "returns http success" do it "returns http success" do
sign_in FactoryGirl.create(:alice)
get 'markdown_preview' get 'markdown_preview'
expect(response).to be_success expect(response).to be_success
end end
......
require 'spec_helper' require 'spec_helper'
describe FlowController do describe FlowController, type: :controller do
describe "GET 'show' without login" do describe "GET 'show' without login" do
it "returns http redirect" do it "returns http redirect" do
...@@ -10,9 +10,9 @@ describe FlowController do ...@@ -10,9 +10,9 @@ describe FlowController do
end end
describe "GET 'show' with login" do describe "GET 'show' with login" do
login_user
it "returns http success" do it "returns http success" do
sign_in FactoryGirl.create(:alice)
get 'show' get 'show'
expect(response).to be_success expect(response).to be_success
end end
......
require 'spec_helper' require 'spec_helper'
describe SearchController do describe SearchController, type: :controller do
describe "GET 'show' without login" do describe "GET 'show' without login" do
it "returns http redirect" do it "returns http redirect" do
...@@ -10,9 +10,9 @@ describe SearchController do ...@@ -10,9 +10,9 @@ describe SearchController do
end end
describe "GET 'show' with login" do describe "GET 'show' with login" do
login_user
it "returns http success" do it "returns http success" do
sign_in FactoryGirl.create(:alice)
get 'show' get 'show'
expect(response).to be_success expect(response).to be_success
end end
......
require 'spec_helper' require 'spec_helper'
describe StockController do describe StockController, type: :controller do
describe "GET 'show' without login" do describe "GET 'show' without login" do
it "returns http redirect" do it "returns http redirect" do
...@@ -10,9 +10,9 @@ describe StockController do ...@@ -10,9 +10,9 @@ describe StockController do
end end
describe "GET 'show' with login" do describe "GET 'show' with login" do
login_user
it "returns http success" do it "returns http success" do
sign_in FactoryGirl.create(:alice)
get 'show' get 'show'
expect(response).to be_success expect(response).to be_success
end end
......
require 'spec_helper' require 'spec_helper'
describe TagsController do describe TagsController, type: :controller do
let(:tag) { FactoryGirl.create(:tag_ruby) } let(:tag) { FactoryGirl.create(:tag_ruby) }
...@@ -12,9 +12,9 @@ describe TagsController do ...@@ -12,9 +12,9 @@ describe TagsController do
end end
describe "GET 'show' with login" do describe "GET 'show' with login" do
login_user
it "returns http success" do it "returns http success" do
sign_in FactoryGirl.create(:alice)
get 'show', name: tag.name get 'show', name: tag.name
expect(response).to be_success expect(response).to be_success
end end
......
require 'spec_helper' require 'spec_helper'
describe MeController do describe UsersController, type: :controller do
before do
end
describe "GET 'edit'" do describe "GET 'edit'" do
login_user
it "returns http success" do it "returns http success" do
sign_in FactoryGirl.create(:alice)
get :edit get :edit
response.should be_success response.should be_success
end end
end end
describe "GET 'update'" do describe "GET 'update'" do
login_user
it "returns http success" do it "returns http success" do
sign_in FactoryGirl.create(:alice)
patch :update, user: { nickname: 'bob' } patch :update, user: { nickname: 'bob' }
response.should redirect_to('/me/edit') response.should redirect_to('/user/edit')
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe WelcomeController do describe WelcomeController, type: :controller do
describe "GET 'top'" do describe "GET 'top'" do
it 'should be successful' do it 'should be successful' do
...@@ -12,22 +12,23 @@ describe WelcomeController do ...@@ -12,22 +12,23 @@ describe WelcomeController do
describe 'Login' do describe 'Login' do
before(:each) do let(:user) { FactoryGirl.create(:alice) }
@user = FactoryGirl.create(:login_user_1)
sign_in @user
end
describe "GET 'top'" do describe "GET 'top'" do
it 'should be successful' do it 'should be successful' do
sign_in FactoryGirl.create(:alice)
get :top get :top
expect(subject).to redirect_to controller: 'flow', expect(subject).to redirect_to controller: 'flow',
action: 'show' action: 'show'
end end
it 'should find the right user' do it 'should find the right user' do
sign_in user
get :top get :top
expect(assigns(:current_user)).to eq(@user) expect(assigns(:current_user)).to eq(user)
end end
end end
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
# #
# Table name: tags # Table name: tags
# #
# id :integer not null, primary key # id :integer not null, primary key
# name :string(255) # name :string(255)
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# ancestry :string(255) # ancestry :string(255)
# body :text # body :text
# posts_count :integer default(0), not null
# #
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
......
# Teaspoon includes some support files, but you can use anything from your own support path too. # Teaspoon includes some support files, but you can use anything from your own support path too.
# require support/jasmine-jquery-1.7.0 # require support/expect
# require support/jasmine-jquery-2.0.0
# require support/sinon # require support/sinon
# require support/chai
# require support/your-support-file # require support/your-support-file
# #
# PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion. # PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
...@@ -26,6 +26,14 @@ ...@@ -26,6 +26,14 @@
# #
# For more information: http://github.com/modeset/teaspoon # For more information: http://github.com/modeset/teaspoon
# #
# Chai
# If you're using Chai, you'll probably want to initialize your preferred assertion style. You can read more about Chai
# at: http://chaijs.com/guide/styles
#
# window.assert = chai.assert
# window.expect = chai.expect
# window.should = chai.should()
#
# You can require your own javascript files here. By default this will include everything in application, however you # You can require your own javascript files here. By default this will include everything in application, however you
# may get better load performance if you require the specific files that are being used in the spec that tests them. # may get better load performance if you require the specific files that are being used in the spec that tests them.
#= require application #= require application
# == Schema Information
#
# Table name: notifications
#
# id :integer not null, primary key
# user_id :integer
# read_at :datetime
# is_read :boolean default(FALSE), not null
# detail_path :string(255)
# body :text
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper' require 'spec_helper'
describe Notification do describe Notification do
......
...@@ -70,42 +70,42 @@ describe Post do ...@@ -70,42 +70,42 @@ describe Post do
end end
it 'by id' do it 'by id' do
expect(Post.search('id:1001')).to have(1).items expect(Post.search('id:1001').size).to eq(1)
expect(Post.search('id:1001')).to include(@post1) expect(Post.search('id:1001')).to include(@post1)
end end
it 'by title' do it 'by title' do
expect(Post.search('title:ruby')).to have(2).items expect(Post.search('title:ruby').size).to eq(2)
expect(Post.search('title:ruby')).to include(@post1) expect(Post.search('title:ruby')).to include(@post1)
end end
it 'by body' do it 'by body' do
expect(Post.search('body:ruby')).to have(2).items expect(Post.search('body:ruby').size).to eq(2)
expect(Post.search('body:ruby')).to include(@post3) expect(Post.search('body:ruby')).to include(@post3)
end end
it 'by @<author_name>' do it 'by @<author_name>' do
expect(Post.search('@Alice')).to have(1).items expect(Post.search('@Alice').size).to eq(1)
expect(Post.search('@Alice')).to include(@post2) expect(Post.search('@Alice')).to include(@post2)
end end
it 'by #<tag_name>' do it 'by #<tag_name>' do
expect(Post.search('#java')).to have(1).items expect(Post.search('#java').size).to eq(1)
expect(Post.search('#java')).to include(@post3) expect(Post.search('#java')).to include(@post3)
end end
it 'by date' do it 'by date' do
expect(Post.search('date:1989-2-25')).to have(1).items expect(Post.search('date:1989-2-25').size).to eq(1)
expect(Post.search('date:1989-2-25')).to include(@post3) expect(Post.search('date:1989-2-25')).to include(@post3)
end end
it 'by draft' do it 'by draft' do
expect(Post.search('ruby')).to have(3).items expect(Post.search('ruby').size).to eq(3)
expect(Post.search('ruby draft:1')).to have(1).items expect(Post.search('ruby draft:1').size).to eq(1)
end end
it 'by else' do it 'by else' do
expect(Post.search('ruby')).to have(3).items expect(Post.search('ruby').size).to eq(3)
expect(Post.search('ruby')).to include(@post1) expect(Post.search('ruby')).to include(@post1)
expect(Post.search('ruby')).to include(@post3) expect(Post.search('ruby')).to include(@post3)
end end
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
# #
# Table name: tags # Table name: tags
# #
# id :integer not null, primary key # id :integer not null, primary key
# name :string(255) # name :string(255)
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# ancestry :string(255) # ancestry :string(255)
# body :text # body :text
# posts_count :integer default(0), not null
# #
require 'spec_helper' require 'spec_helper'
...@@ -23,11 +24,11 @@ describe Tag do ...@@ -23,11 +24,11 @@ describe Tag do
end end
it 'successfully moved' do it 'successfully moved' do
expect(Tag.find_by(name: 'ruby').posts).to have(2).items expect(Tag.find_by(name: 'ruby').posts.size).to eq(2)
expect(Tag.find_by(name: 'java').posts).to have(2).items expect(Tag.find_by(name: 'java').posts.size).to eq(2)
@tag_java.move_all_posts_to!(@tag_ruby) @tag_java.move_all_posts_to!(@tag_ruby)
expect(Tag.find_by(name: 'ruby').posts).to have(3).items expect(Tag.find_by(name: 'ruby').posts.size).to eq(3)
expect(Tag.find_by(name: 'java').posts).to have(0).items expect(Tag.find_by(name: 'java').posts.size).to eq(0)
end end
end end
......
...@@ -35,11 +35,11 @@ describe User do ...@@ -35,11 +35,11 @@ describe User do
describe '#google_oauth_token_expired?' do describe '#google_oauth_token_expired?' do
it 'not expired' do it 'not expired' do
expect(alice.google_oauth_token_expired?).to be_false expect(alice.google_oauth_token_expired?).to be_falsey
end end
it 'expired' do it 'expired' do
expect(bob.google_oauth_token_expired?).to be_true expect(bob.google_oauth_token_expired?).to be_truthy
end end
end end
......
...@@ -95,7 +95,7 @@ RSpec.configure do |config| ...@@ -95,7 +95,7 @@ RSpec.configure do |config|
end end
config.include Devise::TestHelpers, :type => :controller config.include Devise::TestHelpers, :type => :controller
config.extend ControllerMacros, :type => :controller # config.extend ControllerMacros, :type => :controller
# Capybara.app_host = "http://127.0.0.1/" # Capybara.app_host = "http://127.0.0.1/"
register_poltergeist(config) register_poltergeist(config)
......
...@@ -42,7 +42,7 @@ Teaspoon.configure do |config| ...@@ -42,7 +42,7 @@ Teaspoon.configure do |config|
# Note: If no version is specified, the latest is assumed. # Note: If no version is specified, the latest is assumed.
# #
# Available: jasmine[1.3.1, 2.0.0], mocha[1.10.0, 1.17.1] qunit[1.12.0, 1.14.0] # Available: jasmine[1.3.1, 2.0.0], mocha[1.10.0, 1.17.1] qunit[1.12.0, 1.14.0]
suite.use_framework :jasmine, "1.3.1" suite.use_framework :mocha
# Specify a file matcher as a regular expression and all matching files will be loaded when the suite is run. These # Specify a file matcher as a regular expression and all matching files will be loaded when the suite is run. These
# files need to be within an asset path. You can add asset paths using the `config.asset_paths`. # files need to be within an asset path. You can add asset paths using the `config.asset_paths`.
...@@ -57,7 +57,7 @@ Teaspoon.configure do |config| ...@@ -57,7 +57,7 @@ Teaspoon.configure do |config|
# Note: For CoffeeScript files use `"teaspoon/jasmine"` etc. # Note: For CoffeeScript files use `"teaspoon/jasmine"` etc.
# #
# Available: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit # Available: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
#suite.javascripts = ["jasmine/1.3.1", "teaspoon-jasmine"] #suite.javascripts = ["mocha/1.17.1", "teaspoon-mocha"]
# You can include your own stylesheets if you want to change how Teaspoon looks. # You can include your own stylesheets if you want to change how Teaspoon looks.
# Note: Spec related CSS can and should be loaded using fixtures. # Note: Spec related CSS can and should be loaded using fixtures.
......
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