Skip to content

Instantly share code, notes, and snippets.

@hassox
Forked from shingara/gist:36126
Created December 15, 2008 22:38
Show Gist options
  • Select an option

  • Save hassox/36127 to your computer and use it in GitHub Desktop.

Select an option

Save hassox/36127 to your computer and use it in GitHub Desktop.
#Controller
before :ensure_authenticated, :exclude => [:index, :show]
def new(project_id)
only_provides :html
@ticket = Ticket.new(:project_id => project_id)
display @ticket
end
# RSPEC
describe "resource(Project.first, :tickets, :new)" do
def login(opts = {})
_login = opts[:login] || "foo"
_password = opts[:password] || "sekrit"
request("/login", :method => "PUT", :params => { :login => _login, :password => _password})
end
before(:each) do
login
@response = request(resource(Project.first, :tickets, :new))
end
it "responds successfully" do
@response.status.should == 401
#TEST more than status ?
# @response.should render(Merb::Controller::Unauthenticate)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment