Capybara & Gurke | Erste-cookies

Ich versuche, cookie-Werte in der Gurke Schritt:

Schritt Definitionen

When /^I log in$/ do
  # code to log in
end

Then /^cookies should be set$/ do
  cookies[:author].should_not be_nil
end

Controller

class SessionsController < ApplicationController
  def create
    cookies[:author] = 'me'
    redirect_to authors_path
  end
end

Aber es funktioniert nicht:

Ergebnis

expected: not nil
     got: nil

In der RSpec Beispiele, die alle funktioniert gut:

Controller Spec

require 'spec_helper'

describe SessionsController do
  describe 'create' do
    it 'sets cookies' do
      post :create
      cookies[:author].should_not be_nil
    end
  end
end

Wie kann ich die cookie Werte in Gurke Schritte mit Capybara?

Dank.

Debian GNU/Linux 6.0.4;

Ruby 1.9.3;

Ruby on Rails 3.2.1;

Gurke 1.1.4;

Cucumber-Rails 1.2.1;

Capybara 1.1.2;

Rack-Test-0.6.1.

InformationsquelleAutor Shamaoke | 2012-02-10
Schreibe einen Kommentar