Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix only_recursion_depth option failure when used from rake erd task #266

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rails_erd/tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace :erd do
when "true", "yes" then true
when "false", "no" then false
when /,/ then ENV[option].split(/\s*,\s*/)
when /^\d+$/ then ENV[option].to_i
else ENV[option].to_sym
end
end
Expand Down
12 changes: 12 additions & 0 deletions test/unit/rake_task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,16 @@ def teardown
Rake::Task["erd:options"].execute
assert_equal %w[content timestamps], RailsERD.options.attributes
end

test "options task should set known integer command line options when value is only digits" do
ENV["only_recursion_depth"] = "2"
Rake::Task["erd:options"].execute
assert_equal 2, RailsERD.options.only_recursion_depth
end

test "options task sets known command line options as symbols when not boolean or numeric" do
ENV["only_recursion_depth"] = "test"
Rake::Task["erd:options"].execute
assert_equal :test, RailsERD.options.only_recursion_depth
end
end