spec/lib/octonore/template_spec.rb in octonore-0.0.3 vs spec/lib/octonore/template_spec.rb in octonore-1.0.0

- old
+ new

@@ -1,21 +1,9 @@ require_relative '../../spec_helper' describe Octonore::Template do - describe "default attributes" do - - it "should have httparty methods" do - Octonore::Template.should include(HTTParty) - end - - it "should have the base url set to the Github API gitignore endpoint" do - Octonore::Template.base_uri.should eq('https://api.github.com/gitignore') - end - - end - describe "default instance attributes" do let(:template) { Octonore::Template.new('C') } before { VCR.insert_cassette 'template', :record => :new_episodes } @@ -32,32 +20,43 @@ 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 an update method" do - template.should respond_to :update + it "should have a reload method" do + template.should respond_to :reload end - it "should be able to refresh data from Github" do + it "should reload data from Github" do template.source = nil - template.update + 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