Commit 4805c64f2a96e8a9ea5a0e94a820d840fa1675e0
1 parent
a04b919a
Exists in
master
and in
4 other branches
Remove spec/factory and spec/factories
Showing
4 changed files
with
0 additions
and
128 deletions
Show diff stats
features/support/env.rb
| @@ -8,7 +8,6 @@ require 'webmock/cucumber' | @@ -8,7 +8,6 @@ require 'webmock/cucumber' | ||
| 8 | 8 | ||
| 9 | WebMock.allow_net_connect! | 9 | WebMock.allow_net_connect! |
| 10 | 10 | ||
| 11 | -require Rails.root.join 'spec/factories' | ||
| 12 | require Rails.root.join 'spec/support/monkeypatch' | 11 | require Rails.root.join 'spec/support/monkeypatch' |
| 13 | require Rails.root.join 'spec/support/gitolite_stub' | 12 | require Rails.root.join 'spec/support/gitolite_stub' |
| 14 | require Rails.root.join 'spec/support/login_helpers' | 13 | require Rails.root.join 'spec/support/login_helpers' |
spec/factories.rb
| @@ -1,97 +0,0 @@ | @@ -1,97 +0,0 @@ | ||
| 1 | -require File.join(Rails.root, 'spec', 'factory') | ||
| 2 | - | ||
| 3 | -Factory.add(:project, Project) do |obj| | ||
| 4 | - obj.name = Faker::Internet.user_name | ||
| 5 | - obj.path = 'gitlabhq' | ||
| 6 | - obj.owner = Factory(:user) | ||
| 7 | - obj.code = 'LGT' | ||
| 8 | -end | ||
| 9 | - | ||
| 10 | -Factory.add(:project_without_owner, Project) do |obj| | ||
| 11 | - obj.name = Faker::Internet.user_name | ||
| 12 | - obj.path = 'gitlabhq' | ||
| 13 | - obj.code = 'LGT' | ||
| 14 | -end | ||
| 15 | - | ||
| 16 | -Factory.add(:public_project, Project) do |obj| | ||
| 17 | - obj.name = Faker::Internet.user_name | ||
| 18 | - obj.path = 'gitlabhq' | ||
| 19 | - obj.private_flag = false | ||
| 20 | - obj.owner = Factory(:user) | ||
| 21 | - obj.code = 'LGT' | ||
| 22 | -end | ||
| 23 | - | ||
| 24 | -Factory.add(:user, User) do |obj| | ||
| 25 | - obj.email = Faker::Internet.email | ||
| 26 | - obj.password = "123456" | ||
| 27 | - obj.name = Faker::Name.name | ||
| 28 | - obj.password_confirmation = "123456" | ||
| 29 | -end | ||
| 30 | - | ||
| 31 | -Factory.add(:admin, User) do |obj| | ||
| 32 | - obj.email = Faker::Internet.email | ||
| 33 | - obj.password = "123456" | ||
| 34 | - obj.name = Faker::Name.name | ||
| 35 | - obj.password_confirmation = "123456" | ||
| 36 | - obj.admin = true | ||
| 37 | -end | ||
| 38 | - | ||
| 39 | -Factory.add(:issue, Issue) do |obj| | ||
| 40 | - obj.title = Faker::Lorem.sentence | ||
| 41 | - obj.author = Factory :user | ||
| 42 | - obj.assignee = Factory :user | ||
| 43 | -end | ||
| 44 | - | ||
| 45 | -Factory.add(:merge_request, MergeRequest) do |obj| | ||
| 46 | - obj.title = Faker::Lorem.sentence | ||
| 47 | - obj.author = Factory :user | ||
| 48 | - obj.assignee = Factory :user | ||
| 49 | - obj.source_branch = "master" | ||
| 50 | - obj.target_branch = "stable" | ||
| 51 | - obj.closed = false | ||
| 52 | -end | ||
| 53 | - | ||
| 54 | -Factory.add(:snippet, Snippet) do |obj| | ||
| 55 | - obj.title = Faker::Lorem.sentence | ||
| 56 | - obj.file_name = Faker::Lorem.sentence | ||
| 57 | - obj.content = Faker::Lorem.sentences | ||
| 58 | -end | ||
| 59 | - | ||
| 60 | -Factory.add(:note, Note) do |obj| | ||
| 61 | - obj.note = Faker::Lorem.sentence | ||
| 62 | -end | ||
| 63 | - | ||
| 64 | -Factory.add(:key, Key) do |obj| | ||
| 65 | - obj.title = "Example key" | ||
| 66 | - obj.key = File.read(File.join(Rails.root, "db", "pkey.example")) | ||
| 67 | -end | ||
| 68 | - | ||
| 69 | -Factory.add(:project_hook, ProjectHook) do |obj| | ||
| 70 | - obj.url = Faker::Internet.uri("http") | ||
| 71 | -end | ||
| 72 | - | ||
| 73 | -Factory.add(:system_hook, SystemHook) do |obj| | ||
| 74 | - obj.url = Faker::Internet.uri("http") | ||
| 75 | -end | ||
| 76 | - | ||
| 77 | -Factory.add(:wiki, Wiki) do |obj| | ||
| 78 | - obj.title = Faker::Lorem.sentence | ||
| 79 | - obj.content = Faker::Lorem.sentence | ||
| 80 | - obj.user = Factory(:user) | ||
| 81 | - obj.project = Factory(:project) | ||
| 82 | -end | ||
| 83 | - | ||
| 84 | -Factory.add(:event, Event) do |obj| | ||
| 85 | - obj.title = Faker::Lorem.sentence | ||
| 86 | - obj.project = Factory(:project) | ||
| 87 | -end | ||
| 88 | - | ||
| 89 | -Factory.add(:milestone, Milestone) do |obj| | ||
| 90 | - obj.title = Faker::Lorem.sentence | ||
| 91 | - obj.due_date = Date.today + 1.month | ||
| 92 | -end | ||
| 93 | - | ||
| 94 | -Factory.add(:users_project, UsersProject) do |obj| | ||
| 95 | - obj.user = Factory :user | ||
| 96 | - obj.project = Factory :project | ||
| 97 | -end |
spec/factory.rb
| @@ -1,29 +0,0 @@ | @@ -1,29 +0,0 @@ | ||
| 1 | -class Factory | ||
| 2 | - @factories = {} | ||
| 3 | - | ||
| 4 | - class << self | ||
| 5 | - def add(name, klass, &block) | ||
| 6 | - @factories[name] = [klass, block] | ||
| 7 | - end | ||
| 8 | - | ||
| 9 | - def create(name, opts = {}) | ||
| 10 | - new(name, opts).tap(&:save!) | ||
| 11 | - end | ||
| 12 | - | ||
| 13 | - def new(name, opts = {}) | ||
| 14 | - factory= @factories[name] | ||
| 15 | - factory[0].new.tap do |obj| | ||
| 16 | - factory[1].call(obj) | ||
| 17 | - end.tap do |obj| | ||
| 18 | - opts.each do |k, opt| | ||
| 19 | - obj.send("#{k}=", opt) | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | - end | ||
| 23 | - end | ||
| 24 | -end | ||
| 25 | - | ||
| 26 | -def Factory(name, opts={}) | ||
| 27 | - Factory.create name, opts | ||
| 28 | -end | ||
| 29 | - |
spec/spec_helper.rb
| @@ -10,7 +10,6 @@ require 'rspec/rails' | @@ -10,7 +10,6 @@ require 'rspec/rails' | ||
| 10 | require 'capybara/rails' | 10 | require 'capybara/rails' |
| 11 | require 'capybara/rspec' | 11 | require 'capybara/rspec' |
| 12 | require 'webmock/rspec' | 12 | require 'webmock/rspec' |
| 13 | -require 'factories' | ||
| 14 | require 'email_spec' | 13 | require 'email_spec' |
| 15 | require 'headless' | 14 | require 'headless' |
| 16 | 15 |