Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

. Adding a README and a gem builder

  • Loading branch information...
commit cba3bff6c8bbbde9ea1bc03066b985acf5664d6a 1 parent ecba924
@kschiess authored
Showing with 119 additions and 3 deletions.
  1. +46 −0 README
  2. +73 −3 Rakefile
View
46 README
@@ -0,0 +1,46 @@
+
+FLOOR MANAGER - when your job is handling the girls
+
+The floor manager manages a whole graph of objects and lets you create them
+in memory or the database for the duration of a test.
+
+You need two posts that are linked up to the same author? [1] Easy:
+
+ FloorManager.define :first do
+ one :author do
+ name 'John Smith'
+ end
+
+ any :post do
+ title 'The posts title'
+ author.set :author
+ end
+ end
+
+And in your tests:
+
+ before(:each) do
+ FloorManager.reset
+
+ floor = FloorManager.get(:floor)
+ posts = [floor.create(:post), floor.create(:post)]
+ end
+
+This gives you two posts to test against. Both posts will have the same
+author, right down to the database id.
+
+COMPATIBILITY
+
+This has only been tested with rails 2. Both Ruby 1.8 and Ruby 1.9 should
+work.
+
+STATUS
+
+Useful in daily life.
+
+AUTHOR
+
+Kaspar Schiess (kaspar.schiess@absurd.li)
+
+[1] http://robots.thoughtbot.com/post/159807023/waiting-for-a-factory-girl
+
View
76 Rakefile
@@ -1,5 +1,75 @@
-task :default => :spec
-require 'spec'
-require 'spec/rake/spectask'
+
+require "rubygems"
+require "rake/gempackagetask"
+require "rake/rdoctask"
+
+require "spec"
+require "spec/rake/spectask"
Spec::Rake::SpecTask.new
+
+
+task :default => ["spec"]
+
+# This builds the actual gem. For details of what all these options
+# mean, and other ones you can add, check the documentation here:
+#
+# http://rubygems.org/read/chapter/20
+#
+spec = Gem::Specification.new do |s|
+
+ # Change these as appropriate
+ s.name = "floor_manager"
+ s.version = "0.1.0"
+ s.summary = "Allows creation of a whole graph of objects on the fly during testing"
+ s.author = "Kaspar Schiess"
+ s.email = "kaspar.schiess@absurd.li"
+ s.homepage = "http://github.com/kschiess/floor_manager"
+
+ s.has_rdoc = true
+ s.extra_rdoc_files = %w(README)
+ s.rdoc_options = %w(--main README)
+
+ # Add any extra files to include in the gem
+ s.files = %w(LICENSE Rakefile README) + Dir.glob("{spec,lib/**/*}")
+ s.require_paths = ["lib"]
+
+ # If you want to depend on other gems, add them here, along with any
+ # relevant versions
+ s.add_dependency("activesupport", "~> 2.3.5")
+
+ # If your tests use any gems, include them here
+ s.add_development_dependency("rspec")
+ s.add_development_dependency("flexmock")
+end
+
+# This task actually builds the gem. We also regenerate a static
+# .gemspec file, which is useful if something (i.e. GitHub) will
+# be automatically building a gem for this project. If you're not
+# using GitHub, edit as appropriate.
+#
+# To publish your gem online, install the 'gemcutter' gem; Read more
+# about that here: http://gemcutter.org/pages/gem_docs
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.gem_spec = spec
+end
+
+desc "Build the gemspec file #{spec.name}.gemspec"
+task :gemspec do
+ file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
+ File.open(file, "w") {|f| f << spec.to_ruby }
+end
+
+task :package => :gemspec
+
+# Generate documentation
+Rake::RDocTask.new do |rd|
+ rd.main = "README"
+ rd.rdoc_files.include("README", "lib/**/*.rb")
+ rd.rdoc_dir = "rdoc"
+end
+
+desc 'Clear out RDoc and generated packages'
+task :clean => [:clobber_rdoc, :clobber_package] do
+ rm "#{spec.name}.gemspec"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.