Commit bfa22ea7 authored by Nina's avatar Nina

Setup rspec

Add rspec-rails gem and remove the test folder that was created with the
initial creation of the app. To ensure everything is working an example
for the list model was added.
parent 8a116b7b
--color
--require spec_helper
......@@ -20,3 +20,7 @@ group :development do
gem 'spring'
gem 'byebug'
end
group :development, :test do
gem 'rspec-rails', '~> 3.5'
end
......@@ -54,6 +54,7 @@ GEM
cancancan (1.15.0)
concurrent-ruby (1.0.4)
daemons (1.2.3)
diff-lcs (1.2.5)
erubis (2.7.0)
eventmachine (1.0.8)
execjs (2.7.0)
......@@ -115,6 +116,23 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.0.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-rails (3.5.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
ruby_parser (3.8.3)
sexp_processor (~> 4.1)
sass (3.4.23)
......@@ -161,6 +179,7 @@ DEPENDENCIES
cancancan (~> 1.9)
haml-rails (~> 0.9)
rails (~> 4.2)
rspec-rails (~> 3.5)
sass-rails (~> 5.0)
simple_form (~> 3.2)
spring
......
......@@ -13,7 +13,7 @@ Rails.application.configure do
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
......
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
end
require 'rails_helper'
describe List do
it { is_expected.to respond_to :subscriptions }
end
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
end
require 'test_helper'
class AccountsControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :create
assert_response :success
end
test "should get edit" do
get :edit
assert_response :success
end
test "should get update" do
get :update
assert_response :success
end
test "should get index" do
get :index
assert_response :success
end
test "should get show" do
get :show
assert_response :success
end
test "should get destroy" do
get :destroy
assert_response :success
end
end
require 'test_helper'
class KeysControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
test "should get show" do
get :show
assert_response :success
end
test "should get destroy" do
get :destroy
assert_response :success
end
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :create
assert_response :success
end
end
require 'test_helper'
class ListControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
test "should get show" do
get :show
assert_response :success
end
test "should get edit" do
get :edit
assert_response :success
end
end
require 'test_helper'
class LoginsControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :create
assert_response :success
end
test "should get destroy" do
get :destroy
assert_response :success
end
end
require 'test_helper'
class SubscriptionsControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :create
assert_response :success
end
test "should get edit" do
get :edit
assert_response :success
end
test "should get update" do
get :update
assert_response :success
end
test "should get show" do
get :show
assert_response :success
end
test "should get destroy" do
get :destroy
assert_response :success
end
end
require 'test_helper'
class AccountsHelperTest < ActionView::TestCase
end
require 'test_helper'
class KeysHelperTest < ActionView::TestCase
end
require 'test_helper'
class ListHelperTest < ActionView::TestCase
end
require 'test_helper'
class LoginsHelperTest < ActionView::TestCase
end
require 'test_helper'
class SubscriptionsHelperTest < ActionView::TestCase
end
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
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