Sha256: 6e9e0a80291e153725f8e2c8f88796d08d3c2096de596d5079da1a366bc6d71b

Contents?: true

Size: 833 Bytes

Versions: 22

Compression:

Stored size: 833 Bytes

Contents

require 'cypress_on_rails/simple_rails_factory'

RSpec.describe CypressOnRails::SimpleRailsFactory do
  subject { CypressOnRails::SimpleRailsFactory }

  class AppRecord
    def self.create!(*)
    end
  end

  before { allow(AppRecord).to receive(:create!) }

  it do
    subject.create('AppRecord', { my_args: 'Hello World' })

    expect(AppRecord).to have_received(:create!).with( { my_args: 'Hello World' } )
  end

  it do
    subject.create('AppRecord', 'trait', { my_args: 'Hello World' })

    expect(AppRecord).to have_received(:create!).with( 'trait', { my_args: 'Hello World' } )
  end

  it do
    subject.create('AppRecord')

    expect(AppRecord).to have_received(:create!).with( { } )
  end

  it do
    expect{ subject.create('UnknownRecord', { my_args: 'Hello World' }) }.
      to raise_error(NameError)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cypress-on-rails-1.17.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.16.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.15.1 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.15.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.14.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.13.1 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.13.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.12.1 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.12.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.11.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.10.1 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.9.1 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.9.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.8.1 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.8.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.7.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.6.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.5.1 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.5.0 spec/cypress_on_rails/simple_rails_factory_spec.rb
cypress-on-rails-1.4.2 spec/cypress_on_rails/simple_rails_factory_spec.rb