SORU
24 Mayıs 2011, Salı


tek bir test çalıştırmak için nasıl rspec?

İnternet her türlü mevcut ama hiçbiri bulundu ve tek bir test çalıştırmak için nasıl göstermek zorundayım.

Aşağıdaki dosya var:

/spec/controllers/groups_controller_spec.rb

Ne komut terminalde sadece spec çalıştırmak için kullanabilirim ve ne dir komutu çalıştırabilirim?

Mücevherim dosya:

# Test ENVIRONMENT GEMS
group :development, :test do
    gem "autotest"
    gem "rspec-rails", "~> 2.4"
    gem "cucumber-rails", ">=0.3.2"
    gem "webrat", ">=0.7.2"
    gem 'factory_girl_rails'
    gem 'email_spec'
end

dosya spec

require 'spec_helper'

describe GroupsController do
  include Devise::TestHelpers

  describe "GET yourgroups" do
    it "should be successful and return 3 items" do

      Rails.logger.info 'HAIL MARRY'

      get :yourgroups, :format => :json
      response.should be_success
      body = JSON.parse(response.body)
      body.should have(3).items # @user1 has 3 permissions to 3 groups
    end
  end
end

CEVAP
24 Mayıs 2011, Salı


Genellikle öyle yaparım:

rspec /spec/controllers/groups_controller_spec.rb:42

42 test hattı gösterir çalıştırmak istiyorum.

EDİT1:

Ayrıca etiketleri kullanabilirsiniz. here bkz.

EDİT 2:

Deneyin:

bundle exec rspec /spec/controllers/groups_controller_spec.rb:42

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Ampisound

    Ampisound

    12 Kasım 2006
  • circuschina

    circuschina

    16 Mart 2007
  • Kindness

    Kindness

    23 Ocak 2006