Sha256: 38fe38ccd7fe38a6ab71dfda20d4655229cfa6fe56620158cce2d3238142cea6

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

require_relative '../../spec_helper'

describe Octonore::Template do

  describe "default instance attributes" do

    let(:template) { Octonore::Template.new('C') }

    before { VCR.insert_cassette 'template', :record => :new_episodes }

    after { VCR.eject_cassette }

    it "should have a name attribute" do
      template.should respond_to :name
    end

    it "should have a source attribute" do
      template.should respond_to :source
    end

    it "should have the right name" do
      template.name.should eq('C')
    end

    it "should not have case sensitive names" do
      valid_template = Octonore::Template.new('java')
      valid_template.name.should eq('Java')
    end

  end

  describe "GET template" do

    let(:template) { Octonore::Template.new('C') }

    before { VCR.insert_cassette 'template', :record => :new_episodes }

    after { VCR.eject_cassette }

    it "should have a reload method" do
      template.should respond_to :reload
    end

    it "should reload data from Github" do
      template.source = nil
      template.reload
      template.source.should_not equal nil
    end

    it "should raise an error if template doesn't exist" do
      expect {
        bad_template = Octonore::Template.new('invalid') }.to raise_error
    end

    it "should list gitignore templates" do
      templates = Octonore::Template.list      
      templates.should be_an_instance_of Array
      templates.should include("C")
    end
    
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octonore-1.0.1 spec/lib/octonore/template_spec.rb
octonore-1.0.0 spec/lib/octonore/template_spec.rb