diff --git a/lib/pickle/dsl.rb b/lib/pickle/dsl.rb index 0aaf620a..e6e4aa43 100644 --- a/lib/pickle/dsl.rb +++ b/lib/pickle/dsl.rb @@ -1,44 +1,15 @@ module Pickle # included into cucumber scenarios via World(Pickle::Scenario) # - # for more fine-grained access to the pickle session, see Pickle::Session::Api + # the pickle object is where all of the action is at, see Pickle::Session::Api module Dsl include MakeMatcher - # retrieve the model with the given pickle_ref from the pickle session, and re-find it from the database - # @raise Pickle::UnknownModelError - # @return Object the stored model - def model(pickle_ref) - pickle.retrieve_and_reload(pickle_ref) - end - - # does the model with given pickle_ref exist in the pickle session? - # @return falsy if pickle_ref not know, truthy otherwise - def model?(pickle_ref) - pickle.known?(pickle_ref) - end - - # make a model using the pickle_ref, and optional fields, and store it in the pickle session under its pickle_ref - # @return Object the newly made model - def make(pickle_ref, fields = nil) - pickle.make_and_store(pickle_ref, fields) - end - - # find a model using the given pickle_ref and optional fields, and store it in the pickle session under its pickle_ref - # @return Object the found object - def find(pickle_ref, fields = nil) - pickle.find_and_store(pickle_ref, fields) - end - - # find all models using the given plural factory name, and optional fields, and store them in the pickle session using the factory name - # @return Array array of found objects - def find_all(plural, fields = nil) - pickle.find_all_and_store(plural, fields) - end - # the pickle session, @see Pickle::Session::Api def pickle @pickle ||= Pickle::Session.new end + + delegate :model, :to => :pickle end end \ No newline at end of file diff --git a/lib/pickle/ref.rb b/lib/pickle/ref.rb index ea14aab8..eef82401 100644 --- a/lib/pickle/ref.rb +++ b/lib/pickle/ref.rb @@ -1,6 +1,3 @@ -require 'pickle/parser/matchers' -require 'pickle/parser/canonical' - module Pickle class InvalidPickleRefError < RuntimeError end diff --git a/lib/pickle/session.rb b/lib/pickle/session.rb index 4aa59bd4..c547e57b 100644 --- a/lib/pickle/session.rb +++ b/lib/pickle/session.rb @@ -12,7 +12,6 @@ def jar @jar ||= Pickle::Jar.new end - class Object include Pickle::Session end