Skip to content

Commit

Permalink
Merge pull request #439 from zilverline/fix-generated-project-test
Browse files Browse the repository at this point in the history
Test generated project against current working copy of Sequent gem
  • Loading branch information
erikrozendaal authored Jan 6, 2025
2 parents 06970a3 + 22b75e9 commit acd1015
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/sequent/generator/template_project/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ruby file: '.ruby-version'

gem 'csv'
gem 'rake'
gem 'sequent', '>= 8'
gem 'sequent', '~> 8'

group :test do
gem 'database_cleaner'
Expand Down
17 changes: 14 additions & 3 deletions spec/lib/sequent/generator/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,21 @@
expect(File.read('blog-with_special-symbols/Rakefile')).to include("require './blog_with_special_symbols'")
end

# Ignore for now until we find a way to correctly test the template project
# against the locally checked out sequent code.
xit 'has working example with specs' do
it 'has working example with specs' do
execute

contents = File.read('blog-with_special-symbols/Gemfile')
File.write(
'blog-with_special-symbols/Gemfile',
contents.lines.map do |line|
if line =~ /sequent/
"gem 'sequent', path: '../../..'\n"
else
line
end
end.join,
)

Bundler.with_unbundled_env do
# Change default database configuration
Sequent.configuration.database_config_directory = File.join(path, 'db')
Expand All @@ -71,6 +81,7 @@
system 'bash', '-cex', <<~SCRIPT
cd blog-with_special-symbols
export SEQUENT_ENV=test
export BUNDLE_GEMFILE=./Gemfile
ruby_version=$(ruby -v | awk '{print $2}' | grep -o '^[0-9.]*')
echo "$ruby_version" > .ruby-version
Expand Down

0 comments on commit acd1015

Please sign in to comment.