-
Notifications
You must be signed in to change notification settings - Fork 27
/
klass_types_spec.rb
53 lines (44 loc) · 1.46 KB
/
klass_types_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
describe Zapata::Revolutionist do
context 'it should work with' do
it 'bare module' do
generated = exec_generation('app/models/testing_module/bare.rb')
expected = expected(%{require 'rails_helper'
describe TestingModule::Bare do
let(:bare) do
TestingModule::Bare.new
end
end})
expect(generated).to eq(expected)
end
it 'nested module' do
generated = exec_generation('app/models/testing_module/nested/inside.rb')
expected = expected(%{require 'rails_helper'
describe TestingModule::Nested::Inside do
let(:inside) do
TestingModule::Nested::Inside.new
end
end})
expect(generated).to eq(expected)
end
context 'klass methods' do
before(:all) do
@generated = exec_generation('app/models/testing_module/klass_methods.rb')
end
it '#defined_with_self' do
has_block('#defined_with_self', %{
expect(TestingModule::KlassMethods.defined_with_self(5)).to eq(5)
})
end
it '#defined_with_back_back_self' do
has_block('#defined_with_back_back_self', %{
expect(TestingModule::KlassMethods.defined_with_back_back_self(5)).to eq(5)
})
end
it '#back_to_public_defined_with_self' do
has_block('#back_to_public_defined_with_self', %{
expect(TestingModule::KlassMethods.back_to_public_defined_with_self(5)).to eq(5)
})
end
end
end
end