-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Falkén
committed
Apr 1, 2014
1 parent
07a1079
commit 5d698eb
Showing
6 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Dummy | ||
def get_data | ||
'data' | ||
end | ||
|
||
def shared_method | ||
'original' | ||
end | ||
end | ||
|
||
class DummyDecorator < ArtDeco::Decorator | ||
def get_additional_data | ||
'additional data' | ||
end | ||
|
||
def shared_method | ||
'overridden' | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'bundler/setup' | ||
Bundler.setup | ||
require 'art_deco' | ||
|
||
RSpec.configure do |config| | ||
config.color_enabled = true | ||
config.tty = true | ||
config.formatter = :documentation | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'spec_helper' | ||
require 'fixtures/fixtures' | ||
|
||
describe ArtDeco do | ||
|
||
before(:each) do | ||
dummy = Dummy.new | ||
@decorator = DummyDecorator.new(dummy) | ||
end | ||
|
||
it 'exposes components methods' do | ||
expect( @decorator.get_data ).to eq('data') | ||
end | ||
|
||
it 'adds decorator methods' do | ||
expect( @decorator.get_additional_data ).to eq('additional data') | ||
end | ||
|
||
it 'overrides components methods' do | ||
expect( @decorator.shared_method ).to eq('overridden') | ||
end | ||
end |