2

これはstackoverflowのどこかで答えられていると確信していますが、私の人生では、自分の状況がすでに書かれているものと異なる理由を見つけることができないので、ここに行きます.

カピバラでrspecを使う

  1) report_cards#index must have 'Report Cards Index'
 Failure/Error: visit '/'
 NoMethodError:
   undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_4:0x007fcc3aa33960>
 # ./spec/views/report_cards_view_spec.rb:7:in `block (2 levels) in <top (required)>'

/spec/views/report_cards_view_spec.rb は次のようになります

require 'spec_helper'
describe "report_cards#index" do
  it "must have 'Report Cards Index'" do
  visit '/'
  page.should have_content("something")
  end
end

spec_helper.rb の一番上の行は次のようになります

ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/rspec'

gemfileは次のようになります

`source 'https://rubygems.org'`
gem 'rails', '3.2.7'
gem 'jquery-rails'
gem 'pg', '~> 0.14.0'
gem 'devise', '~> 2.1.2'
gem "quiet_assets", "~> 1.0.1"
gem 'thin'
gem 'bourbon'
gem "haml-rails"
gem "httparty", "~> 0.8.3"
gem "activerecord-import", "~> 0.2.10"

group :test, :development do
  gem "rspec-rails", "~> 2.0"
  gem 'capybara', '~>1.1.2'
  gem "fabrication", "~> 2.2.0"
  gem "launchy", "~> 2.1.2"
end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end`

私はかなり後輩なので、気楽に行きましょう :) - THX !


ant ビルド スクリプトは、コマンド ラインを使用して Windows で実行されません

私は ant スクリプトを作成しました。これは正常に実行され、Eclipse で使用すると .jar ファイルが生成されます。しかし、Windows XP のコマンド プロンプトで使用すると、正常に表示されますが、何も起こりません。ant は適切に構成されており、他の ant スクリプトも実行できます。

これが私のbuild.xmlファイルです

<?xml version="1.0"?>
<project name="TaskNodeBundle" basedir=".">
    <!-- Sets variables which can later be used. -->
    <!-- The value of a property is accessed via ${} -->
    <property name="bundlename" value="task-node-bundle" />
    <property name="src.dir" location="../src" />
    <property name="lib.dir" location="../lib" />
    <property name="build.dir" location="/buildoutput" />
    <property name="build.dest" location="build/dest" />


    <!--
    Create a classpath container which can be later used in the ant task
  -->
    <path id="classpath">
        <fileset dir="${lib.dir}/">
            <include name="*.jar" />

        </fileset>
    </path>

    <target name="clean">
            <delete dir="${build.dir}" />
            <delete dir="${build.dest}" />
    </target>


    <!-- Deletes the existing build directory-->
    <target name="mkdir" depends="clean">
            <mkdir dir="${build.dest}"/>
    </target>


<!-- Compiles the java code -->
    <target name="compile" depends="mkdir">
        <javac srcdir="${src.dir}" destdir="${build.dest}" classpathref="classpath" />
    </target>

    <target name="package-bundle" depends="compile" description="Generates the bundle">
        <jar destfile="${dist.dir}/${bundlename}.jar">
            <fileset dir="${src.dir}">
                <include name="**/**.class" />
                <include name="**/**.properties"/>
                <include name="/META-INF/**.*" />
                <include name="/META-INF/spring/**.*" />
            </fileset>

        </jar>
    </target>


</project>
4

2 に答える 2

4

カピバラはビューの仕様には含まれておらず、統合テスト用です。

spec ファイルを spec/requests ディレクトリに移動してみてください

于 2012-08-30T05:20:28.027 に答える