This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shared_examples_for "blue green yellow" do | |
let(:current_context) { [:blue, :green, :yellow].each {|color| machine.insert color }; machine } | |
end | |
shared_examples_for "small medium large" do | |
let(:current_context) { [:small, :medium, :large].each {|size| machine.press size }; machine } | |
end | |
describe MarbleMachine do | |
let(:machine) { MarbleMachine.new } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
def self.ceo | |
new("Fred") | |
end | |
def self.all_managers | |
[User.new("Wilma")] | |
end | |
def initialize name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awagner:/c/projects/ruby/crafting/templater $ bundle exec rails --version | |
openpath: pathname too long (ignored) | |
Directory "c:/users/awagner" | |
File "rails" | |
bundler: command not found: rails | |
Install missing gem binaries with `bundle install` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Before the rebase: | |
* 66ad91d (origin/master, origin/HEAD, master) don't build the | |
| * 097f260 (HEAD, origin/travis-ci, travis-ci) specify ruby ve | |
| * 7f15aa9 Settup up bundler and the rake tests for travis-ci. | |
|/ | |
* eea1cb5 (origin/fixing_tests, fixing_tests) Getting all rspec | |
* 251ea7d Removed superfluous methods from MethodParameters | |
After: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DepositController < ApplicationController | |
def index | |
@deposit = Deposit.search(search_param) | |
@deposit_presenter = DepositPresenter.new(deposit) | |
end | |
end | |
# this should either be in lib, or in app/presenters or something | |
class DepositPresenter | |
def initialize(search) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code_str = <<RUBY | |
class Foo | |
attr_reader :bar1 | |
attr_reader :bar2 | |
end | |
RUBY | |
smelly_classes = Reek2.parse(code_str) do | |
classes.where do |klass| | |
calls = klass.calls_to(:attr_reader) | |
calls.count > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'reek2' | |
describe "smell detection" do | |
context "attribute" do | |
it "detects when there are 2 attr_readers in one class" do | |
pending | |
code_str = <<RUBY | |
class Foo | |
attr_reader :bar1 | |
attr_reader :bar2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YAML report | |
smell_results = {} | |
smells.each do |smell| | |
smell_results[smell.name] = smell.results | |
end | |
puts y smell_results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reek does this at the top level somewhere | |
# (which means you could define your own smell at the top level somewhere too) | |
smell :duplication do |code| | |
code.methods.where do |method| | |
method.method_calls.where do |call| | |
method.method_calls.where do |call2| | |
call2 == call | |
end.count > 1 | |
end.count > 1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/andrewwagner/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError) | |
from /Users/andrewwagner/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec' | |
from /Users/andrewwagner/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem' | |
from /Users/andrewwagner/.rvm/gems/ruby-1.9.2-p290/bin/bundle:18:in `<main>' | |
new-host-3% |
OlderNewer