Sha256: 9b5bba16f691fe4948eb6cedd7b0ecfb20bfd68feb8f6e6f68fa68c065e8b52f

Contents?: true

Size: 605 Bytes

Versions: 22

Compression:

Stored size: 605 Bytes

Contents

RSpec::Matchers.define :have_column do |column_name|
  chain :with_default do |default|
    @default = default
  end

  match do |columns|
    column = columns.detect{|column| column.name == column_name }
    column && column.default.to_s == @default.to_s
  end

  failure_message_method =
    if RSpec::Version::STRING.to_i >= 3
      :failure_message
    else
      :failure_message_for_should
    end

  send(failure_message_method) do |columns|
    "expected to find '#{column_name}', " +
      "default '#{@default}' " +
      "in #{columns.map { |column| [column.name, column.default] }}"
  end
end

Version data entries

22 entries across 22 versions & 5 rubygems

Version Path
kt-paperclip-5.4.0 spec/support/matchers/have_column.rb
kt-paperclip-4.4.0 spec/support/matchers/have_column.rb
paperclip-6.1.0 spec/support/matchers/have_column.rb
paperclip-6.0.0 spec/support/matchers/have_column.rb
paperclip-5.3.0 spec/support/matchers/have_column.rb
paperclip-5.2.1 spec/support/matchers/have_column.rb
paperclip-5.2.0 spec/support/matchers/have_column.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paperclip-5.1.0/spec/support/matchers/have_column.rb
paperclip-5.1.0 spec/support/matchers/have_column.rb
paperclip-5.0.0 spec/support/matchers/have_column.rb
paperclip-4.3.7 spec/support/matchers/have_column.rb
paperclip_jk-5.0.0.beta2 spec/support/matchers/have_column.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/paperclip-4.3.6/spec/support/matchers/have_column.rb
paperclip-5.0.0.beta2 spec/support/matchers/have_column.rb
paperclip-5.0.0.beta1 spec/support/matchers/have_column.rb
paperclip-4.3.6 spec/support/matchers/have_column.rb
paperclip-4.3.5 spec/support/matchers/have_column.rb
paperclip-4.3.4 spec/support/matchers/have_column.rb
paperclip-4.3.3 spec/support/matchers/have_column.rb
paperclip-4.3.2 spec/support/matchers/have_column.rb