Say I have a Metal class named Preview. How do I test it with RSpec?
When I try:
require 'spec_helper'
describe Preview do
it "should return the posted content" do
post "/preview", :content => "*title*"
response.body.should == "*title*"
end
end
I get:
undefined method `post' for #<ActiveSupport::TestCase::Subclass_1:0x1058b3098>
It seems that RSpec doesn't load up the :post
method if the test isn't explicitly for a Controller. I've tried specifying :type => :controller
to no avail.