Sha256: 1f405eb576ca0d728d7280ffa3e1748a51c264892c091c11b72497d3e42ff51c
Contents?: true
Size: 834 Bytes
Versions: 1
Compression:
Stored size: 834 Bytes
Contents
module EASpecHelpers def new_book data = {} data = {name: random_string, about: random_string}.merge(data) item = Book.create(data) item_id = item[:id].to_i check(item_id) > 0 [item, item_id] end def count_books conditions = nil args = conditions ? [{conditions: conditions}] : [] RearORM.new(Book).count *args end def extract_elements selector = nil selector ||= last_request.env['PATH_INFO'] =~ /\/+edit\/+\d+/ ? '.editor-column_value' : '.pane-column_value' doc = Nokogiri::HTML(last_response.body) columns = doc.css(selector) columns end def readonly_error? last_response is(last_response).client_error? does(last_response.body) =~ /readonly/i end def random_string ('A'..'Z').to_a.sample(5).join + [rand.to_s, rand.to_s].sample end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rear-0.2.0 | test/helpers.rb |