Module: MerbExt::SpecCustomMatchers

Defined in:
lib/merb-ext/spec_custom_matchers.rb

Defined Under Namespace

Classes: HaveList, HaveTable

Instance Method Summary collapse

Instance Method Details

#have_header(header) ⇒ Object



7
8
9
# File 'lib/merb-ext/spec_custom_matchers.rb', line 7

def have_header(header)
  ::Webrat::Matchers::HaveXpath.new("//h2[. = '#{header}']")
end

#have_list(list) ⇒ Object



75
76
77
# File 'lib/merb-ext/spec_custom_matchers.rb', line 75

def have_list(list)
  HaveList.new(list)
end

#have_message(message, type = :notice) ⇒ Object



3
4
5
# File 'lib/merb-ext/spec_custom_matchers.rb', line 3

def have_message(message, type = :notice)
  ::Webrat::Matchers::HaveXpath.new("//*[contains(@class, '#{type}')][@id='message'][. = '#{message}']")
end

#have_table(table) ⇒ Object



51
52
53
# File 'lib/merb-ext/spec_custom_matchers.rb', line 51

def have_table(table)
  HaveTable.new(table)
end

#have_table_cell(content) ⇒ Object



11
12
13
# File 'lib/merb-ext/spec_custom_matchers.rb', line 11

def have_table_cell(content)
  ::Webrat::Matchers::HaveXpath.new("//table/tr/td[contains(. ,'#{content}')]")
end

#have_table_header(content) ⇒ Object



15
16
17
# File 'lib/merb-ext/spec_custom_matchers.rb', line 15

def have_table_header(content)
  ::Webrat::Matchers::HaveXpath.new("//table/tr/th[contains(. ,'#{content}')]")
end