非常に小さな作りたてのRails 3アプリケーションがあります。Rails の RubyCAS-Client gem を使用して、CAS サーバーに対して認証を行っています。Web アプリケーションにログインおよびログアウトできるため、CAS クライアントは機能しています。
これが私のGemfileです:
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'mysql2'
gem 'jquery-rails'
gem 'nifty-generators'
# Deploy with Capistrano
# gem 'capistrano'
gem 'rubycas-client'
gem 'rubycas-client-rails', :git => "git://github.com/zuk/rubycas-client-rails.git"
group :development, :test do
gem 'unicorn'
gem 'capybara'
gem 'cucumber'
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'rspec'
gem 'rspec-rails'
gem 'launchy'
gem 'webrat'
end
これが私のキュウリのものです:
# feature file
Feature: Manage generic_pages
In order to view pages that are in the base controller(generic)
I want to visit them and see that they work
Scenario: Visit the home page
Given I am on the home page
Given I am logged in
Then I should see "Submit a nomination"
And I should see "Nominee's name"
And I should see "What are you nominating them for?"
And I should see "Why are you nominating them for this award?"
# cas-client steps
Given /^I am logged_in$/ do
CASClient::Frameworks::Rails::Filter.fake("homer")
end
私が得るエラーは次のとおりです。
Given I am logged_in # features/step_definitions/casclient_steps.rb:1
uninitialized constant CASClient::Frameworks (NameError)
./features/step_definitions/casclient_steps.rb:2:in `/^I am logged_in$/'
features/manage_nominations.feature:9:in `Given I am logged_in'
すべてのステップに合格します(Casログイン要件をすべて削除した場合)。casclient gem の「require」行を追加すると、「ログイン」ステップも成功しますが、残りのステップは失敗します。何らかの理由で、Cucumber が Gemfile から適切な gem を読み込んでいないため、その環境で CASClient モジュールを使用できないようです。必要な行をごまかすことは、問題の回避策のようなものですが、実際には、即時のエラー以外は何も修正しません。
偽のフィルターは、Cucumber とその同類を使用してこれをテストする方法です。これが機能しない理由がわかりません。