Hyperstack
  • Welcome
  • Rails Installation and Configuration
    • Prerequisites
    • Using the Hyperstack Installer
    • Using the Generators
    • File Structure
    • Routing and Mounting Components
    • Other Rails Configuration Details
    • Why Rails? Other Frameworks?
  • HyperComponent
    • Component Classes
    • HTML Tags & CSS Classes
    • Component Children, Keys and Fragments
    • Component Params
    • Lifecycle Methods
    • Component State
    • Events and Callbacks
    • Interlude: Tic Tac Toe
    • Recovering from Errors
    • JavaScript Components
    • Elements and Rendering
    • Summary of Methods
    • List of Predefined Tags & Components
    • Predefined Events
    • Notes
    • Further Reading
  • HyperState
  • HyperRouter
  • HyperModel
  • Operations
  • Policies
  • Internationalization
  • Development Tools, Workflow and Procedures
    • Debugging
    • HyperTrace
    • HyperSpec
      • Installation
      • Tutorial
      • Methods and Features
      • Using with Rack
    • Deploy To Heroku
  • Tutorial
    • TodoMVC Tutorial Part I
    • TodoMVC Tutorial Part II
  • Community
Powered by GitBook
On this page

Was this helpful?

  1. Development Tools, Workflow and Procedures
  2. HyperSpec

Installation

Add gem 'hyper-spec' to your Gemfile in the usual way. Typically in a Rails app you will add this in the test section of your Gemfile:

group :test do
  gem 'hyper-spec', '~> 1.0.alpha1.0'
end

Make sure to bundle install.

HyperSpec is integrated with the pry gem for debugging, so it is recommended to add the pry gem as well.

HyperSpec will also use the timecop gem if present to allow you to control and synchronize time on the server and the client.

A typical spec_helper file when using HyperSpec will look like this:

# spec_helper.rb
require 'hyper-spec'
require 'pry'  # optional

ENV["RAILS_ENV"] ||= 'test'
require File.expand_path('../test_app/config/environment', __FILE__)

require 'rspec/rails'
require 'timecop' # optional

# any other rspec configuration you need
# note HyperSpec will include chrome driver for providing the client
# run time environment

To load the webdriver and client environment your spec should have the :js flag set:

# the js flag can be set on the entire group of specs, or a context
describe 'some hyper-specs', :js do
  ...
end

# or for an individual spec
  it 'an individual hyper-spec', :js do
    ...
  end
PreviousHyperSpecNextTutorial

Last updated 4 years ago

Was this helpful?