<commit_before>= Pickle

Pickle gives you cucumber steps that create your models easily from factory-girl or
machinist factories/blueprints.  You can also just use ActiveRecord but it's not as cool.

References to the models are stored, not necessarily for the purpose of checking the db
(although you could use it for that), but for enabling easy reference to urls, and for
building complex givens which require a bunch of models collaborating

== Install

Install pickle either as a rails plugin, or a gem

  # plugin
  script/plugin install git://github.com/ianwhite/pickle.git
  
  # or, plugin as submodule
  git submodule add git://github.com/ianwhite/pickle.git vendor/plugins/pickle

  # or, gem
  sudo gem install ianwhite-pickle
  
== Get Started

(you'd better install cucumber)

  script/generate pickle

Now have a look at <tt>features/step_definitions/pickle_steps.rb</tt>

=== Using with plain ole Active Record

If you have an AR called 'Post', with required fields 'title', and 'body', then you can now write 
steps like this

  Given a post exists with title: "My Post", body: "My body"

=== Using with factory-girl or machinist

But you're using Machinist or FactoryGirl right?!  To leverage all of the factories/blueprints
you've written, you can just do stuff like

  Given a user exists
  And another user exists with role: "admin"

  # later
  Then a user should exist with name: "Fred"
  And that user should be activated # this uses rspec predicate matchers

==== Machinst: require your blueprints and rest Shams

In your <tt>features/support/env.rb</tt> add the following lines at the bottom

  require "#{Rails.root}/spec/blueprints" # or wherever they live
  Before { Sham.rest } # reset Shams in between scenarios

=== Configuring Pickle

You can tell pickle to use another factory adapter (see Pickle::Adapter), or
create mappings from english expressions to pickle model names.  You can also
override many of the options on the Pickle::Config object if you so choose 

  require 'pickle'

  Pickle.configure do |config|
    config.adapters = [:machinist, YourOwnAdapterClass]
    config.map 'me', 'myself', 'my', 'I', :to => 'user: "me"'
  end<commit_msg>Removing muscle-memory mistakes<commit_after>= Pickle

Pickle gives you cucumber steps that create your models easily from factory-girl or
machinist factories/blueprints.  You can also just use ActiveRecord but it's not as cool.

References to the models are stored, not necessarily for the purpose of checking the db
(although you could use it for that), but for enabling easy reference to urls, and for
building complex givens which require a bunch of models collaborating

== Install

Install pickle either as a rails plugin, or a gem

  # plugin
  script/plugin install git://github.com/ianwhite/pickle.git
  
  # or, plugin as submodule
  git submodule add git://github.com/ianwhite/pickle.git vendor/plugins/pickle

  # or, gem
  sudo gem install ianwhite-pickle
  
== Get Started

(you'd better install cucumber)

  script/generate pickle

Now have a look at <tt>features/step_definitions/pickle_steps.rb</tt>

=== Using with plain ole Active Record

If you have an AR called 'Post', with required fields 'title', and 'body', then you can now write 
steps like this

  Given a post exists with title: "My Post", body: "My body"

=== Using with factory-girl or machinist

But you're using Machinist or FactoryGirl right?!  To leverage all of the factories/blueprints
you've written, you can just do stuff like

  Given a user exists
  And another user exists with role: "admin"

  # later
  Then a user should exist with name: "Fred"
  And that user should be activated # this uses rspec predicate matchers

==== Machinst: require your blueprints and reset Shams

In your <tt>features/support/env.rb</tt> add the following lines at the bottom

  require "#{Rails.root}/spec/blueprints" # or wherever they live
  Before { Sham.reset } # reset Shams in between scenarios

=== Configuring Pickle

You can tell pickle to use another factory adapter (see Pickle::Adapter), or
create mappings from english expressions to pickle model names.  You can also
override many of the options on the Pickle::Config object if you so choose 

  require 'pickle'

  Pickle.configure do |config|
    config.adapters = [:machinist, YourOwnAdapterClass]
    config.map 'me', 'myself', 'my', 'I', :to => 'user: "me"'
  end
{'fraction_non_alphanumeric': 0.07308743169398907, 'fraction_numerical': 0.0, 'mean_word_length': 4.12004662004662, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '284545', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1217, 'n_words': 589}