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/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"
|
||||||
@ -141,23 +142,9 @@ 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
|
||||||
expect(Utils::Analytics).to receive(:formulae_brew_sh_json).twice.with("cask/docker.json").and_return(
|
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")
|
||||||
"analytics": {
|
.and_return(JSON.parse(analytics))
|
||||||
"install": {
|
|
||||||
"30d": {
|
|
||||||
"docker": 1000,
|
|
||||||
},
|
|
||||||
"90d": {
|
|
||||||
"docker": 2000,
|
|
||||||
},
|
|
||||||
"365d": {
|
|
||||||
"docker": 3000,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
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")
|
||||||
@ -174,7 +161,7 @@ describe Cask::Cmd::Info, :cask do
|
|||||||
==> Artifacts
|
==> Artifacts
|
||||||
Docker.app (App)
|
Docker.app (App)
|
||||||
==> Analytics
|
==> 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.
|
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/d0b2c58652ae5eff20a7a4ac93292a08b250912b/Casks/docker.rb.
|
||||||
docker: 2.0.0.2-ce-mac81,30215 (auto_updates)
|
docker: 2.0.0.2-ce-mac81,30215 (auto_updates)
|
||||||
https://www.docker.com/community-edition
|
https://www.docker.com/community-edition
|
||||||
@ -185,7 +172,7 @@ describe Cask::Cmd::Info, :cask do
|
|||||||
==> Artifacts
|
==> Artifacts
|
||||||
Docker.app (App)
|
Docker.app (App)
|
||||||
==> Analytics
|
==> 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
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user