Skip to content

Commit fdad62b

Browse files
committed
Added test for index page
1 parent f1610cb commit fdad62b

File tree

5 files changed

+164
-0
lines changed

5 files changed

+164
-0
lines changed

.rspec

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--color
2+
--warnings
3+
--require spec_helper

Gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ source "https://rubygems.org"
33

44
gem "rack"
55

6+
#Use RSpec for testing
7+
group :development, :test do
8+
gem 'rspec-rails', '~> 3.0.0'
9+
end
10+
611
# gem "rails"

Gemfile.lock

+67
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,77 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
actionpack (4.2.4)
5+
actionview (= 4.2.4)
6+
activesupport (= 4.2.4)
7+
rack (~> 1.6)
8+
rack-test (~> 0.6.2)
9+
rails-dom-testing (~> 1.0, >= 1.0.5)
10+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
11+
actionview (4.2.4)
12+
activesupport (= 4.2.4)
13+
builder (~> 3.1)
14+
erubis (~> 2.7.0)
15+
rails-dom-testing (~> 1.0, >= 1.0.5)
16+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
17+
activesupport (4.2.4)
18+
i18n (~> 0.7)
19+
json (~> 1.7, >= 1.7.7)
20+
minitest (~> 5.1)
21+
thread_safe (~> 0.3, >= 0.3.4)
22+
tzinfo (~> 1.1)
23+
builder (3.2.2)
24+
diff-lcs (1.2.5)
25+
erubis (2.7.0)
26+
i18n (0.7.0)
27+
json (1.8.3)
28+
loofah (2.0.3)
29+
nokogiri (>= 1.5.9)
30+
mini_portile (0.6.2)
31+
minitest (5.8.1)
32+
nokogiri (1.6.6.2-x86-mingw32)
33+
mini_portile (~> 0.6.0)
434
rack (1.6.4)
35+
rack-test (0.6.3)
36+
rack (>= 1.0)
37+
rails-deprecated_sanitizer (1.0.3)
38+
activesupport (>= 4.2.0.alpha)
39+
rails-dom-testing (1.0.7)
40+
activesupport (>= 4.2.0.beta, < 5.0)
41+
nokogiri (~> 1.6.0)
42+
rails-deprecated_sanitizer (>= 1.0.1)
43+
rails-html-sanitizer (1.0.2)
44+
loofah (~> 2.0)
45+
railties (4.2.4)
46+
actionpack (= 4.2.4)
47+
activesupport (= 4.2.4)
48+
rake (>= 0.8.7)
49+
thor (>= 0.18.1, < 2.0)
50+
rake (10.4.2)
51+
rspec-core (3.0.4)
52+
rspec-support (~> 3.0.0)
53+
rspec-expectations (3.0.4)
54+
diff-lcs (>= 1.2.0, < 2.0)
55+
rspec-support (~> 3.0.0)
56+
rspec-mocks (3.0.4)
57+
rspec-support (~> 3.0.0)
58+
rspec-rails (3.0.2)
59+
actionpack (>= 3.0)
60+
activesupport (>= 3.0)
61+
railties (>= 3.0)
62+
rspec-core (~> 3.0.0)
63+
rspec-expectations (~> 3.0.0)
64+
rspec-mocks (~> 3.0.0)
65+
rspec-support (~> 3.0.0)
66+
rspec-support (3.0.4)
67+
thor (0.19.1)
68+
thread_safe (0.3.5)
69+
tzinfo (1.2.2)
70+
thread_safe (~> 0.1)
571

672
PLATFORMS
773
x86-mingw32
874

975
DEPENDENCIES
1076
rack
77+
rspec-rails (~> 3.0.0)

spec/spec_helper.rb

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# This file was generated by the `rspec --init` command. Conventionally, all
2+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
4+
# file to always be loaded, without a need to explicitly require it in any files.
5+
#
6+
# Given that it is always loaded, you are encouraged to keep this file as
7+
# light-weight as possible. Requiring heavyweight dependencies from this file
8+
# will add to the boot time of your test suite on EVERY test run, even for an
9+
# individual file that may not need all of that loaded. Instead, make a
10+
# separate helper file that requires this one and then use it only in the specs
11+
# that actually need it.
12+
#
13+
# The `.rspec` file also contains a few flags that are not defaults but that
14+
# users commonly want.
15+
#
16+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17+
RSpec.configure do |config|
18+
# The settings below are suggested to provide a good initial experience
19+
# with RSpec, but feel free to customize to your heart's content.
20+
=begin
21+
# These two settings work together to allow you to limit a spec run
22+
# to individual examples or groups you care about by tagging them with
23+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
24+
# get run.
25+
config.filter_run :focus
26+
config.run_all_when_everything_filtered = true
27+
28+
# Many RSpec users commonly either run the entire suite or an individual
29+
# file, and it's useful to allow more verbose output when running an
30+
# individual spec file.
31+
if config.files_to_run.one?
32+
# Use the documentation formatter for detailed output,
33+
# unless a formatter has already been configured
34+
# (e.g. via a command-line flag).
35+
config.default_formatter = 'doc'
36+
end
37+
38+
# Print the 10 slowest examples and example groups at the
39+
# end of the spec run, to help surface which specs are running
40+
# particularly slow.
41+
config.profile_examples = 10
42+
43+
# Run specs in random order to surface order dependencies. If you find an
44+
# order dependency and want to debug it, you can fix the order by providing
45+
# the seed, which is printed after each run.
46+
# --seed 1234
47+
config.order = :random
48+
49+
# Seed global randomization in this process using the `--seed` CLI option.
50+
# Setting this allows you to use `--seed` to deterministically reproduce
51+
# test failures related to randomization by passing the same `--seed` value
52+
# as the one that triggered the failure.
53+
Kernel.srand config.seed
54+
55+
# rspec-expectations config goes here. You can use an alternate
56+
# assertion/expectation library such as wrong or the stdlib/minitest
57+
# assertions if you prefer.
58+
config.expect_with :rspec do |expectations|
59+
# Enable only the newer, non-monkey-patching expect syntax.
60+
# For more details, see:
61+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
62+
expectations.syntax = :expect
63+
end
64+
65+
# rspec-mocks config goes here. You can use an alternate test double
66+
# library (such as bogus or mocha) by changing the `mock_with` option here.
67+
config.mock_with :rspec do |mocks|
68+
# Enable only the newer, non-monkey-patching expect syntax.
69+
# For more details, see:
70+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
71+
mocks.syntax = :expect
72+
73+
# Prevents you from mocking or stubbing a method that does not exist on
74+
# a real object. This is generally recommended.
75+
mocks.verify_partial_doubles = true
76+
end
77+
=end
78+
end

spec/web_pages_spec.rb

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require_relative 'spec_helper'
2+
3+
#Describe the index page
4+
#It returns a successful response
5+
6+
RSpec.describe "GET index", :type => :view do
7+
it "returns http success" do
8+
visit :index
9+
expect(response).to be_success
10+
end
11+
end

0 commit comments

Comments
 (0)