Skip to content

Commit

Permalink
Specs for Agent#==
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 28, 2009
1 parent 293b09d commit 135a19d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion History.rdoc
@@ -1,4 +1,4 @@

=== 0.0.1 / YYYY-MM-DD
=== 0.0.1 / 2009-08-28

* Initial release
9 changes: 5 additions & 4 deletions Manifest
@@ -1,14 +1,15 @@
History.rdoc
lib/user-agent/agent.rb
lib/user-agent/map.rb
lib/user-agent/version.rb
lib/user-agent.rb
Manifest
Rakefile
README.rdoc
spec/GEM_spec.rb
spec/agent_spec.rb
spec/agents_spec.rb
spec/spec.opts
spec/spec_helper.rb
tasks/docs.rake
tasks/gemspec.rake
tasks/spec.rake
Todo.rdoc
Manifest
user-agent.gemspec
2 changes: 1 addition & 1 deletion lib/user-agent/agent.rb
Expand Up @@ -70,7 +70,7 @@ def inspect
# Check if the agent is the same as _other_ agent.

def == other
self.string == other.string
string == other.string
end

#--
Expand Down
14 changes: 14 additions & 0 deletions spec/agent_spec.rb
Expand Up @@ -47,4 +47,18 @@
@agent.name.should == :'Safari'
end
end

describe "#==" do
it "should be equal when the user agent strings are the same" do
a = Agent.new 'foo'
b = Agent.new 'foo'
a.should == b
end

it "should not be equal when user agent strings are different" do
a = Agent.new 'foo'
b = Agent.new 'bar'
a.should_not == b
end
end
end
4 changes: 2 additions & 2 deletions user-agent.gemspec
Expand Up @@ -9,8 +9,8 @@ Gem::Specification.new do |s|
s.date = %q{2009-08-28}
s.description = %q{User agent parser}
s.email = %q{tj@vision-media.ca}
s.extra_rdoc_files = ["lib/user-agent/agent.rb", "lib/user-agent/map.rb", "lib/user-agent/version.rb", "lib/user-agent.rb", "README.rdoc", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
s.files = ["History.rdoc", "lib/user-agent/agent.rb", "lib/user-agent/map.rb", "lib/user-agent/version.rb", "lib/user-agent.rb", "Rakefile", "README.rdoc", "spec/GEM_spec.rb", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake", "Todo.rdoc", "Manifest", "user-agent.gemspec"]
s.extra_rdoc_files = ["lib/user-agent/agent.rb", "lib/user-agent/version.rb", "lib/user-agent.rb", "README.rdoc", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
s.files = ["History.rdoc", "lib/user-agent/agent.rb", "lib/user-agent/version.rb", "lib/user-agent.rb", "Manifest", "Rakefile", "README.rdoc", "spec/agent_spec.rb", "spec/agents_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake", "user-agent.gemspec"]
s.homepage = %q{}
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "User-agent", "--main", "README.rdoc"]
s.require_paths = ["lib"]
Expand Down

0 comments on commit 135a19d

Please sign in to comment.