Permalink
Browse files

basic tests for cdnjs

  • Loading branch information...
1 parent 60af652 commit 24279e52f0709bddc6c553e1bd50adeedc1b8294 @charly committed Oct 8, 2012
Showing with 36 additions and 7 deletions.
  1. +36 −7 spec/models/cdnjs_spec.rb
@@ -1,34 +1,63 @@
require "spec_helper"
# TODO : TAFT
-decribe Jail::Cdnjs do
+describe Jail::Cdnjs, :vcr do
describe "#package" do
+ let(:jail) { Jail::Cdnjs.find("chosen") }
+
it "holds a Hashie of parsed package.json" do
- true
+ jail.package.should be_a(Hashie::Mash)
+ end
+
+ it "has a name" do
+ jail.package.name.should == "chosen"
+ end
+
+ it "has a filename" do
+ jail.package.filename.should == "chosen.jquery.min.js"
+ end
+
+ it "has a descritpion" do
+ jail.package.description.should match(/Chosen is a JavaScript plugin that/)
+ end
+
+ it "has a version" do
+ jail.package.version.should match( /\d+.\d+.\d+/)
end
end
describe "#version_path" do
+ let(:jail) { Jail::Cdnjs.find("chosen") }
+
it "it has the pathname of latest version" do
- true
+ jail.version_path.to_s.should match(/libs\/chosen\/\d+.\d+.\d+/)
end
end
describe "#files" do
+ let(:jail) { Jail::Cdnjs.find("chosen") }
+
+ it "lists the files in #version_path" do
+ jail.files.map(&:path).last.should match(/libs\/chosen\/\d+.\d+.\d+/)
+ end
+
it "github API resp listing the (latest) version folder" do
- true
+ jail.files.map(&:name).should include("chosen-sprite.png", "chosen.css", "chosen.jquery.js")
end
end
- describe "#file" do
- it "github API resp of a file in the version folder" do
- true
+ describe "#file(path)" do
+ let(:jail) { Jail::Cdnjs.find("chosen") }
+
+ it "it holds the github instance with the path" do
+ jail.file("chosen.css").contents.type.should == "file"
end
end
describe "#mapped_files" do
it "groups files by their extension" do
+ pending "Not using this method (FOR DELETION ?)"
true
end
end

0 comments on commit 24279e5

Please sign in to comment.