Sha256: b7e0d49395dc738696c0abf304f4495b1da0120fce7eeee0ff8cd70283aa6ca7

Contents?: true

Size: 988 Bytes

Versions: 7

Compression:

Stored size: 988 Bytes

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

%w{
tempfile

sqlite3

murlsh
}.each { |m| require m }

describe Murlsh::Url do

  before do
    @db_file = Tempfile.open('murlsh_test_db')

    db = SQLite3::Database.new(@db_file.path)
    db.execute("CREATE TABLE urls (
      id INTEGER PRIMARY KEY,
      time TIMESTAMP,
      url TEXT,
      email TEXT,
      name TEXT,
      title TEXT,
      content_type TEXT,
      via TEXT);
      ")

    ActiveRecord::Base.establish_connection(:adapter => 'sqlite3',
      :database => @db_file.path)

    @url = Murlsh::Url.new
  end

  after do
    @db_file.close
  end

  it 'should return the url for the title if the title is nil' do
    @url.url = 'http://matthewm.boedicker.org/'
    @url.title = nil

    @url.title.should == @url.url
  end

  it 'should return the url for the title if the title is empty' do
    @url.url = 'http://matthewm.boedicker.org/'
    @url.title = ''

    @url.title.should == @url.url
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
murlsh-1.0.0 spec/url_spec.rb
murlsh-0.11.0 spec/url_spec.rb
murlsh-0.10.0 spec/url_spec.rb
murlsh-0.9.0 spec/url_spec.rb
murlsh-0.8.1 spec/url_spec.rb
murlsh-0.8.0 spec/url_spec.rb
murlsh-0.7.0 spec/url_spec.rb