replaced json and used dictionary

This commit is contained in:
Tharun 2020-05-19 19:35:30 +05:30
parent 6a50f31feb
commit 84f2edc884

View File

@ -3,7 +3,6 @@
require_relative "shared_examples/requires_cask_token" require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option" require_relative "shared_examples/invalid_option"
require "utils" require "utils"
require "json"
describe Cask::Cmd::Info, :cask do describe Cask::Cmd::Info, :cask do
it_behaves_like "a command that requires a Cask token" it_behaves_like "a command that requires a Cask token"
@ -142,9 +141,15 @@ describe Cask::Cmd::Info, :cask do
end end
it "can run be run with a url twice", :needs_network do it "can run be run with a url twice", :needs_network do
analytics = '{"analytics":{"install":{"30d":{"docker": 1000},"90d":{"docker": 2000},"365d":{"docker": 3000}}}}' analytics = {
"analytics" => {
"install" => {
"30d" => { "docker" => 1000 }, "90d" => { "docker" => 2000 }, "365d" => { "docker" => 3000 }
},
},
}
expect(Utils::Analytics).to receive(:formulae_brew_sh_json).twice.with("cask/docker.json") expect(Utils::Analytics).to receive(:formulae_brew_sh_json).twice.with("cask/docker.json")
.and_return(JSON.parse(analytics)) .and_return(analytics)
expect { expect {
described_class.run("https://raw.githubusercontent.com/Homebrew/homebrew-cask" \ described_class.run("https://raw.githubusercontent.com/Homebrew/homebrew-cask" \
"/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb") "/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb")