spec/unit/lib/web/page_dsl_spec.rb in howitzer-2.0.0 vs spec/unit/lib/web/page_dsl_spec.rb in howitzer-2.0.1
- old
+ new
@@ -40,9 +40,31 @@
let(:scope) { described_class.new(page) { 1 } }
subject { scope.have_content(described_class) }
it { expect(subject.class).to eq(RSpec::Matchers::BuiltIn::Has) }
end
+ context 'when out' do
+ let(:outer_context) do
+ Class.new do
+ def initialize(klass)
+ @klass = klass
+ @a = 5
+ end
+
+ def scope
+ @klass.new(nil) { 1 }
+ end
+
+ def secret
+ '***'
+ end
+ end
+ end
+ let(:scope) { outer_context.new(described_class).scope }
+ it { expect(scope.out(:@a)).to eq(5) }
+ it { expect(scope.out(:secret)).to eq('***') }
+ end
+
context 'when starts other prefix' do
let(:scope) { described_class.new(page) { 1 } }
subject { scope.foo(1, 2, 3) }
before { expect(fake_page).to receive(:foo).with(1, 2, 3) { true } }
it { is_expected.to eq(true) }