From f42ec0a2873786e0c9c110443a7254eee927bd77 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sat, 9 Jun 2012 02:14:48 +0300 Subject: [PATCH] make specs order independed --- .rspec | 1 + spec/draper/base_spec.rb | 4 ++-- spec/generators/decorator/decorator_generator_spec.rb | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.rspec b/.rspec index 4e1e0d2..fdd4d9d 100644 --- a/.rspec +++ b/.rspec @@ -1 +1,2 @@ --color +--order rand diff --git a/spec/draper/base_spec.rb b/spec/draper/base_spec.rb index 3b780b0..c6b2b4d 100755 --- a/spec/draper/base_spec.rb +++ b/spec/draper/base_spec.rb @@ -712,10 +712,10 @@ describe Draper::Base do end context "when #hello_world is called again" do - before { subject.hello_world } it "proxies method directly after first hit" do - subject.should_not_receive(:method_missing) + subject.methods.should_not include(:hello_world) subject.hello_world + subject.methods.should include(:hello_world) end end diff --git a/spec/generators/decorator/decorator_generator_spec.rb b/spec/generators/decorator/decorator_generator_spec.rb index 79336ff..503c77e 100644 --- a/spec/generators/decorator/decorator_generator_spec.rb +++ b/spec/generators/decorator/decorator_generator_spec.rb @@ -45,6 +45,10 @@ describe Rails::Generators::DecoratorGenerator do run_generator ["YourModel"] end + after do + Object.send(:remove_const, :ApplicationDecorator) + end + subject { file('app/decorators/your_model_decorator.rb') } it { should exist } it { should contain "class YourModelDecorator < ApplicationDecorator" }