Gamefic

Adventure Games and Interactive Fiction

Unit Tests

Gamefic projects include unit tests for RSpec and RSpec::Opal. To run the tests:

$ rspec     # Run the tests in RSpec with Ruby
$ rake opal # Run the tests in RSpec::Opal with Node

The RSpec::Opal version is useful for catching bugs that occur in Opal but not in standard Ruby.

Modifying the Gameplay Test

The test in spec/gameplay_spec.rb performs a walkthrough of the game to
confirm that it can be played to a conclusion. In a new project, the test
will fail because a complete walkthrough hasn’t been defined yet. You can
customize the walkthrough by modifying the test group’s commands array:

let(:commands) do
  # Customize this array of commands to reach a conclusion
  [
    'go north',
    'take the lamp',
    'take the matches',
    'light the lamp',
    'go down',
    'take the treasure'
  ]
end