I have a test that looks like this:
describe ChannelsController, "GET edit" do
it "assigns the greetings summary" do
summary = {:total => 139, :submitted => 97, :published =>
82, :removed => 12}
Greeting.stub(:summary).and_return summary
get :index
assigns(:summary).should eq(summary)
end
end
It fails with the following:
expected {:total=>139, :submitted=>97, :published=>82, :removed=>12}
got {"total"=>139, "submitted"=>97, "published"=>82,
"removed"=>12}
The code that is getting called is this:
# ChannelsController
def index
@summary = Greeting.summary
end
# Greeting
def self.summary
{
:total => self.count,
:submitted => self.submitted.count,
:published => self.published.count,
:removed => self.removed.count
}
end
I expected this example to pass, and I can't figure out if I should be
doing something differently either in the code itself or in the test.
Any insights?
Thanks,
Katrina
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users