我跑到gem update --system更新到Rubygems 1.5.0,每次运行任何bundle命令后我得到:
rvm/gems/ruby-1.8.7-p249/gems/bundler-1.0.9/lib/bundler/ui.rb:56: uninitialized constant Gem::SilentUI (NameError)
其他人遇到过这个问题吗?
我运行Cucumber和RSpec测试的rake任务总是使用我的development环境.
以下是相关的配置文件:
RAILS_ROOT/config/environments/cucumber.rb
# Edit at your own peril - it's recommended to regenerate this file
# in the future when you upgrade to a newer version of Cucumber.
# IMPORTANT: Setting config.cache_classes to false is known to
# break Cucumber's use_transactional_fixtures method.
# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching …Run Code Online (Sandbox Code Playgroud) 我最近遇到了"linux stack"和"linux stack size"的错误.我遇到了一个指导我尝试的博客
ulimit -a
Run Code Online (Sandbox Code Playgroud)
看看我的盒子的限制是什么,它被设置为8192kb默认值.
什么是"linux堆栈"?它是如何工作的,它存储了什么,它做了什么?
我的规格
require 'spec_helper'
describe 'user_sessions/new.html.erb' do
let (:user_session) { mock_model(UserSession).as_null_object }
before do
assign(:user_session, user_session)
end
it 'should have the sign in header' do
render
rendered.should contain('Sign in')
end
end
Run Code Online (Sandbox Code Playgroud)
抛出
1)
NoMethodError in 'user_sessions/new.html.erb should have the sign in header'
undefined method `assign' for #<Spec::Rails::Example::ViewExampleGroup::Subclass_1:0x1036835e0>
Run Code Online (Sandbox Code Playgroud)
宝石:
group :test, :cucumber do
gem "cucumber-rails", "0.3.2"
gem "rspec-rails", "1.3.3"
gem "database_cleaner", "0.5.0"
# gem "capybara", "0.3.9"
gem "webrat"
gem "selenium-client", "1.2.18"
gem "sqlite3-ruby", "1.3.1"
gem "email_spec", "~> 0.6.3", :require => 'spec'
gem …Run Code Online (Sandbox Code Playgroud) 我正在尝试为Rails ActionDispatch路由器创建一个类似的路由器,它允许您定义类似的路由
map.get "/foo", :controller => "Foo", :action => "index"
Run Code Online (Sandbox Code Playgroud)
然后将路由GET /foo到FooController#index.有了这个结构,你可以使用像
map.resources :foos
Run Code Online (Sandbox Code Playgroud)
这将调用像
map.get "/foo", :controller => "Foo", :action => "index"
map.get "/foo/:id", :controller => "Foo", :action => "show"
Run Code Online (Sandbox Code Playgroud)
等等.
在D中,我已经能够找出使这项工作所需的许多反身代码,但不是全部.在Ruby中我可以做到:
class Foo
def bar
"FOOO BAR!"
end
end
f = Object.const_get("Foo")
f.new.__send__(:bar) #=> "FOOO BAR!"
Run Code Online (Sandbox Code Playgroud)
我试图翻译成
module foo;
import std.stdio;
class Foo {
void bar() {
writeln("FOO BAR!");
}
}
void main() {
auto foo = Object.factory("foo.Foo");
__traits(getMember, foo, "bar");
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用,因为编译器不知道什么类型foo …
我查看了Google和StackOverflow并且无法弄清楚这一点.
我有一个使用Ruby 1.8.7的Rails 2.3.9应用程序,尝试通过SMTP发送电子邮件,如下所示:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => '25',
:domain => "************.com",
:authentication => :plain,
:user_name => "***********",
:password => "**********"
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序回溯看起来像这样:
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `initialize'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `open'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:67:in `timeout'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:101:in `timeout'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
/Users/jared/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/net/smtp.rb:525:in `start'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:682:in `perform_delivery_smtp'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:523:in `__send__'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:523:in `deliver!'
/Users/jared/.rvm/gems/ruby-1.8.7-p334/gems/actionmailer-2.3.9/lib/action_mailer/base.rb:429:in `deliver'
/Users/jared/rails/********/app/models/user.rb:160:in `send_welcome_email'
/Users/jared/rails/*********/app/controllers/users_controller.rb:35:in `create'
Run Code Online (Sandbox Code Playgroud) 在Ruby中,我可以轻松地在类这样的类上设置读/写属性:
class Bar
attr_accessor :foo, :bizz, :buzz
end
Run Code Online (Sandbox Code Playgroud)
这将是相同的
class Bar
def foo
@foo
end
def foo=(foo)
@foo = foo
end
def bizz
@foo
end
def bizz=(bizz)
@bizz = bizz
end
def buzz
@buzz
end
def buzz=(buzz)
@buzz = buzz
end
end
Run Code Online (Sandbox Code Playgroud)
相同的代码是D非常冗长,我发现自己在各处重复的事情:
class Bar {
private {
string _foo, _bizz, _buzz;
}
@property {
string foo() { return _foo; }
string bizz() { return _bizz; }
string buzz() { return _buzz; }
void foo(string foo) { _foo = foo; …Run Code Online (Sandbox Code Playgroud) ruby ×4
d ×2
rspec ×2
actionmailer ×1
bundler ×1
cucumber ×1
linux ×1
linux-kernel ×1
rake ×1
rspec-rails ×1
rubygems ×1
sendgrid ×1