Sha256: 7b438f599ef4991996e84b5fd9fb46a656529fbce405c4a19ecff2cadf1c0b6f

Contents?: true

Size: 605 Bytes

Versions: 11

Compression:

Stored size: 605 Bytes

Contents

# -*- encoding: utf-8 -*-

require './spec/helper'
require 'nokogiri'

describe "Nokogiri library" do

  before :all do
    f = File.open("data/templates/main.html")
    @doc = Nokogiri::HTML(f)
    f.close
  end

  it "should retrieve all genit tag" do
    @doc.css("body genit").size.should == 2
  end
  
  it "should retrieve class of tag" do
    tags = @doc.css("body genit")
    tags[0]['class'].should == "menu"
    tags[1]['class'].should == "pages"
  end
  
  it "should add an attribute" do
    @doc.at_css("body")['class'] = "main"
    @doc.at_css("body")['class'].should == 'main'
  end
  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
genit-2.1 spec/nokogiri_spec.rb
genit-2.0 spec/nokogiri_spec.rb
genit-1.0.1 spec/nokogiri_spec.rb
genit-1.0 spec/nokogiri_spec.rb
genit-0.99 spec/nokogiri_spec.rb
genit-0.9 spec/nokogiri_spec.rb
genit-0.5 spec/nokogiri_spec.rb
genit-0.4.1 spec/nokogiri_spec.rb
genit-0.4 spec/nokogiri_spec.rb
genit-0.3 spec/nokogiri_spec.rb
genit-0.2 spec/nokogiri_spec.rb