Renamed Factory to FactoryGirl and newline fixes

pull/6827/head
Sebastian Schuster 12 years ago
parent 90bb29d392
commit 747e49d192
  1. 8
      spec/factories/global_role_factory.rb
  2. 10
      spec/factories/principal_role_factory.rb
  3. 12
      spec/lib/global_roles/principal_allowance_evaluator/global_spec.rb
  4. 6
      spec/models/global_role_spec.rb
  5. 4
      spec/models/principal_role_spec.rb
  6. 6
      spec/models/principal_spec.rb
  7. 4
      spec/plugin_spec_helper.rb
  8. 49
      spec/spec_helper.rb

@ -1,3 +1,5 @@
Factory.define(:global_role) do |gr|
gr.name "global_role"
end
FactoryGirl.define do
factory :global_role do |gr|
gr.name "global_role"
end
end

@ -1,4 +1,6 @@
Factory.define :principal_role do |pr|
pr.association :role, :factory => :global_role
pr.association :principal, :factory => :user
end
FactoryGirl.define do
factory :principal_role do |pr|
pr.association :role, :factory => :global_role
pr.association :principal, :factory => :user
end
end

@ -3,14 +3,14 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
describe GlobalRoles::PrincipalAllowanceEvaluator::Global do
let(:klass) { GlobalRoles::PrincipalAllowanceEvaluator::Global }
let(:user) { Factory.build(:user) }
let(:user) { FactoryGirl.build(:user) }
let(:filter) { klass.new user }
let(:member) { Factory.build(:member) }
let(:principal_role) { Factory.build(:principal_role,
let(:member) { FactoryGirl.build(:member) }
let(:principal_role) { FactoryGirl.build(:principal_role,
:role => role) }
let(:principal_role2) { Factory.build(:principal_role) }
let(:role) { Factory.build(:global_role) }
let(:project) { Factory.build(:project) }
let(:principal_role2) { FactoryGirl.build(:principal_role) }
let(:role) { FactoryGirl.build(:global_role) }
let(:project) { FactoryGirl.build(:project) }
describe :granted_for_project? do
it { filter.granted_for_project?(member, :action, project).should be_false }

@ -152,8 +152,8 @@ describe GlobalRole do
describe :assignable_to? do
before(:each) do
@role = Factory.build(:global_role)
@user = Factory.build(:user)
@role = FactoryGirl.build(:global_role)
@user = FactoryGirl.build(:user)
end
it "always true global roles for now" do
@role.assignable_to?(@user).should be_true
@ -161,4 +161,4 @@ describe GlobalRole do
end
end
end
end

@ -13,7 +13,7 @@ describe PrincipalRole do
describe :valid? do
before(:each) do
@principal_role = Factory.build(:principal_role)
@principal_role = FactoryGirl.build(:principal_role)
end
describe "role not assignable to user" do
@ -34,4 +34,4 @@ describe PrincipalRole do
it { @principal_role.valid?.should be_true }
end
end
end
end

@ -12,11 +12,11 @@ describe Principal do
end
describe "WHEN deleting a principal" do
let(:principal) { Factory.build(:user) }
let(:role) { Factory.build(:global_role) }
let(:principal) { FactoryGirl.build(:user) }
let(:role) { FactoryGirl.build(:global_role) }
before do
Factory.create(:principal_role, :role => role,
FactoryGirl.create(:principal_role, :role => role,
:principal => principal)
principal.destroy

@ -1,4 +1,4 @@
module GlobalRoles
module OpenProject::GlobalRoles
module PluginSpecHelper
def mobile_tan_plugin_loaded?
plugin_loaded?("redmine_mobile_otp_authentication")
@ -138,4 +138,4 @@ module GlobalRoles
end
end
end
end
end

@ -1,30 +1,35 @@
RAILS_ENV = "test" unless defined? RAILS_ENV
#RAILS_ENV = "test" unless defined? RAILS_ENV
# prevent case where we are using rubygems and test-unit 2.x is installed
begin
require 'rubygems'
gem "test-unit", "~> 1.2.3"
rescue LoadError
end
#begin
# require 'rubygems'
# gem "test-unit", "~> 1.2.3"
#rescue LoadError
#end
begin
#require "config/environment" unless defined? RAILS_ROOT
require 'spec/spec_helper'
rescue LoadError => error
puts <<-EOS
# begin
# #require "config/environment" unless defined? RAILS_ROOT
# require 'spec/spec_helper'
# rescue LoadError => error
# puts <<-EOS
You need to install rspec in your Redmine project.
Please execute the following code:
# You need to install rspec in your Redmine project.
# Please execute the following code:
gem install rspec-rails
script/generate rspec
# gem install rspec-rails
# script/generate rspec
EOS
raise error
end
# EOS
# raise error
# end
Fixtures.create_fixtures File.join(File.dirname(__FILE__), "fixtures"), ActiveRecord::Base.connection.tables
require File.expand_path(File.dirname(__FILE__) + '/plugin_spec_helper')
require 'redmine_factory_girl'
# Fixtures.create_fixtures File.join(File.dirname(__FILE__), "fixtures"), ActiveRecord::Base.connection.tables
# require File.expand_path(File.dirname(__FILE__) + 'support/plugin_spec_helper')
# require 'redmine_factory_girl'
include GlobalRoles::PluginSpecHelper
# include OpenProject::GlobalRoles::PluginSpecHelper
require 'spec_helper'
require File.join(File.dirname(__FILE__), 'plugin_spec_helper')
include OpenProject::GlboalRoles::PluginSpecHelper

Loading…
Cancel
Save