Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 3586 Bytes
1 | = Dataset |
2 | |
3 | Dataset provides a simple API for creating and finding sets of data in your database. Check out Dataset::RecordMethods and Dataset::ModelFinders. |
4 | |
5 | Dataset loads data intelligently if you use 'nested contexts' in your tests (RSpec, anything that uses Test::Unit::TestCase subclassing for creating nested contexts): |
6 | |
7 | describe Something do |
8 | dataset :a => Dataset :a is loaded (at the right time) |
9 | |
10 | it 'should whatever' |
11 | end |
12 | |
13 | describe More do |
14 | dataset :b => Dataset :b is loaded. :a data is still there |
15 | |
16 | it 'should' |
17 | end |
18 | end |
19 | |
20 | describe Another do => Database is restored to :a, without re-running :a logic |
21 | it 'should' |
22 | end |
23 | end |
24 | end |
25 | |
26 | The goal is to see a marked improvement in overall test run speed, basing this on the assumption that it is faster to have the OS copy a file or mySQL dump and load. Of course, we may find this to be a false assumption, but there were plenty of bugs in the former 'Scenarios' - addressing that afforded the opportunity to test the assumption. |
27 | |
28 | |
29 | Dataset does not prevent you from using other libraries like Machinist or factory_girl. If you were to used either of those, you could have a dataset like this: |
30 | |
31 | require 'faker' |
32 | |
33 | class OrganizationsDataset < Dataset::Base |
34 | Sham.name { Faker::Name.name } |
35 | |
36 | Organization.blueprint do |
37 | name { Sham.name } |
38 | end |
39 | |
40 | def load |
41 | name_model Organization.make, :org_one |
42 | end |
43 | end |
44 | |
45 | The benefit is that you can reuse interesting sets of data, without sacrificing the utility of those other libraries. |
46 | |
47 | describe Organization, 'stuff' do |
48 | dataset :organizations |
49 | end |
50 | |
51 | describe Organization, 'other stuff' do |
52 | dataset :organizations |
53 | end |
54 | |
55 | |
56 | Get things installed, then read more in the Dataset documentation at http://aiwilliams.github.com/dataset |
57 | |
58 | |
59 | == Installation |
60 | |
61 | Install the plugin: |
62 | |
63 | ./script/plugin install git://github.com/aiwilliams/dataset.git |
64 | |
65 | In your test_helper.rb/spec_helper.rb: |
66 | |
67 | require 'dataset' |
68 | class Test::Unit::TestCase |
69 | include Dataset |
70 | datasets_directory "#{RAILS_ROOT}/spec/datasets" |
71 | end |
72 | |
73 | If you don't use rspec_on_rails, or you have specs that aren't of the RailsExampleGroup type, you should do this in spec_helper.rb: |
74 | |
75 | require 'dataset' |
76 | class Spec::Example::ExampleGroup |
77 | include Dataset |
78 | datasets_directory "#{RAILS_ROOT}/spec/datasets" |
79 | end |
80 | |
81 | If you were a user of the Scenarios plugin, and want to do as little as possible to get going (assumes you are using rspec_on_rails): |
82 | |
83 | require 'dataset' |
84 | Scenario = Scenarios = Dataset |
85 | class Test::Unit::TestCase |
86 | include Dataset |
87 | class << self |
88 | alias_method :scenario, :dataset |
89 | end |
90 | end |
91 | class ScenariosResolver < Dataset::DirectoryResolver |
92 | def suffix |
93 | @suffix ||= 'Scenario' |
94 | end |
95 | end |
96 | Dataset::Resolver.default = ScenariosResolver.new("#{RAILS_ROOT}/spec/scenarios") |
97 | |
98 | |
99 | == Credits |
100 | |
101 | Written by [Adam Williams](http://github.com/aiwilliams). |
102 | |
103 | Contributors: |
104 | |
105 | - [Saturn Flyer](http://www.saturnflyer.com) [github](http://github.com/saturnflyer) |
106 | - [Steve Iannopollo](http://github.com/siannopollo) |
107 | - [John Long](http://github.com/jlong) |
108 | |
109 | --- |
110 | |
111 | Dataset is released under the MIT-License and is Copyright (c)2008 Adam Williams. |