spec/attribute_spec.rb in attributor-7.1 vs spec/attribute_spec.rb in attributor-8.0
- old
+ new
@@ -271,11 +271,11 @@
expect(values).to include subject.example
end
end
context 'deterministic examples' do
- let(:example) { /\w+/ }
+ let(:example) { proc { Faker::Lorem.word } }
let(:attribute_options) { { example: example } }
it 'can take a context to pre-seed the random number generator' do
example_1 = subject.example(['context'])
example_2 = subject.example(['context'])
@@ -328,33 +328,9 @@
context 'with an integer' do
let(:type) { Attributor::Integer }
let(:example) { 5 }
it { should be example }
- end
-
- context 'with a regexp' do
- let(:example) { Regexp.new(/\w+/) }
- let(:generated_example) { /\w+/.gen }
-
- it 'calls #gen on the regexp' do
- expect(example).to receive(:gen).and_return(generated_example)
-
- expect(example_result).to match example
- end
-
- context 'for a type with a non-String native_type' do
- let(:type) { Attributor::Integer }
- let(:example) { Regexp.new(/\d{5}/) }
- let(:generated_example) { /\d{5}/.gen }
-
- it 'coerces the example value properly' do
- expect(example).to receive(:gen).and_return(generated_example)
- expect(type).to receive(:load).and_call_original
-
- expect(example_result).to be_kind_of(type.native_type)
- end
- end
end
context 'with a proc' do
let(:parent) { Object.new }