Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/robotex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def initialize(uri, user_agent)
arr = line.split(":")
key = arr.shift
value = arr.join(":").strip
value.strip!
value.gsub!(/\s*#.+$/,'')
case key.downcase
when "user-agent"
agent = to_regex(value)
Expand Down
8 changes: 8 additions & 0 deletions spec/robotex_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

User-Agent: *
Disallow: /login
Disallow: /archive/ #old content
Allow: /

Disallow: /locked
Expand Down Expand Up @@ -65,6 +66,13 @@
robotex.allowed?(SPEC_DOMAIN + 'locked').should be_false
end
end

context 'when a rule includes a comment' do
it 'returns false' do
robotex = Robotex.new
robotex.allowed?(SPEC_DOMAIN + 'archive/old').should be_false
end
end
end

describe '#delay' do
Expand Down