Merge pull request #3 from ulferts/fix/dev_to_rails4_branch_merge_specs

Fix/dev to rails4 branch merge specs
pull/3327/head
Alex Coles 9 years ago
commit 77ffbca98b
  1. 6
      Gemfile
  2. 4
      Gemfile.lock
  3. 8
      spec/lib/api/v3/repositories/revision_representer_spec.rb
  4. 2
      spec/models/project_spec.rb
  5. 6
      spec/spec_helper.rb

@ -144,11 +144,7 @@ group :test do
gem 'factory_girl_rails', '~> 4.5'
gem 'cucumber-rails', '~> 1.4.2', require: false
gem 'rack_session_access'
# restrict because in version 1.3 a lot of tests using acts as journalized
# fail stating: "Column 'user_id' cannot be null". I don't understand the
# connection with database cleaner here but setting it to 1.2 fixes the
# issue.
gem 'database_cleaner', '~> 1.2.0'
gem 'database_cleaner', '~> 1.4.1'
gem 'rspec', '~> 3.3.0'
# also add to development group, so "spec" rake task gets loaded
gem 'rspec-rails', '~> 3.3.0', group: :development

@ -161,7 +161,7 @@ GEM
rails (>= 3, < 5)
daemons (1.2.2)
dalli (2.7.4)
database_cleaner (1.2.0)
database_cleaner (1.4.1)
date_validator (0.7.1)
activemodel
debug_inspector (0.0.2)
@ -491,7 +491,7 @@ DEPENDENCIES
cucumber-rails (~> 1.4.2)
daemons
dalli (~> 2.7.2)
database_cleaner (~> 1.2.0)
database_cleaner (~> 1.4.1)
date_validator (~> 0.7.1)
delayed_job_active_record (~> 4.0.2)
equivalent-xml (~> 0.5.1)

@ -86,14 +86,18 @@ describe ::API::V3::Repositories::RevisionRepresenter do
let(:html_reference) {
id = work_package.id
str = "Totally references <a href=\"/work_packages/#{id}\""
str = 'Totally references <a'
str << " class=\"issue work_package status-1 priority-1 parent\""
str << " href=\"/work_packages/#{id}\""
str << " title=\"#{work_package.subject} (#{work_package.status})\">"
str << "##{id}</a>"
}
before do
allow(WorkPackage).to receive(:find_by_id).and_return(work_package)
allow(User).to receive(:current).and_return(FactoryGirl.build_stubbed(:admin))
allow(WorkPackage)
.to receive_message_chain('visible.includes.references.find_by')
.and_return(work_package)
end
it_behaves_like 'API V3 formattable', 'message' do

@ -271,6 +271,7 @@ describe Project, type: :model do
describe '#total_projects_size' do
let(:projects) { FactoryGirl.build_list(:project, 3) }
before do
project.save
projects.each(&:save!)
allow(Project).to receive(:all).and_return(projects)
@ -286,7 +287,6 @@ describe Project, type: :model do
end
it 'counts required_storage on all projects' do
expect(Project.all.length).to eq(3)
expect(Project.total_projects_size).to eq(2435890)
end

@ -82,8 +82,10 @@ RSpec.configure do |config|
config.before(:each) do |example|
DatabaseCleaner.strategy = if example.metadata[:js]
# JS => doesn't share connections => can't use transactions
# truncations seem to fail more often + they are slower
:deletion
# as of database_cleaner 1.4 'deletion' causes error:
# 'column "table_rows" does not exist'
# https://github.com/DatabaseCleaner/database_cleaner/issues/345
:truncation
else
# No JS/Devise => run with Rack::Test => transactions are ok
:transaction

Loading…
Cancel
Save