Commit ca16681e authored by Kamil Trzcinski's avatar Kamil Trzcinski

Added a Prependable specs

parent 326fdcbf
require 'spec_helper'
describe Prependable do
subject { FooObject }
context 'class methods' do
it "has a method" do
expect(subject).to respond_to(:class_value)
end
it 'can execute a method' do
expect(subject.class_value).to eq(200)
end
end
context 'instance methods' do
it "has a method" do
expect(subject.new).to respond_to(:value)
end
it 'chains a method execution' do
expect(subject.new.value).to eq(100)
end
end
module Foo
extend Prependable
prepended do
def self.class_value
20
end
end
def value
super * 10
end
end
class FooObject
prepend Foo
def value
10
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment