Browse files

Add kraken-build spec

  • Loading branch information...
1 parent 4f2c1b0 commit f10995aa65234284b59b01a0d852d905996378db @abangratz abangratz committed Dec 17, 2012
Showing with 38 additions and 0 deletions.
  1. +38 −0 spec/lib/kraken-build_spec.rb
View
38 spec/lib/kraken-build_spec.rb
@@ -0,0 +1,38 @@
+require 'spec_helper'
+
+describe KrakenBuild do
+ context "Setting config" do
+ let(:options) { mock(Hash).as_null_object }
+
+ it "sets the config options at @config" do
+ kraken = KrakenBuild.set_config(options)
+ KrakenBuild.instance_variable_get(:@config).should eq(options)
+ end
+
+ it "sets the repository option as @repository" do
+ repository = mock(String)
+ options.should_receive(:[]).with(:repository).and_return(repository)
+ kraken = KrakenBuild.set_config(options)
+ KrakenBuild.instance_variable_get(:@repository).should eq(repository)
+ end
+
+ it "sets the github api from instance call" do
+ github_api = mock(GithubApi).as_null_object
+ GithubApi.should_receive(:new).and_return(github_api)
+ kraken = KrakenBuild.set_config(options)
+ KrakenBuild.instance_variable_get(:@github).should eq(github_api)
+ end
+ it "sets the jenkins api from instance call" do
+ jenkins_api = mock(GithubApi).as_null_object
+ JenkinsApi.should_receive(:new).and_return(jenkins_api)
+ kraken = KrakenBuild.set_config(options)
+ KrakenBuild.instance_variable_get(:@jenkins).should eq(jenkins_api)
+ end
+ it "returns the config" do
+ kraken = KrakenBuild.set_config(options)
+ KrakenBuild.instance_variable_get(:@config).should eq(options)
+ kraken.should eq(options)
+ end
+
+ end
+end

0 comments on commit f10995a

Please sign in to comment.