Commit 2d068d29 by tady

spec devise macros

parent 083a28fd
......@@ -11,12 +11,12 @@
= render partial: 'posts/large_item', locals: { post: _post }
.col-xs-4
.panel.panel-default
.panel-heading
h2.panel-title この1週間で閲覧の多かった投稿(調整中)
.panel-body.list-group
- Post.limit(5).each do |_post|
= render partial: 'posts/small_item', locals: { post: _post }
/ .panel.panel-default
/ .panel-heading
/ h2.panel-title この1週間で閲覧の多かった投稿(調整中)
/ .panel-body.list-group
/ - Post.limit(5).each do |_post|
/ = render partial: 'posts/small_item', locals: { post: _post }
.panel.panel-default
.panel-heading
......
......@@ -2,16 +2,10 @@ require 'spec_helper'
describe FlowController do
before :each do
@post = create(:post)
end
describe "GET 'show'" do
login_user
it "returns http success" do
get 'show'
puts '+++++++++++++++++++++++++++++'
p response.body
puts '+++++++++++++++++++++++++++++'
response.should be_success
end
end
......
......@@ -3,6 +3,7 @@ require 'spec_helper'
describe SearchController do
describe "GET 'show'" do
login_user
it "returns http success" do
get 'show'
response.should be_success
......
# require 'spec_helper'
require 'spec_helper'
# describe StockController do
describe StockController do
# describe "GET 'show'" do
# it "returns http success" do
# get 'show'
# response.should be_success
# end
# end
describe "GET 'show'" do
login_user
it "returns http success" do
get 'show'
response.should be_success
end
end
# end
end
......@@ -94,6 +94,9 @@ RSpec.configure do |config|
DatabaseRewinder.clean
end
config.include Devise::TestHelpers, :type => :controller
config.extend ControllerMacros, :type => :controller
# Capybara.app_host = "http://127.0.0.1/"
register_poltergeist(config)
......
module ControllerMacros
def login_user
before(:each) do
controller.stub(:authenticate_user!).and_return true
@request.env["devise.mapping"] = Devise.mappings[:user]
sign_in FactoryGirl.create(:alice)
end
end
end
RSpec.configure do |config|
config.include Devise::TestHelpers, type: :controller
end
# RSpec.configure do |config|
# config.include Devise::TestHelpers, type: :controller
# 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