是否可以制作window.location.replace或window.location.href使用turbolinks,就像它是一个简单的链接?
可以从字符串中获取嵌套花括号中的所有内容吗?例如:
敏捷的棕色狐狸跳过了懒狗
所以我需要:
从大多数嵌套的顺序来看,这个顺序更好.
我有RSpec可安装的Rails引擎:
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do |example|
DatabaseCleaner.strategy= example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
Run Code Online (Sandbox Code Playgroud)
简单工厂:
FactoryGirl.define do
factory :post, :class => MyEngine::Post do
title 'title'
end
end
Run Code Online (Sandbox Code Playgroud)
水豚特色:
require 'spec_helper'
describe 'Post', :type => :feature do
let(:post) { FactoryGirl.create :post }
it 'index action should have post' do
visit posts_path
expect(page).to have_text(post.title)
end
end
Run Code Online (Sandbox Code Playgroud)
Post模型没有任何验证.
但是当我运行测试时,它表明没有创建帖子.
还有ActiveRecord日志:
INSERT INTO "my_engine_posts" ...
RELEASE SAVEPOINT active_record_1
rollback transaction
Run Code Online (Sandbox Code Playgroud)