Skip to content

Commit

Permalink
1712870652
Browse files Browse the repository at this point in the history
  • Loading branch information
azimux committed Apr 11, 2024
1 parent b45a099 commit ba0e23f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
31 changes: 28 additions & 3 deletions spec/foobara/remote_imports/import_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,46 @@
end
end

context "importing from a url" do
context "when importing from a url" do
let(:inputs) do
{
manifest_url:,
to_import:,
cache: false
to_import:
}
end
let(:manifest_url) do
"http://localhost:9292/manifest"
end

before do
command.cast_and_validate_inputs
FileUtils.rm_f(command.cache_file_path)
end

# To rerecord this, change from :none to :once and run playground-be with rackup
it "is success", vcr: { record: :none } do
expect(outcome).to be_success
# make sure loading from cache works fine as well
expect(described_class.run!(inputs.merge(cache: true))).to be_an(Array)
end
end

context "with both manifest data and url" do
let(:inputs) do
{
manifest_url: "http://localhost:9292/manifest",
raw_manifest:,
to_import:
}
end

it "is not success" do
expect(outcome).to_not be_success
expect(errors.size).to eq(1)

error = errors.first

expect(error).to be_a(Foobara::RemoteImports::ImportBase::BadManifestInputsError)
end
end
end
Loading

0 comments on commit ba0e23f

Please sign in to comment.