diff --git a/spec/factories/global_role_factory.rb b/spec/factories/global_role_factory.rb index 110ac9e89b..e2f6d6c5ee 100644 --- a/spec/factories/global_role_factory.rb +++ b/spec/factories/global_role_factory.rb @@ -1,3 +1,5 @@ -Factory.define(:global_role) do |gr| - gr.name "global_role" -end \ No newline at end of file +FactoryGirl.define do + factory :global_role do |gr| + gr.name "global_role" + end +end diff --git a/spec/factories/principal_role_factory.rb b/spec/factories/principal_role_factory.rb index 0c8bca61e4..91de79dbab 100644 --- a/spec/factories/principal_role_factory.rb +++ b/spec/factories/principal_role_factory.rb @@ -1,4 +1,6 @@ -Factory.define :principal_role do |pr| - pr.association :role, :factory => :global_role - pr.association :principal, :factory => :user -end \ No newline at end of file +FactoryGirl.define do + factory :principal_role do |pr| + pr.association :role, :factory => :global_role + pr.association :principal, :factory => :user + end +end diff --git a/spec/lib/global_roles/principal_allowance_evaluator/global_spec.rb b/spec/lib/global_roles/principal_allowance_evaluator/global_spec.rb index 9c6e61b388..9ab96c6868 100644 --- a/spec/lib/global_roles/principal_allowance_evaluator/global_spec.rb +++ b/spec/lib/global_roles/principal_allowance_evaluator/global_spec.rb @@ -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 } diff --git a/spec/models/global_role_spec.rb b/spec/models/global_role_spec.rb index 79cb73ec85..4c7ebe1273 100644 --- a/spec/models/global_role_spec.rb +++ b/spec/models/global_role_spec.rb @@ -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 \ No newline at end of file +end diff --git a/spec/models/principal_role_spec.rb b/spec/models/principal_role_spec.rb index ab3cc7244a..c4e505539c 100644 --- a/spec/models/principal_role_spec.rb +++ b/spec/models/principal_role_spec.rb @@ -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 \ No newline at end of file +end diff --git a/spec/models/principal_spec.rb b/spec/models/principal_spec.rb index 1983c86b32..a30c550c96 100644 --- a/spec/models/principal_spec.rb +++ b/spec/models/principal_spec.rb @@ -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 diff --git a/spec/plugin_spec_helper.rb b/spec/plugin_spec_helper.rb index f44711d360..9e9d0d6d4a 100644 --- a/spec/plugin_spec_helper.rb +++ b/spec/plugin_spec_helper.rb @@ -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 \ No newline at end of file +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ffbf03210b..e491dcd4e6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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 \ No newline at end of file +# include OpenProject::GlobalRoles::PluginSpecHelper + +require 'spec_helper' + +require File.join(File.dirname(__FILE__), 'plugin_spec_helper') +include OpenProject::GlboalRoles::PluginSpecHelper