Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

started on show

  • Loading branch information...
commit 0bf27115d37be2f2b2092baf232ee05cbef01ec2 1 parent 8f2bd73
@ywen2 ywen2 authored
View
24 Gemfile.lock
@@ -53,7 +53,7 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.1.1)
+ coffee-script-source (1.1.2)
compass-susy-plugin (0.9)
compass (>= 0.11.1)
daemons (1.1.4)
@@ -65,9 +65,9 @@ GEM
diff-lcs (1.1.2)
erubis (2.7.0)
eventmachine (0.12.10)
- execjs (1.2.0)
+ execjs (1.2.4)
multi_json (~> 1.0)
- factory_girl (2.0.1)
+ factory_girl (2.0.3)
factory_girl_rails (1.1.0)
factory_girl (~> 2.0.0)
railties (>= 3.0.0)
@@ -75,9 +75,9 @@ GEM
github-markup (0.5.3)
gollum (1.3.1)
albino (~> 1.3.2)
- github-markup (>= 0.4.0, < 1.0.0)
+ github-markup (< 1.0.0, >= 0.4.0)
grit (~> 2.4.1)
- mustache (>= 0.11.2, < 1.0.0)
+ mustache (< 1.0.0, >= 0.11.2)
nokogiri (~> 1.4)
redcarpet
sanitize (~> 2.0.0)
@@ -97,7 +97,7 @@ GEM
railties (~> 3.0)
thor (~> 0.14)
kgio (2.6.0)
- launchy (2.0.4)
+ launchy (2.0.5)
addressable (~> 2.2.6)
libv8 (3.3.10.2)
mail (2.3.0)
@@ -111,7 +111,7 @@ GEM
activemodel (~> 3.0)
activesupport (~> 3.0)
plucky (~> 0.3.8)
- mongoid (2.0.2)
+ mongoid (2.1.5)
activemodel (~> 3.0)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
@@ -152,7 +152,7 @@ GEM
thor (~> 0.14.6)
raindrops (0.7.0)
rake (0.9.2)
- rdoc (3.8)
+ rdoc (3.9.1)
redcarpet (1.17.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
@@ -169,8 +169,8 @@ GEM
rspec (~> 2.6.0)
rspec_more (0.3.1.1)
sanitize (2.0.3)
- nokogiri (>= 1.4.4, < 1.6)
- sass (3.1.5)
+ nokogiri (< 1.6, >= 1.4.4)
+ sass (3.1.7)
sass-rails (3.1.0.rc.5)
actionpack (~> 3.1.0.rc1)
railties (~> 3.1.0.rc1)
@@ -178,9 +178,9 @@ GEM
sprockets (>= 2.0.0.beta.9)
sinatra (1.2.6)
rack (~> 1.1)
- tilt (>= 1.2.2, < 2.0)
+ tilt (< 2.0, >= 1.2.2)
spork (0.9.0.rc9)
- sprockets (2.0.0.beta.12)
+ sprockets (2.0.0.beta.13)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
View
4 app/controllers/pages_controller.rb
@@ -4,4 +4,8 @@ class PagesController < ApplicationController
def index
@pages = Page.all
end
+
+ def show
+ # @page = Page.find params[:id]
+ end
end
View
13 spec/controllers/pages_controller_spec.rb
@@ -1,14 +1,13 @@
require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))
describe PagesController do
+ let(:page1) {double :page1}
describe "GET#index" do
- let(:page1) {double :page1}
let(:page2) {double :page2}
context "when the user logged in" do
- let(:user) {Factory.create :user}
+ include_context "user logged in"
before(:each) do
Page.stub(:all).and_return [page1, page2]
- sign_in :user, user
end
it "should get all pages" do
@@ -28,6 +27,14 @@
response.should redirect_to("/users/sign_in")
end
end
+ end
+ describe "GET#show" do
+ context "when the user hasn't logged in" do
+ it "should redirect to the sign_in page" do
+ get :show, :id => 'page-name'
+ response.should redirect_to("/users/sign_in")
+ end
+ end
end
end
View
4 spec/routing/pages_routing_spec.rb
@@ -6,5 +6,9 @@
it "recognizes and generates #index" do
{ :get => "/pages" }.should route_to(:controller => "pages", :action => "index")
end
+
+ it "recognizes and generates #show" do
+ { :get => "/pages/12" }.should route_to(:controller => "pages", :action => "show", :id => '12')
+ end
end
end
View
3  spec/spec_helper.rb
@@ -25,9 +25,6 @@
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
config.mock_with :rspec
config.include Devise::TestHelpers, :type => :controller
config.include Mongoid::Matchers
View
6 spec/support/user_login.rb
@@ -0,0 +1,6 @@
+shared_context "user logged in" do
+ let(:user) {Factory.create :user}
+ before(:each) do
+ sign_in :user, user
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.