Skip to content
Tim edited this page Jul 13, 2015 · 29 revisions

##Steps Sinatra Base with Cucumber

To do/ fix - addition of layout file -where?

  1. mkdir <projectname> - Create Project Directory
  2. create_awesome_readme Create awesome readme
  • whats the gem?
  1. Bundle init - Create Gemfile
  1. Bundle Install - Install Gems
  2. Rspec - rspec --init - Initialise Rspec
  3. Rspec - Update the .rspec file
  1. git init - initialise Git
  2. Set up Cucumber, Rspec or both
  • $ cucumber-sinatra init --app <projectName> app/server.rb
  • $ rspec-sinatra init --app <projectName> lib/server.rb
  1. Create Database
  • Use cmd: $ psql
  • create database "_test & _development";
  1. touch app/data_mapper_setup.rb Create datamapper helper file
  1. mkdir app/views
  • This is where we will put our .erb files
  1. 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?
  1. mkdir app/public/css
  • this is where we can put the css
  1. touch Rakefile
  1. Amend Server.rb file - add to the top:
  1. touch app/models/<modelname>.rb - Create Model/Class file(s)
  1. Spec - Create helper file for Rspec tests.
  • mkdir spec/features
  • mkdir spec/features/helpers
  • touch spec/features/helpers/helper.rb
  • Example File
  1. Add to spec_helper.rb - to the top of file.
  1. touch spec/features/<modelName>_spec.rb - Create a user test in Rspec
  • describe > context > it
  1. touch spec/features/<featureName>_spec.rb - Create a Rspec feature test
  1. touch features/<featureName>.feature (alternative to Rspec is Cucumber) - create a Cucumber Feature test
  • Example file
  • Feature > Scenario > Given - When - Then (- And)
  1. touch features/<featureName>_steps.rb - in addition to web steps these are the capybara statements that your cucumber tests actually run.
  1. $ cucumber - to test with Cucumber
  2. $ spec - to test with rspec
  3. $ rackup - to play

Clone this wiki locally