Sha256: 917e13b1db63a48f904bd623469f1106427100852fe21bc41bfcb91d1476aa5f

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require "nnmClub_api"

describe "NnmClub" do
  describe "Search" do
    before {
      @query = "ruby on rails"
      @search = NnmClub::Search.new @query
      @url = NnmClub::URL
    }
    it "should return correct url without category" do
      expect(@search.url).to eq(@url+"nm=#{URI.escape(@query)}")
    end

    it "should return correct url with category" do
      @search = NnmClub::Search.new(@query,17)
      expect(@search.url).to eq(@url+"nm=#{URI.escape(@query)}"+"&c=17")
    end
  end

  describe "#torrents" do
    before {
      @query = "ruby on rails"
      @search = NnmClub::Search.new @query
    }

    it "should return array" do
      expect(@search.torrents.class).to eq([].class)
    end

    it "should retur array of 3 elements" do
      expect(@search.torrents.length).to eq(3)
    end
  end

  describe "Torrent" do
    before {
      @torrent_id = "97600"
      @torrent    = NnmClub::Torrent.find @torrent_id
    }
    it "should return @description" do
      expect(@torrent.class).to eq({}.class)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nnmClub_api-0.1.2 spec/nnmcluv_api_spec.rb