Sha256: 3c0d2646fb4be66a1216fb3e844debc2539f25fdf7682ce6ff922623056b9ff8

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe LayoutFile do

  before(:all) do
    @file = 'layouts/new_layout1.layout'

    @content = <<-EOF
layout :name1 do
end
    EOF

    create_file @file, @content 

    @full_path = File.join(working_directory, @file )
    @layout_file = LayoutFile.new(@full_path)
  end

  it "returns the path of the layout" do
    expect(@layout_file.path).to eq(@full_path)
  end

  it "returns the content of the layout file" do
    expect(@layout_file.content).to eq(@content)
  end

  it "raises an Error if an unexisting layout file is given" do
    expect {
      LayoutFile.new('invalid path')
    }.to raise_error Exceptions::FileNotFound
  end

  it "let you compare instances by path" do
    file1 = 'layouts/layout1.layout'
    file2 = 'layouts/layout2.layout'

    create_file file1
    create_file file2

    layout_file1 = LayoutFile.new(File.join(working_directory, file1))
    layout_file2 = LayoutFile.new(File.join(working_directory, file2))

    result = ( layout_file1 == layout_file1 )
    expect(result).to eq(true)

    result = ( layout_file1 == layout_file2 )
    expect(result).to eq(false)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pointrb-0.1.2 spec/layout_file/layout_file_spec.rb
pointrb-0.1.1 spec/layout_file/layout_file_spec.rb
pointrb-0.1.0 spec/layout_file/layout_file_spec.rb