selections 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +31 -0
  4. data/app/assets/javascripts/selections/application.js +9 -0
  5. data/app/assets/javascripts/selections/selections.js +2 -0
  6. data/app/assets/stylesheets/scaffold.css +56 -0
  7. data/app/assets/stylesheets/selections/application.css +7 -0
  8. data/app/assets/stylesheets/selections/selections.css +4 -0
  9. data/app/controllers/selections/application_controller.rb +4 -0
  10. data/app/controllers/selections/selections_controller.rb +45 -0
  11. data/app/helpers/selections/application_helper.rb +4 -0
  12. data/app/helpers/selections/selectors_helper.rb +4 -0
  13. data/app/models/selections/selection.rb +83 -0
  14. data/app/views/layouts/selections/application.html.erb +1 -0
  15. data/app/views/selections/selections/_form.html.erb +41 -0
  16. data/app/views/selections/selections/edit.html.erb +6 -0
  17. data/app/views/selections/selections/index.html.erb +33 -0
  18. data/app/views/selections/selections/new.html.erb +5 -0
  19. data/app/views/selections/selections/show.html.erb +35 -0
  20. data/config/initializers/selections.rb +1 -0
  21. data/config/routes.rb +5 -0
  22. data/db/migrate/20120114024459_create_selections_selections.rb +15 -0
  23. data/lib/selections.rb +7 -0
  24. data/lib/selections/engine.rb +5 -0
  25. data/lib/selections/selection_select.rb +24 -0
  26. data/lib/selections/version.rb +3 -0
  27. data/lib/tasks/selections_tasks.rake +4 -0
  28. data/spec/controllers/companies_controller_spec.rb +10 -0
  29. data/spec/controllers/selections/selections_controller_spec.rb +165 -0
  30. data/spec/dummy/Rakefile +7 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  32. data/spec/dummy/app/assets/javascripts/companies.js +2 -0
  33. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  34. data/spec/dummy/app/assets/stylesheets/companies.css +4 -0
  35. data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
  36. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  37. data/spec/dummy/app/controllers/companies_controller.rb +83 -0
  38. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  39. data/spec/dummy/app/helpers/companies_helper.rb +2 -0
  40. data/spec/dummy/app/models/company.rb +7 -0
  41. data/spec/dummy/app/views/companies/_form.html.erb +3 -0
  42. data/spec/dummy/app/views/companies/edit.html.erb +4 -0
  43. data/spec/dummy/app/views/companies/index.html.erb +27 -0
  44. data/spec/dummy/app/views/companies/new.html.erb +5 -0
  45. data/spec/dummy/app/views/companies/show.html.erb +20 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +11 -0
  47. data/spec/dummy/config.ru +4 -0
  48. data/spec/dummy/config/application.rb +45 -0
  49. data/spec/dummy/config/boot.rb +10 -0
  50. data/spec/dummy/config/database.yml +25 -0
  51. data/spec/dummy/config/environment.rb +5 -0
  52. data/spec/dummy/config/environments/development.rb +30 -0
  53. data/spec/dummy/config/environments/production.rb +60 -0
  54. data/spec/dummy/config/environments/test.rb +42 -0
  55. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/dummy/config/initializers/inflections.rb +10 -0
  57. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  58. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  59. data/spec/dummy/config/initializers/session_store.rb +8 -0
  60. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/spec/dummy/config/locales/en.yml +5 -0
  62. data/spec/dummy/config/routes.rb +6 -0
  63. data/spec/dummy/db/development.sqlite3 +0 -0
  64. data/spec/dummy/db/migrate/20120114125226_create_selections_selections.rb +15 -0
  65. data/spec/dummy/db/migrate/20120115055119_create_companies.rb +12 -0
  66. data/spec/dummy/db/schema.rb +38 -0
  67. data/spec/dummy/db/test.sqlite3 +0 -0
  68. data/spec/dummy/log/development.log +94 -0
  69. data/spec/dummy/log/test.log +26360 -0
  70. data/spec/dummy/public/404.html +26 -0
  71. data/spec/dummy/public/422.html +26 -0
  72. data/spec/dummy/public/500.html +26 -0
  73. data/spec/dummy/public/favicon.ico +0 -0
  74. data/spec/dummy/script/rails +6 -0
  75. data/spec/helpers/selections/selections_helper_spec.rb +15 -0
  76. data/spec/models/company_spec.rb +7 -0
  77. data/spec/models/selections/selection_spec.rb +219 -0
  78. data/spec/routing/selections/selections_routing_spec.rb +35 -0
  79. data/spec/spec_helper.rb +30 -0
  80. data/spec/support/controller_route_fix.rb +33 -0
  81. data/spec/support/factories/company_factory.rb +5 -0
  82. data/spec/support/factories/selection_factory.rb +5 -0
  83. data/spec/views/companies/edit.html.erb_spec.rb +76 -0
  84. data/spec/views/companies/new.html.erb_spec.rb +78 -0
  85. data/spec/views/selections/selections/edit.html.erb_spec.rb +28 -0
  86. data/spec/views/selections/selections/index.html.erb_spec.rb +40 -0
  87. data/spec/views/selections/selections/new.html.erb_spec.rb +28 -0
  88. data/spec/views/selections/selections/show.html.erb_spec.rb +30 -0
  89. metadata +260 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,15 @@
