Sha256: 460c07df266baac96f596eaa89664233a225b50704507b8e04b37b3fd5106e38
Contents?: true
Size: 1.43 KB
Versions: 7
Compression:
Stored size: 1.43 KB
Contents
require 'spec_helper' describe Cucumber::Factory::BuildStrategy do subject { Cucumber::Factory::BuildStrategy } # most of the behaviour is integration tested in steps_spec.rb describe '.from_prose' do context 'when describing a factory_bot factory' do it 'returns a strategy corresponding to the factories model' do FactoryBot.stub_factories :job_offer => JobOffer strategy = subject.from_prose('job offer', nil) strategy.should be_a(described_class) strategy.model_class.should == JobOffer end it 'uses the variant for the factory name if present' do FactoryBot.stub_factories :job_offer => JobOffer strategy = subject.from_prose('foo', '(job offer)') strategy.should be_a(described_class) strategy.model_class.should == JobOffer end end context 'when describing a non factory_bot model' do it "should return a strategy for the class matching a natural language expression" do subject.from_prose("movie", nil).model_class.should == Movie subject.from_prose("job offer", nil).model_class.should == JobOffer end it "should ignore variants for the class name" do subject.from_prose("movie", "(job offer)").model_class.should == Movie end it "should allow namespaced models" do subject.from_prose("people/actor", nil).model_class.should == People::Actor end end end end
Version data entries
7 entries across 7 versions & 1 rubygems