Skip to content

Commit

Permalink
Merge pull request #328 from voormedia/pr-300
Browse files Browse the repository at this point in the history
Fix for bug when parameter to only option is a single model
  • Loading branch information
kerrizor committed May 13, 2019
2 parents 985b5a3 + 8a4e3d4 commit 21e7f38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rails_erd/tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ namespace :erd do
when "false", "no" then false
when /,/ then ENV[option].split(/\s*,\s*/)
when /^\d+$/ then ENV[option].to_i
else ENV[option].to_sym
else
if option == 'only'
[ENV[option]]
else
ENV[option].to_sym
end
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions test/unit/rake_task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,10 @@ def teardown
Rake::Task["erd:options"].execute
assert_equal :test, RailsERD.options.only_recursion_depth
end

test "options task should set single parameter to only as array xxx" do
ENV["only"] = "model"
Rake::Task["erd:options"].execute
assert_equal ["model"], RailsERD.options.only
end
end

0 comments on commit 21e7f38

Please sign in to comment.