Skip to content
Browse files

Improve Job#inspect.

- No spaces around angle brackets--it's very nonstandard to do that for a ruby object.
- Include more info (klass and queue).
  • Loading branch information...
1 parent f5230cb commit f8bd7fce544538d4f5856af5d95dfced1c502179 @myronmarston myronmarston committed Apr 26, 2012
Showing with 17 additions and 1 deletion.
  1. +1 −1 lib/qless/job.rb
  2. +16 −0 spec/unit/job_spec.rb
View
2 lib/qless/job.rb
@@ -75,7 +75,7 @@ def description
end
def inspect
- "< Qless::Job #{@jid} >"
+ "<Qless::Job #{description}>"
end
def ttl
View
16 spec/unit/job_spec.rb
@@ -62,6 +62,22 @@ class MyCustomError < StandardError; end
end
end
end
+
+ describe "#inspect" do
+ let(:job) { Job.build(client, JobClass) }
+
+ it "includes the jid" do
+ job.inspect.should include(job.jid)
+ end
+
+ it "includes the job class" do
+ job.inspect.should include(job.klass)
+ end
+
+ it "includes the job queue" do
+ job.inspect.should include(job.queue)
+ end
+ end
end
end

0 comments on commit f8bd7fc

Please sign in to comment.
Something went wrong with that request. Please try again.