aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorRhenium <rhenium@rhe.jp>2013-08-09 20:49:19 +0900
committerRhenium <rhenium@rhe.jp>2013-08-09 20:49:19 +0900
commitfec5d9668e344a950c5ac52b00443c691df830a8 (patch)
tree8ee66a3dbe066dd59fd57c7f2cfbd4f0ed3ecf40 /spec
parent1c87bd7296b2ef662bab5e4c78b0a31b81cf02a0 (diff)
downloadaclog-fec5d9668e344a950c5ac52b00443c691df830a8.tar.gz
fix spec: move logged_in? from helper to controller
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/application_controller_spec.rb19
-rw-r--r--spec/helpers/application_helper_spec.rb19
2 files changed, 19 insertions, 19 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 75f0e48..91219e7 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -1,6 +1,25 @@
require "spec_helper"
describe ApplicationController do
+ describe "#logged_in?" do
+ context "when logged in" do
+ before do
+ session[:account] = FactoryGirl.create(:account_1)
+ session[:user_id] = session[:account].user_id
+ end
+ subject { !!controller.__send__(:logged_in?) }
+ it { should be true }
+ end
+
+ context "when not logged in" do
+ before do
+ session[:account] = session[:user_id] = nil
+ end
+ subject { !!controller.__send__(:logged_in?) }
+ it { should be false }
+ end
+ end
+
describe "#_get_user" do
let(:user) { FactoryGirl.create(:user) }
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index c12af76..4716681 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -2,25 +2,6 @@
require "spec_helper"
describe ApplicationHelper do
- describe "#logged_in?" do
- context "when logged in" do
- before do
- session[:account] = FactoryGirl.create(:account_1)
- session[:user_id] = session[:account].user_id
- end
- subject { !!helper.logged_in? }
- it { should be true }
- end
-
- context "when not logged in" do
- before do
- session[:account] = session[:user_id] = nil
- end
- subject { !!helper.logged_in? }
- it { should be false }
- end
- end
-
describe "#format_time" do
let(:str) { "2013-04-14 01:02:03" }
let(:source) { Time.parse("#{str} +09:00") }