Skip to content

Commit

Permalink
Add specs for float values
Browse files Browse the repository at this point in the history
  • Loading branch information
knu committed Oct 27, 2024
1 parent 90ced07 commit 087bcdd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/models/agents/website_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@
'url' => "http://xkcd.com",
'mode' => "on_change",
'extract' => {
'slogan' => { 'css' => "#slogan", 'value' => ".//text()", 'raw' => true }
'slogan' => { 'css' => "#slogan", 'value' => ".//text()", 'raw' => true },
'slogan_length' => { 'css' => "#slogan", 'value' => "string-length(.)", 'raw' => true },
}
}
rel = Agents::WebsiteAgent.new(name: "xkcd", options: rel_site)
Expand All @@ -747,6 +748,7 @@
rel.check
event = Event.last
expect(event.payload['slogan']).to eq(["A webcomic of romance,", " sarcasm, math, & language."])
expect(event.payload['slogan_length']).to eq(49)
end

it "should return a string value returned by XPath" do
Expand All @@ -757,7 +759,8 @@
'url' => "http://xkcd.com",
'mode' => "on_change",
'extract' => {
'slogan' => { 'css' => "#slogan", 'value' => "string(.)" }
'slogan' => { 'css' => "#slogan", 'value' => "string(.)" },
'slogan_length' => { 'css' => "#slogan", 'value' => "string-length(.)" },
}
}
rel = Agents::WebsiteAgent.new(name: "xkcd", options: rel_site)
Expand All @@ -766,6 +769,7 @@
rel.check
event = Event.last
expect(event.payload['slogan']).to eq("A webcomic of romance, sarcasm, math, & language.")
expect(event.payload['slogan_length']).to eq("49")
end

it "should interpolate _response_" do
Expand Down

0 comments on commit 087bcdd

Please sign in to comment.