spec/support/shared_examples/base_operations.rb in danica-2.3.0 vs spec/support/shared_examples/base_operations.rb in danica-2.3.1
- old
+ new
@@ -1,6 +1,6 @@
-shared_examples 'an object with basic operation' do |operations:%i(+ - * /), ignore:[]|
+shared_examples 'an object with basic operation' do |operations:%i(+ - * / **), ignore:[]|
(operations - [ ignore ].flatten).each do |operation|
it_behaves_like "an object with #{operation} operation"
end
end
@@ -70,8 +70,23 @@
expect(result).to include(negative_other)
end
it 'includes the subject as parcel' do
expect(result).to include(subject_included)
+ end
+end
+
+shared_examples 'an object with ** operation' do
+ let(:other) { 104 }
+ let(:result) { subject ** other }
+
+ it { expect(result).to be_a(Danica::Operator::Power) }
+
+ it 'sets the subject as base' do
+ expect(result.base).to eq(subject)
+ end
+
+ it 'sets the other as exponent' do
+ expect(result.exponent).to eq(Danica::Wrapper::Number.new(other))
end
end