1
+ #require 'spec_helper'
2
+ #
3
+ ## Specs in this file have access to a helper object that includes
4
+ ## the SelectionsHelper. For example:
5
+ ##
6
+ ## describe SelectionsHelper do
7
+ ## describe "string concat" do
8
+ ## it "concats two strings with spaces" do
9
+ ## helper.concat_strings("this","that").should == "this that"
10
+ ## end
11
+ ## end
12
+ ## end
13
+ #describe SelectionsHelper do
14
+ # pending "add some examples to (or delete) #{__FILE__}"
15
+ #end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Company do
4
+ it "should be valid" do
5
+ Factory(:company).should be_valid
6
+ end
7
+ end
@@ -0,0 +1,219 @@
1
+ require 'spec_helper'
2
+
3
+ module Selections
4
+ describe Selection do
5
+ it("should be valid") { Factory(:selection).should be_valid }
6
+
7
+ it("should require valid name") { Factory.build(:selection, :name => "").should_not be_valid }
8
+
9
+ context "duplicates" do
10
+ let(:parent_1) { Factory(:selection) }
11
+ let(:parent_2) { Factory(:selection) }
12
+ before { Factory(:selection, :name => "duplicate", :parent_id => parent_1.id) }
13
+
14
+ it "should allow duplicates under different parents" do
15
+ Factory.build(:selection, :name => "duplicate", :parent_id => parent_2.id).should be_valid
16
+ end
17
+ it "should not allow duplicates same parents" do
18
+ Factory.build(:selection, :name => "duplicate", :parent_id => parent_1.id).should_not be_valid
19
+ end
20
+ end
21
+ describe ".system_code" do
22
+ context "autogenerating" do
23
+ context "create" do
24
+ context "parent" do
25
+ it("should not generate system_code when one set") do
26
+ Factory(:selection, :name => "Priorities", :system_code => "something_else").system_code.should == "something_else"
27
+ end
28
+ it("generate singular system_code") { Factory(:selection, :name => "Priorities").system_code.should == "priority" }
29
+ it("generate system_code when name has spaces") { Factory(:selection, :name => "telephone prefixes").system_code.should == "telephone_prefix" }
30
+ it("generate system_code when camelcased") { Factory(:selection, :name => "TelephonePrefixes").system_code.should == "telephone_prefix" }
31
+
32
+ end
33
+ context "children" do
34
+ it "should contain auto parent and child code" do
35
+ parent = Factory(:selection)
36
+ child_1 = Factory(:selection, :parent => parent)
37
+ child_1.system_code.should == "#{parent.name}_#{child_1.name}"
38
+ end
39
+ it "should be child system_code when defined" do
40
+ parent = Factory(:selection, :system_code => "hello")
41
+ child_1 = Factory(:selection, :parent => parent, :system_code => "world")
42
+ child_1.system_code.should == "world"
43
+ end
44
+ it "should contain parent and child code when defined" do
45
+ parent = Factory(:selection, :system_code => "hello")
46
+ child_1 = Factory(:selection, :parent => parent, :name => "world")
47
+ child_1.system_code.should == "hello_world"
48
+ end
49
+ end
50
+ end
51
+ context "update" do
52
+ before { @parent = Factory(:selection) }
53
+ it "should not autogenerate system_code" do
54
+ @parent.update_attribute(:system_code, nil)
55
+ @parent.update_attributes(:name => "hello")
56
+ @parent.system_code.should be_nil
57
+ end
58
+ it "should not allow update of system_code" do
59
+ @parent.system_code = "different"
60
+ @parent.should have(1).error_on(:system_code)
61
+ @parent.errors[:system_code].should include("cannot be changed")
62
+ end
63
+ end
64
+ end
65
+ context "uniqueness of system codes" do
66
+ before { @selection_1 = Factory(:selection) }
67
+ it("should not allow same system_codes") { FactoryGirl.build(:selection, :system_code => @selection_1.system_code).should_not be_valid }
68
+ it("should allow same system_codes if one archived") do
69
+ @selection_1.update_attributes(:archived => true)
70
+ FactoryGirl.build(:selection, :system_code => @selection_1.system_code).should be_valid
71
+ end
72
+ end
73
+ context "valid system_code characters" do
74
+ it("should not allow !") { FactoryGirl.build(:selection, :system_code => "hello!world").should_not be_valid }
75
+ it("should not allow $") { FactoryGirl.build(:selection, :system_code => "hello$world").should_not be_valid }
76
+ it("should not allow starting with _") { FactoryGirl.build(:selection, :system_code => "_hello").should_not be_valid }
77
+ it("should allow containing _") { FactoryGirl.build(:selection, :system_code => "hello_world").should be_valid }
78
+ it "should not have spaces" do
79
+ FactoryGirl.build(:selection, :system_code => "hello world").should_not be_valid
80
+ end
81
+ end
82
+ end
83
+
84
+ context "common data" do
85
+ before do
86
+ @parent_1 = Factory(:selection)
87
+ @child_1 = Factory(:selection, :parent => @parent_1)
88
+ @child_2 = Factory(:selection, :parent => @parent_1, :is_default => true)
89
+ @child_3 = Factory(:selection, :parent => @parent_1)
90
+ @child_4 = Factory(:selection, :parent => @parent_1)
91
+ end
92
+
93
+
94
+ describe ".to_s" do
95
+ it "should return name when only relationship is defined" do
96
+ company = Factory(:company, :state_id => @child_4.id)
97
+ company.state.to_s.should == @child_4.name
98
+ end
99
+ end
100
+
101
+ describe ".position" do
102
+ it("should save positive position") { Factory(:selection, :position => 10).position.should == 10 }
103
+ it("should save negative position") { Factory(:selection, :position => -20).position.should == -20 }
104
+ it("should save 0 position") { Factory(:selection, :position => 0).position.should == 0 }
105
+ it("should save string as 0 position") { Factory(:selection, :position => "hello").position.should == 0 }
106
+ it("should return hidden_position as empty string") { Factory(:selection, :position => Selections::Selection::HIDDEN_POSITION).position.should be_nil }
107
+ it("should save nil and return nil") { Factory(:selection, :position => nil).position.should be_nil }
108
+ it("should save nil as hidden_position value") { Factory(:selection, :position => nil).position_value.should == Selections::Selection::HIDDEN_POSITION }
109
+ end
110
+
111
+ describe "default_order" do
112
+ it "should return alpha order" do
113
+ @child_3.update_attribute(:name, "abc")
114
+ @parent_1.reload.children.should == [@child_3, @child_1, @child_2, @child_4]
115
+ end
116
+ it "should return alpha and numbers first if set" do
117
+ @child_3.update_attributes!(:position => 10)
118
+ @child_2.update_attributes!(:position => 20)
119
+ @parent_1.reload.children.should == [@child_3, @child_2, @child_1, @child_4]
120
+ end
121
+ end
122
+ describe ".filter_archived_except_selected" do
123
+ it("should return all children") { @parent_1.children.filter_archived_except_selected(@child_3).should =~ @parent_1.children }
124
+ context "one archived" do
125
+ before { @child_3.update_attribute(:archived, true) }
126
+ it("should return all children except archived") { @parent_1.children.filter_archived_except_selected(@child_1).should =~ @parent_1.children - [@child_3] }
127
+ it("should return all children including archived if its selected") { @parent_1.children.filter_archived_except_selected(@child_3).should =~ @parent_1.children }
128
+ it "should return all children including archived if its selected except other archived" do
129
+ @child_1.update_attribute(:archived, true)
130
+ @parent_1.children.filter_archived_except_selected(@child_3).should =~ @parent_1.children - [@child_1]
131
+ end
132
+ end
133
+ end
134
+ describe ".siblings_with_default_set" do
135
+ it("should return item set to default") { @child_1.siblings_with_default_set.should == @child_2 }
136
+ it("should not return itself") { @child_2.siblings_with_default_set.should be_nil }
137
+ it "should return nothing if no default" do
138
+ @child_2.update_attribute(:is_default, false)
139
+ @child_1.siblings_with_default_set.should be_nil
140
+ end
141
+ end
142
+
143
+ describe ".is_default" do
144
+ context "setting default" do
145
+ before { @child_1.update_attributes!(:is_default=>true) }
146
+
147
+ it("should set default") { @child_1.is_default.should be_true }
148
+ it("should remove default if any set within scope") do
149
+ @child_1.update_attributes!(:is_default=>true)
150
+ @child_2.reload.is_default.should be_false
151
+ end
152
+ end
153
+ it "default should be set when adding new item with default on" do
154
+ Factory(:selection, :parent => @parent_1, :is_default => true).is_default.should be_true
155
+ end
156
+ it "when adding new item with default set, should remove other default" do
157
+ Factory(:selection, :parent => @parent_1, :is_default => true)
158
+ @child_2.reload.is_default.should be_false
159
+ end
160
+ it "should not remove default item in another scope" do
161
+ other_parent = Factory(:selection)
162
+ Factory(:selection, :parent => other_parent)
163
+ other_child_2 = Factory(:selection, :parent => other_parent, :is_default => true)
164
+ @child_1.update_attributes!(:is_default => true)
165
+ other_child_2.is_default.should be_true
166
+ end
167
+
168
+ it "should unset default and not set any other within scope" do
169
+ @child_2.update_attributes!(:is_default => false)
170
+ @parent_1.children.each do |child|
171
+ child.is_default.should be_false
172
+ end
173
+ end
174
+ end
175
+ end
176
+
177
+ describe ".archived" do
178
+ it("should not be archived") { Factory(:selection).archived.should be_false }
179
+ it("should be archived") { Factory(:selection, :archived => true).archived.should be_true }
180
+ it "should not change archived_at" do
181
+ original_time = Time.now - 2.days
182
+ selection = Factory(:selection, :archived_at => original_time)
183
+ selection.update_attributes(:archived => true)
184
+ selection.archived_at.should == original_time
185
+ end
186
+ it "should unset default if archived" do
187
+ default_selections
188
+ @child_2.update_attributes(:archived => true)
189
+ @child_2.reload.is_default.should be_false
190
+ end
191
+ end
192
+
193
+ context "system_code finds" do
194
+ describe "#method_missing" do
195
+ before do
196
+ @parent_1 = Factory(:selection, :system_code => "parent_1")
197
+ @parent_2 = Factory(:selection, :system_code => "parent_2")
198
+ @parent_3 = Factory(:selection, :system_code => "parent_3")
199
+ end
200
+
201
+ it("should return a item with system_code of parent_1") { Selection.parent_1.should == @parent_1 }
202
+ it("should return a item with system_code of parent_2") { Selections::Selection.parent_2.should == @parent_2 }
203
+ it("should cause an exception if does not exist") { lambda { Selections::Selection.parent_10 }.should raise_exception }
204
+ it("should still do normal method missing finds") { Selections::Selection.find_by_system_code(@parent_1.system_code).should == @parent_1 }
205
+ it("should still support inbuilt methods") { Selections::Selection.where(:system_code => @parent_1.system_code).first.should == @parent_1 }
206
+
207
+ context "pluralized returns children" do
208
+ before { @parent_1.children << [Factory(:selection), Factory(:selection)] }
209
+
210
+ it("should return children") { Selections::Selection.parent_1s.should == @parent_1.children }
211
+ it "'es' pluralization should return children" do
212
+ @parent_1.update_attribute(:system_code, "status")
213
+ Selections::Selection.statuses.should == @parent_1.children
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
219
+ end
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+
3
+ describe Selections::SelectionsController do
4
+ describe "routing" do
5
+
6
+ it "routes to #index" do
7
+ get("/selections").should route_to("selections#index")
8
+ end
9
+
10
+ it "routes to #new" do
11
+ get("/selections/new").should route_to("selections#new")
12
+ end
13
+
14
+ it "routes to #show" do
15
+ get("/selections/1").should route_to("selections#show", :id => "1")
16
+ end
17
+
18
+ it "routes to #edit" do
19
+ get("/selections/1/edit").should route_to("selections#edit", :id => "1")
20
+ end
21
+
22
+ it "routes to #create" do
23
+ post("/selections").should route_to("selections#create")
24
+ end
25
+
26
+ it "routes to #update" do
27
+ put("/selections/1").should route_to("selections#update", :id => "1")
28
+ end
29
+
30
+ it "routes to #destroy" do
31
+ delete("/selections/1").should route_to("selections#destroy", :id => "1")
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,30 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rspec/rails"
6
+ require "factory_girl"
7
+
8
+ # Load support files
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
10
+
11
+ RSpec.configure do |config|
12
+ config.use_transactional_fixtures = true
13
+ end
14
+
15
+ def default_selections
16
+ @parent_1 = Factory(:selection, :system_code => "state")
17
+ @child_1 = Factory(:selection, :parent => @parent_1)
18
+ @child_2 = Factory(:selection, :parent => @parent_1, :is_default => true)
19
+ @child_3 = Factory(:selection, :parent => @parent_1)
20
+ @child_4 = Factory(:selection, :parent => @parent_1)
21
+ end
22
+
23
+ def selected_options options, selection, has_blank_item
24
+ options.each do |child|
25
+ selected = (selection && selection.id == child.id) ? "[selected='selected']" : ""
26
+ assert_select "option[value='#{child.id}']#{selected}"
27
+ end
28
+ assert_select "option[selected='selected']", 0 unless selection
29
+ assert_select "option[value='']", (has_blank_item ? 1 : 0)
30
+ end
@@ -0,0 +1,33 @@
1
+ module Spree
2
+ module ControllerRouteFix
3
+ def get(action, parameters = nil, session = nil, flash = nil)
4
+ process_spree_action(action, parameters, session, flash, "GET")
5
+ end
6
+
7
+ # Executes a request simulating POST HTTP method and set/volley the response
8
+ def post(action, parameters = nil, session = nil, flash = nil)
9
+ process_spree_action(action, parameters, session, flash, "POST")
10
+ end
11
+
12
+ # Executes a request simulating PUT HTTP method and set/volley the response
13
+ def put(action, parameters = nil, session = nil, flash = nil)
14
+ process_spree_action(action, parameters, session, flash, "PUT")
15
+ end
16
+
17
+ # Executes a request simulating DELETE HTTP method and set/volley the response
18
+ def delete(action, parameters = nil, session = nil, flash = nil)
19
+ process_spree_action(action, parameters, session, flash, "DELETE")
20
+ end
21
+
22
+ private
23
+
24
+ def process_spree_action(action, parameters = nil, session = nil, flash = nil, method = "GET")
25
+ parameters ||= {}
26
+ process(action, parameters.merge!(:use_route => :selections), session, flash, method)
27
+ end
28
+ end
29
+ end
30
+
31
+ RSpec.configure do |c|
32
+ c.include Spree::ControllerRouteFix, :type => :controller
33
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :company do
3
+ sequence(:name) {|n| "selection_#{n}"}
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :selection, :class => Selections::Selection do
3
+ sequence(:name) {|n| "selection_#{n}"}
4
+ end
5
+ end