I want to test that something receives #var from inside the block.
I realize this might be a code smell.
something = Struct.new(:var).new
some_method do
something.var| # == Paperclip without ActiveRecord | |
| # | |
| # Original: https://gist.github.com/basgys/5712426 | |
| require 'active_model/naming' | |
| require 'active_model/callbacks' | |
| require 'active_model/validations' | |
| require 'paperclip' | |
| require 'paperclip/glue' |
| This is a comparision of handling JavaScript alert/confirm/prompt notifications with Capybara. | |
| Proposed consolidated API in Capybara: | |
| There are two styles of notification handling: proactive or reactive. | |
| - Proactive is used in headless environments to queue up responses. | |
| - Reactive is used in environments with actual notifications that mandate a response (eg selenium). | |
| alert - # Reactive | |
| page.driver.accept_alert |
| 0 enumerator.so | |
| 1 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.4.0/enc/encdb.bundle | |
| 2 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.4.0/enc/trans/transdb.bundle | |
| 3 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb | |
| 4 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.4.0/rbconfig.rb | |
| 5 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb | |
| 6 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb | |
| 7 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb | |
| 8 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb | |
| 9 /Users/Mike/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/version.rb |
| class BinaryPlus | |
| def initialize(first, second) | |
| @first, @second = first, second | |
| # to_s accepts a base to convert to. In this case, base 2. | |
| @first_bin = @first.to_s(2) | |
| @second_bin = @second.to_s(2) | |
| normalize | |
| end | |
| def + |
| # app/something/parent.rb | |
| class Parent | |
| def path | |
| __FILE__ | |
| end | |
| end | |
| # app/something/child.rb | |
| class Child < Parent; end |
| function SomeClass() {} | |
| SomeClass.prototype.do_it = function() { alert('doin it!'); } | |
| s = new SomeClass(); | |
| function Decorator(klass) { this.__proto__ = klass.__proto__; } | |
| d = new Decorator(s) | |
| d.do_it() |
| class RailsTextPostRenderer | |
| def initialize(context) | |
| @context = context | |
| end | |
| def render(model) | |
| @context.render(partial: "/posts/text_body", locals: {post: model}) | |
| end | |
| end |
| rake sunspot:solr:start |
| rails g sunspot_rails:install |