-
Notifications
You must be signed in to change notification settings - Fork 0
Sinatra
Tim edited this page Jul 13, 2015
·
29 revisions
##Steps Sinatra Base with Cucumber
To do/ fix - addition of layout file -where?
-
mkdir <projectname>- Create Project Directory -
create_awesome_readmeCreate awesome readme
- whats the gem?
-
Bundle init- Create Gemfile
- Contents of Gemfile - example file to copy
-
Bundle Install- Install Gems - Rspec -
rspec --init- Initialise Rspec - Rspec - Update the
.rspecfile
- Contents of .rpsec - example file to copy
-
git init- initialise Git - Set up Cucumber, Rspec or both
$ cucumber-sinatra init --app <projectName> app/server.rb$ rspec-sinatra init --app <projectName> lib/server.rb
- Create Database
- Use cmd:
$ psql - create database "_test & _development";
-
touch app/data_mapper_setup.rbCreate datamapper helper file
- Example file - to copy
mkdir app/views
- This is where we will put our .erb files
mkdir app/models
- this is where we will put our classes/models
-
<link rel="stylesheet" href="css/styles.css">- check style sheet in public will link from here?
mkdir app/public/css
- this is where we can put the css
touch Rakefile
- Contents of Rakefile - Example file to copy
- Amend Server.rb file - add to the top:
-
touch app/models/<modelname>.rb- Create Model/Class file(s)
- Spec - Create helper file for Rspec tests.
mkdir spec/featuresmkdir spec/features/helperstouch spec/features/helpers/helper.rb- Example File
- Add to spec_helper.rb - to the top of file.
-
touch spec/features/<modelName>_spec.rb- Create a user test in Rspec
- describe > context > it
-
touch spec/features/<featureName>_spec.rb- Create a Rspec feature test
-
touch features/<featureName>.feature(alternative to Rspec is Cucumber) - create a Cucumber Feature test
- Example file
- Feature > Scenario > Given - When - Then (- And)
-
touch features/<featureName>_steps.rb- in addition to web steps these are the capybara statements that your cucumber tests actually run.
-
$ cucumber- to test with Cucumber -
$ spec- to test with rspec -
$ rackup- to play