added a simple rspec test for index.html.erb

This commit is contained in:
Skud committed 2012-09-03 11:21:07 +01:00
1 parent 89cb3c276f
commit 797846ffef
7 files changed
+85 -3

No files matched your search

+1
View File
@@ -0,0 +1 @@
--color
+8 -2
View File
@@ -40,6 +40,12 @@ gem 'jquery-rails'
# To use debugger
# gem 'debugger'
# growstuff additions
# GROWSTUFF ADDITIONS BELOW HERE
# user signup/login/etc
gem 'devise'
gem 'rspec'
# for testing
gem 'rspec-rails'
gem 'webrat'
+12 -1
View File
@@ -61,6 +61,7 @@ GEM
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.6)
nokogiri (1.5.5)
orm_adapter (0.4.0)
polyglot (0.3.3)
rack (1.4.1)
@@ -96,6 +97,11 @@ GEM
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.2)
rspec-rails (2.11.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
sass (3.2.1)
sass-rails (3.2.5)
railties (~> 3.2.0)
@@ -119,6 +125,10 @@ GEM
multi_json (~> 1.3)
warden (1.2.1)
rack (>= 1.0)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
PLATFORMS
ruby
@@ -129,8 +139,9 @@ DEPENDENCIES
devise
jquery-rails
rails (= 3.2.8)
rspec
rspec-rails
sass-rails (~> 3.2.3)
sqlite3
therubyracer
uglifier (>= 1.0.3)
webrat
+39
View File
@@ -0,0 +1,39 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# ## Mock Framework
#
# 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
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end
+4
View File
@@ -0,0 +1,4 @@
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
config.include Devise::TestHelpers, :type => :view
end
+17
View File
@@ -0,0 +1,17 @@
require 'spec_helper'
describe 'home/index.html.erb', :type => "view" do
context "when not logged in" do
before(:each) do
view.stub(:user_signed_in).and_return(false)
view.stub(:current_user).and_return(nil)
end
it 'shows the homepage' do
render
rendered.should contain 'Growstuff'
end
end
end
+4
View File
@@ -10,4 +10,8 @@ class ActiveSupport::TestCase
fixtures :all
# Add more helper methods to be used by all tests here...
class ActionController::TestCase
include Devise::TestHelpers
end
end