Skip to content

Commit c566f6c

Browse files
committed
Merge master
2 parents 8622269 + b34c377 commit c566f6c

16 files changed

+381
-2
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ app/assets/.DS_Store
3232
# Files generated by the seed script
3333
/scripts/csv_to_seed_problems.log
3434
/scripts/new_seeds.rb
35+
36+
# IDE related .idea folder
37+
.idea/
38+

.rspec

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

Gemfile

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ group :development do
3737
gem "binding_of_caller"
3838
end
3939

40+
# Setting up rspec tests
41+
group :development, :test do
42+
gem 'rspec-rails', '~> 3.5'
43+
gem 'capybara'
44+
gem 'database_cleaner'
45+
end
46+
4047
# Tagging
4148
gem 'acts-as-taggable-on', '~> 3.4'
4249

Gemfile.lock

+37
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ GEM
2929
tzinfo (~> 1.1)
3030
acts-as-taggable-on (3.5.0)
3131
activerecord (>= 3.2, < 5)
32+
addressable (2.5.0)
33+
public_suffix (~> 2.0, >= 2.0.2)
3234
arel (5.0.1.20140414130214)
3335
autoprefixer-rails (6.7.0)
3436
execjs
@@ -43,6 +45,13 @@ GEM
4345
sass (>= 3.2.19)
4446
bootstrap_form (2.5.3)
4547
builder (3.2.3)
48+
capybara (2.12.0)
49+
addressable
50+
mime-types (>= 1.16)
51+
nokogiri (>= 1.3.3)
52+
rack (>= 1.0.0)
53+
rack-test (>= 0.5.4)
54+
xpath (~> 2.0)
4655
coderay (1.1.1)
4756
coffee-rails (4.0.1)
4857
coffee-script (>= 2.2.0)
@@ -51,7 +60,9 @@ GEM
5160
coffee-script-source
5261
execjs
5362
coffee-script-source (1.12.2)
63+
database_cleaner (1.5.3)
5464
debug_inspector (0.0.2)
65+
diff-lcs (1.2.5)
5566
erubis (2.7.0)
5667
execjs (2.7.0)
5768
hike (1.2.3)
@@ -68,9 +79,13 @@ GEM
6879
mime-types (3.1)
6980
mime-types-data (~> 3.2015)
7081
mime-types-data (3.2016.0521)
82+
mini_portile2 (2.1.0)
7183
minitest (5.10.1)
7284
multi_json (1.12.1)
85+
nokogiri (1.7.0.1)
86+
mini_portile2 (~> 2.1.0)
7387
pg (0.19.0)
88+
public_suffix (2.0.5)
7489
rack (1.5.5)
7590
rack-test (0.6.3)
7691
rack (>= 1.0)
@@ -96,6 +111,23 @@ GEM
96111
thor (>= 0.18.1, < 2.0)
97112
rake (12.0.0)
98113
rdoc (4.3.0)
114+
rspec-core (3.5.2)
115+
rspec-support (~> 3.5.0)
116+
rspec-expectations (3.5.0)
117+
diff-lcs (>= 1.2.0, < 2.0)
118+
rspec-support (~> 3.5.0)
119+
rspec-mocks (3.5.0)
120+
diff-lcs (>= 1.2.0, < 2.0)
121+
rspec-support (~> 3.5.0)
122+
rspec-rails (3.5.2)
123+
actionpack (>= 3.0)
124+
activesupport (>= 3.0)
125+
railties (>= 3.0)
126+
rspec-core (~> 3.5.0)
127+
rspec-expectations (~> 3.5.0)
128+
rspec-mocks (~> 3.5.0)
129+
rspec-support (~> 3.5.0)
130+
rspec-support (3.5.0)
99131
sass (3.2.19)
100132
sass-rails (4.0.5)
101133
railties (>= 4.0.0, < 5.0)
@@ -122,6 +154,8 @@ GEM
122154
thread_safe (~> 0.1)
123155
uglifier (3.0.4)
124156
execjs (>= 0.3.0, < 3)
157+
xpath (2.0.0)
158+
nokogiri (~> 1.3)
125159

