{"id":19049315,"url":"https://github.com/cppforlife/have_tag","last_synced_at":"2025-11-11T21:02:28.047Z","repository":{"id":2793154,"uuid":"3793306","full_name":"cppforlife/have_tag","owner":"cppforlife","description":"nokogiri powered have_tag matcher","archived":false,"fork":false,"pushed_at":"2012-03-22T01:15:27.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T09:25:35.611Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cppforlife.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-22T01:14:21.000Z","updated_at":"2013-12-07T08:47:00.000Z","dependencies_parsed_at":"2022-09-10T14:01:41.112Z","dependency_job_id":null,"html_url":"https://github.com/cppforlife/have_tag","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppforlife%2Fhave_tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppforlife%2Fhave_tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppforlife%2Fhave_tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppforlife%2Fhave_tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cppforlife","download_url":"https://codeload.github.com/cppforlife/have_tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240105469,"owners_count":19748465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T23:10:31.760Z","updated_at":"2025-11-11T21:02:23.025Z","avatar_url":"https://github.com/cppforlife.png","language":"Ruby","readme":"have_tag matcher for HTML build on top of Nokogiri.\n\n# Usage\n\n    get \"/home_page\"\n    response.should be_ok\n\n    response.body.should have_tag \"#account\" do\n      with_tag \"a\", :href =\u003e /log_out/\n      without_tag \"a\", :href =\u003e /log_in/\n    end\n\nAs shown above have_tag matcher operates on plain strings; however,\nsince it is mostly used with other testing libraries it can also be\ncalled directly on `response` (RSpec) and `page` (Capybara) i.e.\n\n    response.should have_tag...\n    page.should have_tag\n\n# RSpec integration:\n\n    require \"have_tag\"\n    RSpec.configure do |config|\n      config.include HaveTag\n    end\n\n# More examples\n\n    html.should have_tag \"#header\"\n\n    html.should have_tag \"span\", :text =\u003e \"exact text match\"\n    html.should have_tag \"span\", :text =\u003e /\\d{3}-\\d{4}/\n\n    html.should have_tag \"li\", :exactly =\u003e 3\n    html.should have_tag \"li\", :at_least =\u003e 1 # default\n    html.should have_tag \"li\", :at_most =\u003e 10\n\n    html.should have_tag \"img\", :src =\u003e \"/exact/attribute/match.gif\"\n    html.should have_tag \"img\", :src =\u003e %r{beacon.gif}\n\n    html.should have_tag \"a\", :href =\u003e \"http://google.com\", :target =\u003e \"_blank\"\n\n    # using both attribute matching and text/count options\n    html.should have_tag \"li a\", {:href =\u003e /\\?product_id=\\d+/}, {:text =\u003e /product/, :exactly =\u003e 10}\n\n# Limiting by context\n\n    html.should have_tag \"#account\" do |account_html|\n      # account_html is plain string that holds inner html of #account\n      account_html.should include \"Welcome, Dmitriy Kalinin\"\n\n      account_html.should have_tag \"a\", :href =\u003e /logout/\n\n      with_tag \"a\", :href =\u003e /logout/ # for convenience =)\n    end\n\n    html.should have_tag \"#bank_balance.chart\" do |chart_html, chart_attributes|\n      chart_attributes[\"data-title\"].should == \"Bank balance\"\n      chart_attributes[\"data-values\"].should == [33,293,38,93].join(\",\")\n\n      with_tag \".legend\" do\n        with_tag \"span.label\", {:style =\u003e /color:/}, :exactly =\u003e 4\n      end\n    end\n\n    page.should have_tag \"ul#projects\" do\n      %w(Marketing Dev Support).each do |project|\n        with_tag \"li a\", {:href =\u003e /projects\\/#{project}/}, :text =\u003e project, :exactly =\u003e 1\n      end\n    end\n\n    response.should have_tag :form, :action =\u003e signup_path, :method =\u003e :post do\n      with_tag :input, :type =\u003e :text, :name =\u003e :email\n      with_tag :input, :type =\u003e :password, :name =\u003e :password\n      with_tag :input, :type =\u003e :submit\n    end\n\n# Todos\n\n- make at_least and at_most work together\n- keep on improving error reporting\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcppforlife%2Fhave_tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcppforlife%2Fhave_tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcppforlife%2Fhave_tag/lists"}