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
2 changes: 1 addition & 1 deletion lib/papers/manifest_command.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Papers
class ManifestCommand
def initialize(manifest_path = nil)
@manifest_path = manifest_path || File.join('config', 'papers_manifest.yml')
@manifest_path = manifest_path || Papers.config.manifest_file || File.join('config', 'papers_manifest.yml')
end

def manifest_exists?
Expand Down
27 changes: 27 additions & 0 deletions spec/manifest_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,31 @@
expect(updater.update).to eq(expected)
end
end

describe "with a configured manifest file path" do
let(:path) { "/config/papers_manifest_custom.yml" }
subject(:updater) { Papers::ManifestUpdater.new }
let(:original_content) { <<EOS
#{header.chomp}
gems:
rails-4.2.0:
license: MIT
license_url:
project_url: https://github.com/rails/rails
EOS
}

it "updates the file at the configured path" do
Papers.configure do |config|
config.manifest_file = path
end

allow(updater).to receive(:gemspecs).and_return([
double(name: 'rails', version: '4.2.7.1', license: "MIT"),
])

expected = original_content.gsub(/rails-4.2.0/, "rails-4.2.7.1")
expect(updater.update).to eq(expected)
end
end
end