Skip to content

Instantly share code, notes, and snippets.

@cosmo0920
Last active January 1, 2016 20:29
Show Gist options
  • Save cosmo0920/8197060 to your computer and use it in GitHub Desktop.
Save cosmo0920/8197060 to your computer and use it in GitHub Desktop.
waku work controller spec
diff --git a/server/spec/app/controllers/action_controller_spec.rb b/server/spec/app/controllers/action_controller_spec.rb
new file mode 100644
index 0000000..75ebee7
--- /dev/null
+++ b/server/spec/app/controllers/action_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe "ActionController" do
+ context "when not login" do
+ let (:redirect) { 403 }
+ before do
+ get :work
+ end
+
+ it { last_response.status.should eq redirect }
+ end
+end
diff --git a/server/spec/app/controllers/base_controller_spec.rb b/server/spec/app/controllers/base_controller_spec.rb
index d63925d..26f5bd1 100644
--- a/server/spec/app/controllers/base_controller_spec.rb
+++ b/server/spec/app/controllers/base_controller_spec.rb
@@ -1,7 +1,19 @@
require 'spec_helper'
describe "BaseController" do
- before do
- get "/"
+ context "get /" do
+ before do
+ get "/"
+ end
+
+ it { last_response.status.should be_true }
+ end
+
+ context "get /mypage" do
+ before do
+ get "/mypage"
+ end
+
+ it { last_response.status.should be_true }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment