Skip to content

Commit

Permalink
Speculation and remove attribute from pickle ref
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwhite committed Aug 19, 2010
1 parent 3053c2f commit ec98899
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/pickle/ref.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Pickle
class Ref
attr_reader :factory_name, :index, :label, :attribute
attr_reader :factory_name, :index, :label

def initialize(string)
parse_ref(string)
Expand Down Expand Up @@ -58,4 +58,4 @@ def capture_label
/(?:\: )?\"([\w ]+)\"/
end
end
end
end
49 changes: 42 additions & 7 deletions spec/pickle/ref_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
its(:index) { should be_nil }
its(:factory_name) { should == 'colour' }
its(:label) { should be_nil }
its(:attribute) { should be_nil }
end

['a', 'an', 'the', 'that', 'another'].each do |prefix|
Expand All @@ -27,7 +26,6 @@
its(:index) { should == '1st' }
its(:factory_name) { should == 'colour' }
its(:label) { should be_nil }
its(:attribute) { should be_nil }

['2nd', 'first', 'last', '3rd', '4th'].each do |index|
describe ".new('#{index} colour')" do
Expand Down Expand Up @@ -55,7 +53,6 @@
its(:index) { should == nil }
its(:factory_name) { should == 'colour' }
its(:label) { should == 'red' }
its(:attribute) { should be_nil }

describe "perverse" do
it "'1st colour: \"red\"'"
Expand All @@ -68,9 +65,28 @@
end
end




# Given a website owner user "betty" exists
#
# # Given 3 users exists with site: "betty"'s site
# # ==
# # Given "betty"'s site has 3 users
#
# Given /^#{pickle_ref}'s (\w+) has (\d+) #{pickle_factory}$/ do |ref, assoc, amount, factory|
# association = retrieve_from_scenario(pickle_ref).send(assoc)
# amount.times do
# create_on_and_store(association, factory)
# # machinist
# betty.users.make
# # factory girl & AR
# betty.users.create(Factory.plan(:user))
# end
#
# User.make(:website_owner)
#
#
# And "betty"'s site has 3 users
# retrieve("betty").site.users.
#
# API suggestions
# c.alias "color", :as => "colour"
# c.label "colour", :using => "hue"
Expand Down Expand Up @@ -128,4 +144,23 @@
# make the object using the factory & attrs
#
# store the object using the label
#end
#end

#Transform /#{pickle_ref}/ |str| { Pickle::Ref.new(str) }
#
#Given /$#{pickle_ref} should be cool/ do |pickle_ref|
# pickle_ref
# retreive_model_from_scenario(pickle_ref)
# pickle_ref.factory

#Transform(/^#{pickle_ref}$/) {|str| Pickle::Ref.new(str) }
#
#Given(/^#{pickle_ref} exists(?: with #{pickle_fields})?$/) do |ref, fields|
# create_and_store(ref, fields)
#end
#
#Given(/^#{pickle_ref} should exist(?: with #{pickle_fields})$/) do |ref, fields|
# find(ref, fields).store
#end


0 comments on commit ec98899

Please sign in to comment.