Last active
December 28, 2015 17:38
-
-
Save ml242/7536924 to your computer and use it in GitHub Desktop.
Adding Rspec and Guard to a ruby project that isn't backed by Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go to your directory | |
run --> rspec --init | |
cd into rspec (this is where you create your helper, i.e. bus_spec.rb), or just use touch to place them | |
cd .. | |
run --> rspec spec/ | |
run --> bundle init | |
add gem 'rspec' | |
add gem 'guard-rspec' | |
run --> bundle install | |
run --> guard init rspec | |
run --> guard | |
#context is for setting up initial conditions | |
#one use case of descibe is for describing various methods that the class has | |
after context or describe, see below. This is very powerful so keep reading. | |
before(:each) do | |
@user = User.new(params) | |
end | |
OR BETTER (more specific) | |
let(:user) do | |
User.new(params) | |
end | |
it "provides gender blah blah blah" do | |
expect(user.gender).to eq(m) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment