Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-08-30 15:04:02 +0300
committerLin Jen-Shin <godfat@godfat.org>2018-09-11 13:45:49 +0300
commitd7f87a2bc9b9638285eb85b50957879c8599a6b9 (patch)
tree85bbd0d169df4170e90778d1ebd4cd91d3037c95 /spec/lib/gitlab/patch/prependable_spec.rb
parent517ee9fd04048ee82a22c4398f068a502c1357bf (diff)
Absorb the old tests
Diffstat (limited to 'spec/lib/gitlab/patch/prependable_spec.rb')
-rw-r--r--spec/lib/gitlab/patch/prependable_spec.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/lib/gitlab/patch/prependable_spec.rb b/spec/lib/gitlab/patch/prependable_spec.rb
index 32222544e46..b902f174c6d 100644
--- a/spec/lib/gitlab/patch/prependable_spec.rb
+++ b/spec/lib/gitlab/patch/prependable_spec.rb
@@ -118,4 +118,54 @@ describe Gitlab::Patch::Prependable do
expect(prepended_modules).to eq([[subject, ee]])
end
end
+
+ describe 'simple case' do
+ subject do
+ foo_ = foo
+
+ Class.new do
+ prepend foo_
+
+ def value
+ 10
+ end
+ end
+ end
+
+ let(:foo) do
+ Module.new do
+ extend ActiveSupport::Concern
+
+ prepended do
+ def self.class_value
+ 20
+ end
+ end
+
+ def value
+ super * 10
+ end
+ end
+ end
+
+ 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(20)
+ 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
+ end
end