fixed proper parsing of mock data for analytics
This commit is contained in:
parent
7186600a5c
commit
6a50f31feb
@ -3,6 +3,7 @@
|
||||
require_relative "shared_examples/requires_cask_token"
|
||||
require_relative "shared_examples/invalid_option"
|
||||
require "utils"
|
||||
require "json"
|
||||
|
||||
describe Cask::Cmd::Info, :cask do
|
||||
it_behaves_like "a command that requires a Cask token"
|
||||
@ -141,23 +142,9 @@ describe Cask::Cmd::Info, :cask do
|
||||
end
|
||||
|
||||
it "can run be run with a url twice", :needs_network do
|
||||
expect(Utils::Analytics).to receive(:formulae_brew_sh_json).twice.with("cask/docker.json").and_return(
|
||||
{
|
||||
"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")
|
||||
.and_return(JSON.parse(analytics))
|
||||
expect {
|
||||
described_class.run("https://raw.githubusercontent.com/Homebrew/homebrew-cask" \
|
||||
"/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb")
|
||||
@ -174,7 +161,7 @@ describe Cask::Cmd::Info, :cask do
|
||||
==> Artifacts
|
||||
Docker.app (App)
|
||||
==> Analytics
|
||||
install: 16,997 (30 days), 54,056 (90 days), 239,482 (365 days)
|
||||
install: 1,000 (30 days), 2,000 (90 days), 3,000 (365 days)
|
||||
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb.
|
||||
docker: 2.0.0.2-ce-mac81,30215 (auto_updates)
|
||||
https://www.docker.com/community-edition
|
||||
@ -185,7 +172,7 @@ describe Cask::Cmd::Info, :cask do
|
||||
==> Artifacts
|
||||
Docker.app (App)
|
||||
==> Analytics
|
||||
install: 16,997 (30 days), 54,056 (90 days), 239,482 (365 days)
|
||||
install: 1,000 (30 days), 2,000 (90 days), 3,000 (365 days)
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user