126160
PLATFORMS
127161
ruby
@@ -132,12 +166,15 @@ DEPENDENCIES
132166
binding_of_caller
133167
bootstrap-sass (~> 3.3.4)
134168
bootstrap_form
169+
capybara
135170
coffee-rails (~> 4.0.0)
171+
database_cleaner
136172
jbuilder (~> 2.0)
137173
jquery-rails
138174
pg
139175
rails (= 4.1.7)
140176
rails_12factor
177+
rspec-rails (~> 3.5)
141178
sass-rails (~> 4.0.3)
142179
sdoc (~> 0.4.0)
143180
spring

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,25 @@ Please do not commit and push directly to the master branch! The hooks/pre-commi
147147
$ cp hooks/pre-commit .git/hooks/
148148
$ chmod +x .git/hooks/pre-commit
149149
```
150+
151+
### Running the tests
152+
153+
In order to run the tests, make sure all the gems are installed and the test environment is set up properly with working database.
154+
155+
+ Set up:
156+
157+
```
158+
$ bundle install
159+
$ bundle exec rake db:create RAILS_ENV=test
160+
$ bundle exec rake db:schema:load RAILS_ENV=test
161+
```
162+
163+
+ Run the tests with [RSpec Rails](https://github.com/rspec/rspec-rails):
164+
165+
```
166+
$ bundle exec rspec -fd
167+
```
168+
169+
Notes:
170+
+ ```-fd``` stands for full details. You can also run tests by using commands ```bundle exec rspec``` or ```bundle exec rake``` to get an overview without details of each test.
171+
+ If you are having trouble running bundle install, please make sure Nokogiri gem is installed on your machine. Full instructions can be found [here](http://www.nokogiri.org/tutorials/installing_nokogiri.html).
256 KB
Loading
Loading
1.21 MB
Loading
743 KB
Loading

app/assets/stylesheets/how.css.scss

+65
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,68 @@ p > a:hover {
4747
p > a:focus {
4848
color: $green;
4949
}
50+
.connect {
51+
margin: 0 auto;
52+
text-align: center;
53+
padding-top: 15px;
54+
}
55+
.connect_icons {
56+
width: 80%;
57+
list-style: none;
58+
display: inline;
59+
padding: 0;
60+
}
61+
62+
.connect_icons > li {
63+
display: inline;
64+
}
65+
66+
.connect img {
67+
width: 45px;
68+
margin: 5px 25px;
69+
}
70+
71+
// a.tooltips {
72+
// position: relative;
73+
// display: inline;
74+
// }
75+
// a.tooltips span {
76+
// position: absolute;
77+
// width:140px;
78+
// color: #FFFFFF;
79+
// background: #000000;
80+
// height: 30px;
81+
// line-height: 30px;
82+
// text-align: center;
83+
// visibility: hidden;
84+
// border-radius: 6px;
85+
// }
86+
// a.tooltips span:after {
87+
// content: '';
88+
// position: absolute;
89+
// top: 100%;
90+
// left: 50%;
91+
// margin-left: -8px;
92+
// width: 0; height: 0;
93+
// border-top: 8px solid #000000;
94+
// border-right: 8px solid transparent;
95+
// border-left: 8px solid transparent;
96+
// }
97+
// a:hover.tooltips span {
98+
// visibility: visible;
99+
// opacity: 0.8;
100+
// bottom: 30px;
101+
// left: 50%;
102+
// margin-left: -76px;
103+
// z-index: 999;
104+
// }
105+
106+
107+
//media queries
108+
109+
@media (max-width: 500px) {
110+
.connect img {
111+
width: 35px;
112+
margin: 5px 10px;
113+
}
114+
}

app/views/static_pages/how.html.erb

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@
1919
</p>
2020
<br>
2121
<p>
22-
Want to learn more or be a part of the she’s coding team? <%= link_to "Connect with us", "/connect" %>, or check out our project management systems: <%= link_to "Github", "https://github.com/shescoding", target: "_blank" %>, <%= link_to "Google Group", "https://groups.google.com/forum/#!forum/shescoding", target: "_blank" %>, <%= link_to "Trello", "https://trello.com/shescoding", target: "_blank" %>, <%= link_to "Slack", "https://shescoding.slack.com/", target: "_blank" %>.
22+
Want to learn more or be a part of the she’s coding team? <%= link_to "Connect with us", "/connect" %>, or check out our project management systems:
2323
</p>
2424
</div>
25+
<div class="connect">
26+
<ul class="connect_icons">
27+
<li><%= link_to image_tag("static_pages/github_logo.png"), "https://github.com/shescoding", title: 'Github', rel: 'tooltip', class: 'tooltips', target: "_blank" %><!-- <span>She's Coding on Github</span> --></li>
28+
<li><%= link_to image_tag("static_pages/google_groups_logo.png"), "https://groups.google.com/forum/#!forum/shescoding", title: 'Google Groups', rel: 'tooltip', target: "_blank" %></li>
29+
<li><%= link_to image_tag("static_pages/trello_logo.png"), "https://trello.com/shescoding", title: 'Trello', rel: 'tooltip', target: "_blank" %></li>
30+
<li><%= link_to image_tag("static_pages/slack_logo.png"), "https://shescoding.slack.com", title: 'Slack', rel: 'tooltip', target: "_blank" %></li>
31+
</div>
2532
<div class='how-section-title'>
2633
Convert understanding into action - join the She's Coding team!
2734
</div>

app/views/static_pages/team.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<div class="team-member-name">Bri Dotson</div>
9595
<div class="team-member-title">Contributor</div>
9696
<div class="tooltip-description">
97-
Bri is a feminist, homebrewer, tinkerer, musician, and software developer. She's trying to change the world one webapp and robot at a time. She is currently working as Software Engineer Intern Extraordinaire at EnergySavvy.
97+
Bri is a feminist, homebrewer, tinkerer, musician, and software developer. She's trying to change the world one webapp and robot at a time. She is currently working as Software Engineer Extraordinaire at EnergySavvy.
9898
</div>
9999
</div>
100100
</div>

spec/models/resource_spec.rb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require "rails_helper"
2+
3+
RSpec.describe Resource, :type => :model do
4+
5+
describe 'Model Resource' do
6+
7+
let (:resource_one) { Resource.create( {title: "Imposter Syndrome", url: "https://counseling.caltech.edu/general/InfoandResources/Impostor", description: "General definition and information on the Imposter Syndrome, provided by the Caltech Counseling Center." } ) }
8+
9+
it "has title, description and url" do
10+
expect(resource_one.title).to eq("Imposter Syndrome")
11+
expect(resource_one.url).to eq("https://counseling.caltech.edu/general/InfoandResources/Impostor")
12+
expect(resource_one.description).to eq("General definition and information on the Imposter Syndrome, provided by the Caltech Counseling Center.")
13+
end
14+
15+
end
16+
end

spec/rails_helper.rb

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# This file is copied to spec/ when you run 'rails generate rspec:install'
2+
ENV['RAILS_ENV'] ||= 'test'
3+
require File.expand_path('../../config/environment', __FILE__)
4+
# Prevent database truncation if the environment is production
5+
abort("The Rails environment is running in production mode!") if Rails.env.production?
6+
require 'spec_helper'
7+
require 'rspec/rails'
8+
require 'capybara/rails'
9+
require 'database_cleaner'
10+
# Add additional requires below this line. Rails is not loaded until this point!
11+
12+
# Requires supporting ruby files with custom matchers and macros, etc, in
13+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
14+
# run as spec files by default. This means that files in spec/support that end
15+
# in _spec.rb will both be required and run as specs, causing the specs to be
16+
# run twice. It is recommended that you do not name files matching this glob to
17+
# end with _spec.rb. You can configure this pattern with the --pattern
18+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
19+
#
20+
# The following line is provided for convenience purposes. It has the downside
21+
# of increasing the boot-up time by auto-requiring all files in the support
22+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
23+
# require only the support files necessary.
24+
#
25+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
26+
27+
# Checks for pending migration and applies them before tests are run.
28+
# If you are not using ActiveRecord, you can remove this line.
29+
ActiveRecord::Migration.maintain_test_schema!
30+
31+
RSpec.configure do |config|
32+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
33+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
34+
35+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
36+
# examples within a transaction, remove the following line or assign false
37+
# instead of true.
38+
config.use_transactional_fixtures = true
39+
40+
config.before(:suite) do
41+
DatabaseCleaner.clean_with(:truncation)
42+
end
43+
44+
config.before(:each, :js => true) do
45+
DatabaseCleaner.strategy = :truncation
46+
end
47+
48+
config.before(:each) do
49+
DatabaseCleaner.start
50+
end
51+
52+
config.after(:each) do
53+
DatabaseCleaner.clean
54+
end
55+
56+
# RSpec Rails can automatically mix in different behaviours to your tests
57+
# based on their file location, for example enabling you to call `get` and
58+
# `post` in specs under `spec/controllers`.
59+
#
60+
# You can disable this behaviour by removing the line below, and instead
61+
# explicitly tag your specs with their type, e.g.:
62+
#
63+
# RSpec.describe UsersController, :type => :controller do
64+
# # ...
65+
# end
66+
#
67+
# The different available types are documented in the features, such as in
68+
# https://relishapp.com/rspec/rspec-rails/docs
69+
config.infer_spec_type_from_file_location!
70+
71+
# Filter lines from Rails gems in backtraces.
72+
config.filter_rails_from_backtrace!
73+
# arbitrary gems may also be filtered via:
74+
# config.filter_gems_from_backtrace("gem name")
75+
76+
config.include Capybara::DSL
77+
end

0 commit comments

Comments
 (0)