mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge branch 'master' of git://github.com/rails/rails
This commit is contained in:
4
Gemfile
4
Gemfile
@@ -14,6 +14,7 @@ gem "rack-test", :git => "git://github.com/brynary/rack-test.git"
|
||||
gem "sprockets", :git => "git://github.com/sstephenson/sprockets.git"
|
||||
gem "coffee-script"
|
||||
gem "sass", ">= 3.0"
|
||||
gem "uglifier"
|
||||
|
||||
gem "rake", ">= 0.8.7"
|
||||
gem "mocha", ">= 0.9.8"
|
||||
@@ -26,7 +27,6 @@ end
|
||||
|
||||
# AS
|
||||
gem "memcache-client", ">= 1.8.5"
|
||||
gem "fssm", "~> 0.2.5"
|
||||
|
||||
platforms :mri_18 do
|
||||
gem "system_timer"
|
||||
@@ -52,7 +52,7 @@ platforms :ruby do
|
||||
gem "sqlite3", "~> 1.3.3"
|
||||
|
||||
group :db do
|
||||
gem "pg", ">= 0.9.0"
|
||||
gem "pg", ">= 0.11.0"
|
||||
gem "mysql", ">= 2.8.1"
|
||||
gem "mysql2", :git => "git://github.com/brianmario/mysql2.git"
|
||||
end
|
||||
|
||||
@@ -118,7 +118,15 @@ module ActionDispatch # :nodoc:
|
||||
|
||||
def body=(body)
|
||||
@blank = true if body == EMPTY
|
||||
@body = body.respond_to?(:each) ? body : [body]
|
||||
|
||||
# Explicitly check for strings. This is *wrong* theoretically
|
||||
# but if we don't check this, the performance on string bodies
|
||||
# is bad on Ruby 1.8 (because strings responds to each then).
|
||||
@body = if body.respond_to?(:to_str) || !body.respond_to?(:each)
|
||||
[body]
|
||||
else
|
||||
body
|
||||
end
|
||||
end
|
||||
|
||||
def body_parts
|
||||
|
||||
@@ -50,7 +50,7 @@ module ActionDispatch
|
||||
# Only this middleware cares about RoutingError. So, let's just raise
|
||||
# it here.
|
||||
if headers['X-Cascade'] == 'pass'
|
||||
raise ActionController::RoutingError, "No route matches #{env['PATH_INFO'].inspect}"
|
||||
raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"
|
||||
end
|
||||
rescue Exception => exception
|
||||
raise exception if env['action_dispatch.show_exceptions'] == false
|
||||
|
||||
@@ -42,7 +42,7 @@ module ActionDispatch
|
||||
elsif type.is_a?(Symbol) && @response.response_code == Rack::Utils::SYMBOL_TO_STATUS_CODE[type]
|
||||
assert_block("") { true } # to count the assertion
|
||||
else
|
||||
assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false }
|
||||
assert(false, build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -33,9 +33,10 @@ module Sprockets
|
||||
|
||||
app.assets = asset_environment(app)
|
||||
|
||||
# FIXME: Temp hack for extending Sprockets::Context so
|
||||
ActiveSupport.on_load(:action_view) do
|
||||
::Sprockets::Context.send :include, ::ActionView::Helpers::SprocketsHelper
|
||||
app.assets.context.instance_eval do
|
||||
include ::ActionView::Helpers::SprocketsHelper
|
||||
end
|
||||
end
|
||||
|
||||
app.routes.append do
|
||||
@@ -56,7 +57,44 @@ module Sprockets
|
||||
env.static_root = File.join(app.root.join("public"), assets.prefix)
|
||||
env.paths.concat assets.paths
|
||||
env.logger = Rails.logger
|
||||
env.js_compressor = expand_js_compressor(assets.js_compressor)
|
||||
env.css_compressor = expand_css_compressor(assets.css_compressor)
|
||||
env
|
||||
end
|
||||
|
||||
def expand_js_compressor(sym)
|
||||
case sym
|
||||
when :closure
|
||||
require 'closure-compiler'
|
||||
Closure::Compiler.new
|
||||
when :uglifier
|
||||
require 'uglifier'
|
||||
Uglifier.new
|
||||
when :yui
|
||||
require 'yui/compressor'
|
||||
YUI::JavaScriptCompressor.new
|
||||
else
|
||||
sym
|
||||
end
|
||||
end
|
||||
|
||||
def expand_css_compressor(sym)
|
||||
case sym
|
||||
when :scss
|
||||
require 'sass'
|
||||
compressor = Object.new
|
||||
def compressor.compress(source)
|
||||
Sass::Engine.new(source,
|
||||
:syntax => :scss, :style => :compressed
|
||||
).render
|
||||
end
|
||||
compressor
|
||||
when :yui
|
||||
require 'yui/compressor'
|
||||
YUI::JavaScriptCompressor.new(:munge => true)
|
||||
else
|
||||
sym
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,6 +55,13 @@ module ActiveRecord
|
||||
def exec_query(sql, name = 'SQL', binds = [])
|
||||
end
|
||||
|
||||
# Executes insert +sql+ statement in the context of this connection using
|
||||
# +binds+ as the bind substitutes. +name+ is the logged along with
|
||||
# the executed +sql+ statement.
|
||||
def exec_insert(sql, name, binds)
|
||||
exec_query(sql, name, binds)
|
||||
end
|
||||
|
||||
# Returns the last auto-generated ID from the affected table.
|
||||
#
|
||||
# +id_value+ will be returned unless the value is nil, in
|
||||
|
||||
@@ -223,7 +223,9 @@ module ActiveRecord
|
||||
rescue Exception => e
|
||||
message = "#{e.class.name}: #{e.message}: #{sql}"
|
||||
@logger.debug message if @logger
|
||||
raise translate_exception(e, message)
|
||||
exception = translate_exception(e, message)
|
||||
exception.set_backtrace e.backtrace
|
||||
raise exception
|
||||
end
|
||||
|
||||
def translate_exception(e, message)
|
||||
|
||||
@@ -432,10 +432,6 @@ module ActiveRecord
|
||||
end
|
||||
end
|
||||
|
||||
def exec_insert(sql, name, binds)
|
||||
exec_query(sql, name, binds)
|
||||
end
|
||||
|
||||
def last_inserted_id(result)
|
||||
@connection.insert_id
|
||||
end
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
require 'active_record/connection_adapters/abstract_adapter'
|
||||
require 'active_support/core_ext/kernel/requires'
|
||||
require 'active_support/core_ext/object/blank'
|
||||
|
||||
# Make sure we're using pg high enough for PGResult#values
|
||||
gem 'pg', '~> 0.11'
|
||||
require 'pg'
|
||||
|
||||
module ActiveRecord
|
||||
@@ -462,42 +465,43 @@ module ActiveRecord
|
||||
# create a 2D array representing the result set
|
||||
def result_as_array(res) #:nodoc:
|
||||
# check if we have any binary column and if they need escaping
|
||||
unescape_col = []
|
||||
res.nfields.times do |j|
|
||||
unescape_col << res.ftype(j)
|
||||
ftypes = Array.new(res.nfields) do |i|
|
||||
[i, res.ftype(i)]
|
||||
end
|
||||
|
||||
ary = []
|
||||
res.ntuples.times do |i|
|
||||
ary << []
|
||||
res.nfields.times do |j|
|
||||
data = res.getvalue(i,j)
|
||||
case unescape_col[j]
|
||||
rows = res.values
|
||||
return rows unless ftypes.any? { |_, x|
|
||||
x == BYTEA_COLUMN_TYPE_OID || x == MONEY_COLUMN_TYPE_OID
|
||||
}
|
||||
|
||||
# unescape string passed BYTEA field (OID == 17)
|
||||
when BYTEA_COLUMN_TYPE_OID
|
||||
data = unescape_bytea(data) if String === data
|
||||
typehash = ftypes.group_by { |_, type| type }
|
||||
binaries = typehash[BYTEA_COLUMN_TYPE_OID] || []
|
||||
monies = typehash[MONEY_COLUMN_TYPE_OID] || []
|
||||
|
||||
# If this is a money type column and there are any currency symbols,
|
||||
# then strip them off. Indeed it would be prettier to do this in
|
||||
# PostgreSQLColumn.string_to_decimal but would break form input
|
||||
# fields that call value_before_type_cast.
|
||||
when MONEY_COLUMN_TYPE_OID
|
||||
# Because money output is formatted according to the locale, there are two
|
||||
# cases to consider (note the decimal separators):
|
||||
# (1) $12,345,678.12
|
||||
# (2) $12.345.678,12
|
||||
case data
|
||||
when /^-?\D+[\d,]+\.\d{2}$/ # (1)
|
||||
data.gsub!(/[^-\d.]/, '')
|
||||
when /^-?\D+[\d.]+,\d{2}$/ # (2)
|
||||
data.gsub!(/[^-\d,]/, '').sub!(/,/, '.')
|
||||
end
|
||||
rows.each do |row|
|
||||
# unescape string passed BYTEA field (OID == 17)
|
||||
binaries.each do |index, _|
|
||||
row[index] = unescape_bytea(row[index])
|
||||
end
|
||||
|
||||
# If this is a money type column and there are any currency symbols,
|
||||
# then strip them off. Indeed it would be prettier to do this in
|
||||
# PostgreSQLColumn.string_to_decimal but would break form input
|
||||
# fields that call value_before_type_cast.
|
||||
monies.each do |index, _|
|
||||
data = row[index]
|
||||
# Because money output is formatted according to the locale, there are two
|
||||
# cases to consider (note the decimal separators):
|
||||
# (1) $12,345,678.12
|
||||
# (2) $12.345.678,12
|
||||
case data
|
||||
when /^-?\D+[\d,]+\.\d{2}$/ # (1)
|
||||
data.gsub!(/[^-\d.]/, '')
|
||||
when /^-?\D+[\d.]+,\d{2}$/ # (2)
|
||||
data.gsub!(/[^-\d,]/, '').sub!(/,/, '.')
|
||||
end
|
||||
ary[i] << data
|
||||
end
|
||||
end
|
||||
return ary
|
||||
end
|
||||
|
||||
|
||||
@@ -554,10 +558,6 @@ module ActiveRecord
|
||||
end
|
||||
end
|
||||
|
||||
def exec_insert(sql, name, binds)
|
||||
exec_query(sql, name, binds)
|
||||
end
|
||||
|
||||
def sql_for_insert(sql, pk, id_value, sequence_name, binds)
|
||||
unless pk
|
||||
_, table = extract_schema_and_table(sql.split(" ", 4)[2])
|
||||
@@ -935,10 +935,7 @@ module ActiveRecord
|
||||
order_columns.delete_if { |c| c.blank? }
|
||||
order_columns = order_columns.zip((0...order_columns.size).to_a).map { |s,i| "#{s} AS alias_#{i}" }
|
||||
|
||||
# Return a DISTINCT clause that's distinct on the columns we want but includes
|
||||
# all the required columns for the ORDER BY to work properly.
|
||||
sql = "DISTINCT ON (#{columns}) #{columns}, "
|
||||
sql << order_columns * ', '
|
||||
"DISTINCT #{columns}, #{order_columns * ', '}"
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
@@ -178,10 +178,6 @@ module ActiveRecord
|
||||
end
|
||||
end
|
||||
|
||||
def exec_insert(sql, name, binds)
|
||||
exec_query(sql, name, binds)
|
||||
end
|
||||
|
||||
def last_inserted_id(result)
|
||||
@connection.last_insert_row_id
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
substitutes.each_with_index do |tuple, i|
|
||||
tuple[1] = conn.substitute_at(tuple.first, i)
|
||||
tuple[1] = conn.substitute_at(binds[i][0], i)
|
||||
end
|
||||
|
||||
if values.empty? # empty insert
|
||||
|
||||
@@ -246,6 +246,8 @@ module ActiveRecord
|
||||
orders = relation.order_values
|
||||
values = @klass.connection.distinct("#{@klass.connection.quote_table_name table_name}.#{primary_key}", orders)
|
||||
|
||||
relation = relation.dup
|
||||
|
||||
ids_array = relation.select(values).collect {|row| row[primary_key]}
|
||||
ids_array.empty? ? raise(ThrowResult) : table[primary_key].in(ids_array)
|
||||
end
|
||||
|
||||
@@ -170,6 +170,16 @@ class EagerAssociationTest < ActiveRecord::TestCase
|
||||
assert_equal [comment], category.posts[0].comments
|
||||
end
|
||||
end
|
||||
|
||||
def test_associations_loaded_for_all_records
|
||||
post = Post.create!(:title => 'foo', :body => "I like cars!")
|
||||
comment = SpecialComment.create!(:body => 'Come on!', :post => post)
|
||||
first_category = Category.create! :name => 'First!', :posts => [post]
|
||||
second_category = Category.create! :name => 'Second!', :posts => [post]
|
||||
|
||||
categories = Category.where(:id => [first_category.id, second_category.id]).includes(:posts => :special_comments)
|
||||
assert_equal categories.map { |category| category.posts.first.special_comments.loaded? }, [true, true]
|
||||
end
|
||||
|
||||
def test_finding_with_includes_on_has_many_association_with_same_include_includes_only_once
|
||||
author_id = authors(:david).id
|
||||
|
||||
@@ -42,7 +42,6 @@ module ActiveSupport
|
||||
|
||||
autoload :DescendantsTracker
|
||||
autoload :FileUpdateChecker
|
||||
autoload :FileWatcher
|
||||
autoload :LogSubscriber
|
||||
autoload :Notifications
|
||||
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
require 'abstract_unit'
|
||||
require 'fssm'
|
||||
require "fileutils"
|
||||
require "timeout"
|
||||
|
||||
|
||||
class FileWatcherTest < ActiveSupport::TestCase
|
||||
class DumbBackend < ActiveSupport::FileWatcher::Backend
|
||||
end
|
||||
|
||||
def setup
|
||||
@watcher = ActiveSupport::FileWatcher.new
|
||||
|
||||
# In real life, the backend would take the path and use it to observe the file
|
||||
# system. In our case, we will manually trigger the events for unit testing,
|
||||
# so we can pass any path.
|
||||
@backend = DumbBackend.new("RAILS_WOOT", @watcher)
|
||||
|
||||
@payload = []
|
||||
@watcher.watch %r{^app/assets/.*\.scss$} do |pay|
|
||||
pay.each do |status, files|
|
||||
files.sort!
|
||||
end
|
||||
@payload << pay
|
||||
end
|
||||
end
|
||||
|
||||
def test_use_triple_equals
|
||||
fw = ActiveSupport::FileWatcher.new
|
||||
called = []
|
||||
fw.watch("some_arbitrary_file.rb") do |file|
|
||||
called << "omg"
|
||||
end
|
||||
fw.trigger(%w{ some_arbitrary_file.rb })
|
||||
assert_equal ['omg'], called
|
||||
end
|
||||
|
||||
def test_one_change
|
||||
@backend.trigger("app/assets/main.scss" => :changed)
|
||||
assert_equal({:changed => ["app/assets/main.scss"]}, @payload.first)
|
||||
end
|
||||
|
||||
def test_multiple_changes
|
||||
@backend.trigger("app/assets/main.scss" => :changed, "app/assets/javascripts/foo.coffee" => :changed)
|
||||
assert_equal([{:changed => ["app/assets/main.scss"]}], @payload)
|
||||
end
|
||||
|
||||
def test_multiple_changes_match
|
||||
@backend.trigger("app/assets/main.scss" => :changed, "app/assets/print.scss" => :changed, "app/assets/javascripts/foo.coffee" => :changed)
|
||||
assert_equal([{:changed => ["app/assets/main.scss", "app/assets/print.scss"]}], @payload)
|
||||
end
|
||||
|
||||
def test_multiple_state_changes
|
||||
@backend.trigger("app/assets/main.scss" => :created, "app/assets/print.scss" => :changed)
|
||||
assert_equal([{:changed => ["app/assets/print.scss"], :created => ["app/assets/main.scss"]}], @payload)
|
||||
end
|
||||
|
||||
def test_more_blocks
|
||||
payload = []
|
||||
@watcher.watch %r{^config/routes\.rb$} do |pay|
|
||||
payload << pay
|
||||
end
|
||||
|
||||
@backend.trigger "config/routes.rb" => :changed
|
||||
assert_equal [:changed => ["config/routes.rb"]], payload
|
||||
assert_equal [], @payload
|
||||
end
|
||||
|
||||
def test_overlapping_watchers
|
||||
payload = []
|
||||
@watcher.watch %r{^app/assets/main\.scss$} do |pay|
|
||||
payload << pay
|
||||
end
|
||||
|
||||
@backend.trigger "app/assets/print.scss" => :changed, "app/assets/main.scss" => :changed
|
||||
assert_equal [:changed => ["app/assets/main.scss"]], payload
|
||||
assert_equal [:changed => ["app/assets/main.scss", "app/assets/print.scss"]], @payload
|
||||
end
|
||||
end
|
||||
|
||||
module FSSM::Backends
|
||||
class Polling
|
||||
def initialize_with_low_latency(options={})
|
||||
initialize_without_low_latency(options.merge(:latency => 0.1))
|
||||
end
|
||||
alias_method_chain :initialize, :low_latency
|
||||
end
|
||||
end
|
||||
|
||||
class FSSMFileWatcherTest < ActiveSupport::TestCase
|
||||
class FSSMBackend < ActiveSupport::FileWatcher::Backend
|
||||
def initialize(path, watcher)
|
||||
super
|
||||
|
||||
monitor = FSSM::Monitor.new
|
||||
monitor.path(path, '**/*') do |p|
|
||||
p.update { |base, relative| trigger relative => :changed }
|
||||
p.delete { |base, relative| trigger relative => :deleted }
|
||||
p.create { |base, relative| trigger relative => :created }
|
||||
end
|
||||
|
||||
@thread = Thread.new do
|
||||
monitor.run
|
||||
end
|
||||
end
|
||||
|
||||
def stop
|
||||
@thread.kill
|
||||
end
|
||||
end
|
||||
|
||||
def setup
|
||||
Thread.abort_on_exception = true
|
||||
|
||||
@payload = []
|
||||
@triggered = false
|
||||
|
||||
@watcher = ActiveSupport::FileWatcher.new
|
||||
|
||||
@path = path = File.expand_path("../tmp", __FILE__)
|
||||
FileUtils.rm_rf path
|
||||
|
||||
create "app/assets/main.scss", true
|
||||
create "app/assets/javascripts/foo.coffee", true
|
||||
create "app/assets/print.scss", true
|
||||
create "app/assets/videos.scss", true
|
||||
|
||||
@backend = FSSMBackend.new(path, @watcher)
|
||||
|
||||
@watcher.watch %r{^app/assets/.*\.scss$} do |pay|
|
||||
pay.each do |status, files|
|
||||
files.sort!
|
||||
end
|
||||
@payload << pay
|
||||
trigger
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
@backend.stop
|
||||
Thread.abort_on_exception = false
|
||||
end
|
||||
|
||||
def create(path, past = false)
|
||||
wait(past) do
|
||||
path = File.join(@path, path)
|
||||
FileUtils.mkdir_p(File.dirname(path))
|
||||
|
||||
FileUtils.touch(path)
|
||||
File.utime(Time.now - 100, Time.now - 100, path) if past
|
||||
end
|
||||
end
|
||||
|
||||
def change(path)
|
||||
wait do
|
||||
FileUtils.touch(File.join(@path, path))
|
||||
end
|
||||
end
|
||||
|
||||
def delete(path)
|
||||
wait do
|
||||
FileUtils.rm(File.join(@path, path))
|
||||
end
|
||||
end
|
||||
|
||||
def wait(past = false)
|
||||
yield
|
||||
return if past
|
||||
|
||||
begin
|
||||
Timeout.timeout(1) do
|
||||
sleep 0.05 until @triggered
|
||||
end
|
||||
rescue Timeout::Error
|
||||
end
|
||||
|
||||
@triggered = false
|
||||
end
|
||||
|
||||
def trigger
|
||||
@triggered = true
|
||||
end
|
||||
|
||||
def test_one_change
|
||||
change "app/assets/main.scss"
|
||||
assert_equal({:changed => ["app/assets/main.scss"]}, @payload.first)
|
||||
end
|
||||
|
||||
def test_multiple_changes
|
||||
change "app/assets/main.scss"
|
||||
change "app/assets/javascripts/foo.coffee"
|
||||
assert_equal([{:changed => ["app/assets/main.scss"]}], @payload)
|
||||
end
|
||||
|
||||
def test_multiple_changes_match
|
||||
change "app/assets/main.scss"
|
||||
change "app/assets/print.scss"
|
||||
change "app/assets/javascripts/foo.coffee"
|
||||
assert_equal([{:changed => ["app/assets/main.scss"]}, {:changed => ["app/assets/print.scss"]}], @payload)
|
||||
end
|
||||
|
||||
def test_multiple_state_changes
|
||||
create "app/assets/new.scss"
|
||||
change "app/assets/print.scss"
|
||||
delete "app/assets/videos.scss"
|
||||
assert_equal([{:created => ["app/assets/new.scss"]}, {:changed => ["app/assets/print.scss"]}, {:deleted => ["app/assets/videos.scss"]}], @payload)
|
||||
end
|
||||
|
||||
def test_more_blocks
|
||||
payload = []
|
||||
@watcher.watch %r{^config/routes\.rb$} do |pay|
|
||||
payload << pay
|
||||
trigger
|
||||
end
|
||||
|
||||
create "config/routes.rb"
|
||||
assert_equal [{:created => ["config/routes.rb"]}], payload
|
||||
assert_equal [], @payload
|
||||
end
|
||||
|
||||
def test_overlapping_watchers
|
||||
payload = []
|
||||
@watcher.watch %r{^app/assets/main\.scss$} do |pay|
|
||||
payload << pay
|
||||
trigger
|
||||
end
|
||||
|
||||
change "app/assets/main.scss"
|
||||
change "app/assets/print.scss"
|
||||
assert_equal [{:changed => ["app/assets/main.scss"]}], payload
|
||||
assert_equal [{:changed => ["app/assets/main.scss"]}, {:changed => ["app/assets/print.scss"]}], @payload
|
||||
end
|
||||
end
|
||||
@@ -35,6 +35,9 @@ module Rails
|
||||
@assets.paths = []
|
||||
@assets.precompile = [ /\w+\.(?!js|css)$/, "application.js", "application.css" ]
|
||||
@assets.prefix = "/assets"
|
||||
|
||||
@assets.js_compressor = nil
|
||||
@assets.css_compressor = nil
|
||||
end
|
||||
|
||||
def compiled_asset_path
|
||||
|
||||
@@ -8,6 +8,7 @@ source 'http://rubygems.org'
|
||||
<%= "gem 'json'\n" if RUBY_VERSION < "1.9.2" -%>
|
||||
gem 'sass', '~> 3.1.0.alpha'
|
||||
gem 'coffee-script'
|
||||
gem 'uglifier'
|
||||
|
||||
# Use unicorn as the web server
|
||||
# gem 'unicorn'
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
# (comment out if your front-end server doesn't support this)
|
||||
config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
|
||||
|
||||
# Compress both stylesheets and JavaScripts
|
||||
config.assets.js_compressor = :uglifier
|
||||
config.assets.css_compressor = :scss
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
# config.force_ssl = true
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ task :default => :test
|
||||
remove_file "doc"
|
||||
remove_file "Gemfile"
|
||||
remove_file "lib/tasks"
|
||||
remove_file "public/images/rails.png"
|
||||
remove_file "app/assets/images/rails.png"
|
||||
remove_file "public/index.html"
|
||||
remove_file "public/robots.txt"
|
||||
remove_file "README"
|
||||
|
||||
@@ -23,7 +23,7 @@ DEFAULT_APP_FILES = %w(
|
||||
lib
|
||||
lib/tasks
|
||||
log
|
||||
public/images
|
||||
app/assets/images
|
||||
script/rails
|
||||
test/fixtures
|
||||
test/functional
|
||||
|
||||
@@ -11,7 +11,7 @@ module RailtiesTest
|
||||
end
|
||||
|
||||
def test_serving_sprockets_assets
|
||||
@plugin.write "app/assets/javascripts/engine.js.coffee", "square = (x) -> x * x"
|
||||
@plugin.write "app/assets/javascripts/engine.js.erb", "<%= :alert %>();"
|
||||
|
||||
boot_rails
|
||||
require 'rack/test'
|
||||
@@ -19,7 +19,7 @@ module RailtiesTest
|
||||
extend Rack::Test::Methods
|
||||
|
||||
get "/assets/engine.js"
|
||||
assert_match "square = function(x) {", last_response.body
|
||||
assert_match "alert();", last_response.body
|
||||
end
|
||||
|
||||
def test_copying_migrations
|
||||
|
||||
Reference in New Issue
Block a user