<commit_before>h1. Scenes

Scenes is a Rails plugin to set up system scenes, mainly for use with "Cucumber":https://github.com/aslakhellesoy/cucumber/tree, but can also be used to set your system into a preset state. Initially this was developed to allow us to set up complex scenarios for our Cucumber stories.

h2. Usage

h3. Characters

Characters are used to represent objects in the database. 

h4. Setup

Any method of initially creating an object can be used, as long as the created object is returned.

<pre>
<code>
  Scenes::Character.named("Alice) {
    User.create(:name => 'Alice', :age => 21)
  }
</code>
</pre>


Referencing a character is done as follows

<pre>
<code>
  Scenes::Character['Alice']
</code>
</pre>

The first time a character is referenced, it is created in the database, all times after that the object is retreived from the database.

h4. Changing default values

You can load in a character and change the default values by passing a block to the .with method

<pre>
<code>
  Scenes::Character['Alice'].with do |alice|
    alice.age = 25
  end
</code>
</pre>


h3. Scenes

Scenes are

h4. Setup

<pre>
<code>
  Scenes::Scene.named("Alice and Bob") {
    Scenes::Character['Alice']
    Scenes::Character['Bob']
  }
</code>
</pre>

h2. Rake task

h2. Usage with Cucumber

Copyright (c) 2008 <NAME>, released under the MIT license<commit_msg>Documentation update<commit_after>h1. Scenes

Scenes is a Rails plugin to set up system scenes, mainly for use with "Cucumber":https://github.com/aslakhellesoy/cucumber/tree, but can also be used to set your system into a preset state. Initially this was developed to allow us to set up complex scenarios for our Cucumber stories.

h2. Usage

h3. Characters

Characters are used to represent objects in the database. 

h4. Setup

Any method of initially creating an object can be used, as long as the created object is returned.

<pre>
<code>
  Scenes::Character.named("Alice) {
    User.create(:name => 'Alice', :age => 21)
  }
</code>
</pre>


Referencing a character is done as follows

<pre>
<code>
  Scenes::Character['Alice']
</code>
</pre>

The first time a character is referenced, it is created in the database, all times after that the object is retreived from the database.

h4. Changing default values

You can load in a character and change the default values by passing a block to the .with method

<pre>
<code>
  Scenes::Character['Alice'].with do |alice|
    alice.age = 25
  end
</code>
</pre>


h3. Scenes

Scenes are used to set the system up in a specific state.

h4. Setup

<pre>
<code>
  Scenes::Scene.named("Alice and Bob") {
    Scenes::Character['Alice']
    Scenes::Character['Bob']
  }
</code>
</pre>

Scenes don't have to only contain characters, anything that can be played back can go in a scene.

h4. Playing

Scenes can be run using the play method.

<pre>
<code>
  Scenes::Scene['Alice and Bob'].play
</code>
</pre>

This will execute the scene, in this case adding Alice and Bob to the database.

h2. Rake tasks

There are two rake tasks available:

<pre>
<code>
  rake scenes
  rake scenes:save
</code>
</pre>

rake scenes will give you a list of the scenes you have set up, choose an entry to load the scene in your development environment - this will delete whatever you currently have in your dev environment.

rake scenes:save will save your current development environment as a scene for you to use. This is quite simplistic, and currently almost certainly won't work with any kind of database constraints you may have, but should work for most cases.

h2. Usage with Cucumber



Copyright (c) 2008 <NAME>, released under the MIT license
{'fraction_non_alphanumeric': 0.08714716360646753, 'fraction_numerical': 0.00959166895039737, 'mean_word_length': 3.8927613941018766, 'pattern_counts': {'":': 2, '<': 45, '<?xml version=': 0, '>': 49, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '566365', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1112, 'n_words': 526}