Browse files

bug fix: destructively compact after move

  • Loading branch information...
1 parent 111d7f9 commit 93081fbcd109d8ccb3ae87983075e5f5b99a3aba @moonmaster9000 committed Aug 21, 2012
Showing with 12 additions and 7 deletions.
  1. +1 −0 frill.gemspec
  2. +2 −2 lib/frill/frill.rb
  3. +4 −4 spec/frill_spec.rb
  4. +5 −1 test_frill_rails/Gemfile
View
1 frill.gemspec
@@ -12,4 +12,5 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec"
s.add_development_dependency "rspec-rails"
s.add_development_dependency "capybara"
+ s.add_development_dependency "pry"
end
View
4 lib/frill/frill.rb
@@ -26,7 +26,7 @@ def before decorator
end
def after decorator
- move Frill.decorators.index(decorator) + 1
+ move(Frill.decorators.index(decorator) + 1)
end
def first
@@ -37,7 +37,7 @@ def first
def move index
Frill.decorators.delete self
Frill.decorators.insert index, self
- Frill.decorators.compact
+ Frill.decorators.compact!
end
end
end
View
8 spec/frill_spec.rb
@@ -89,10 +89,10 @@ module Module3
it "inserts the current module after the requested module in Frill's list of decorators" do
Frill.decorators.should == [Module1, Module2, Module3]
- Module2.after Module1
- Module3.after Module1
- Frill.decorators.first.should == Module1
- Frill.decorators.last(2).should =~ [Module2, Module3]
+ Module1.after Module2
+ Module3.after Module2
+ Frill.decorators.first.should == Module2
+ Frill.decorators.last(2).should =~ [Module1, Module3]
end
end
View
6 test_frill_rails/Gemfile
@@ -1,9 +1,13 @@
source 'https://rubygems.org'
-gem 'rails', '~> 3.2.2'
+gem 'rails'
gem 'frill', path: '../'
+group :development, :test do
+ gem 'pry'
+end
+
group :test do
gem 'rspec-rails', '~> 2.8.0'
gem 'capybara'

0 comments on commit 93081fb

Please sign in to comment.