Skip to content
Open
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
3 changes: 2 additions & 1 deletion lib/appraisal/bundler_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def source(source, &block)
end
end

def ruby(ruby_version)
def ruby(ruby_version = nil, **kwargs)
@ruby_version = ruby_version
@ruby_version = kwargs unless ruby_version
end

def git(source, options = {}, &block)
Expand Down
16 changes: 16 additions & 0 deletions spec/appraisal/gemfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,20 @@
expect(gemfile.load(tmpfile.path)).to include(File.dirname(tmpfile.path))
end
end

it "supports the ruby file: syntax" do
gemfile = Appraisal::Gemfile.new

gemfile.ruby file: ".ruby-version"
gemfile.source "one"

ruby_version = gemfile.instance_variable_get("@ruby_version")
expected = ruby_version.is_a?(String) ? "ruby #{ruby_version.inspect}" : "ruby(#{ruby_version.inspect})"

expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip
source "one"

#{expected}
GEMFILE
end
end
Loading