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 'factory_girl_rails', '~> 4.5'
gem 'cucumber-rails', '~> 1.4.2', require: false gem 'cucumber-rails', '~> 1.4.2', require: false
gem 'rack_session_access' gem 'rack_session_access'
# restrict because in version 1.3 a lot of tests using acts as journalized gem 'database_cleaner', '~> 1.4.1'
# 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 'rspec', '~> 3.3.0' gem 'rspec', '~> 3.3.0'
# also add to development group, so "spec" rake task gets loaded # also add to development group, so "spec" rake task gets loaded
gem 'rspec-rails', '~> 3.3.0', group: :development gem 'rspec-rails', '~> 3.3.0', group: :development

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

@ -86,14 +86,18 @@ describe ::API::V3::Repositories::RevisionRepresenter do
let(:html_reference) { let(:html_reference) {
id = work_package.id 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 << " class=\"issue work_package status-1 priority-1 parent\""
str << " href=\"/work_packages/#{id}\""
str << " title=\"#{work_package.subject} (#{work_package.status})\">" str << " title=\"#{work_package.subject} (#{work_package.status})\">"
str << "##{id}</a>" str << "##{id}</a>"
} }
before do 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 end
it_behaves_like 'API V3 formattable', 'message' do it_behaves_like 'API V3 formattable', 'message' do

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

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

Loading…
Cancel
Save