Sha256: c1bcfc0989a4a428552e823d7a75aba57f2bf92faac5e6422d34dc10d34eb97f
Contents?: true
Size: 1.3 KB
Versions: 5
Compression:
Stored size: 1.3 KB
Contents
RSpec::Matchers.define :have_column do |name| description do "have a column named #{name}" end chain :with_type do |type| @type = type end chain :with_options do |options| @options = options end match do |report| column = report.columns.select{ |column| column.name == name }.first @has_column = !column.nil? @has_column = ( column.type == @type ) if @type && @has_column @has_column = ( column.options == @options ) if @options && @has_column @has_column end failure_message do |report| message = "expected that report would have a column named #{name}" column = report.columns.select{ |column| column.name == name }.first message << " with type #{@type} but got #{column.type}" if column && column.type != @type message << " with options #{@options} but got #{column.options}" if column && column.options != @options message end failure_message_when_negated do |report| message = "expected that report would not have a column named #{name}" column = report.columns.select{ |column| column.name == name }.first message << " with type #{@type} but got #{column.type}" if column && column.type != @type message << " with options #{@options} but got #{column.options}" if column && column.options != @options message end end
Version data entries
5 entries across 5 versions & 1 rubygems