spec/issue_spec.rb in gitmine-0.1.3 vs spec/issue_spec.rb in gitmine-0.1.4.pre

- old
+ new

@@ -8,43 +8,35 @@ end end describe "#config" do it "should load the config from config.yml" do - issue.config.should == {"host"=>"http://localhost:3000", "api_key"=>"api_key"} + Gitmine::Issue.config.should == {"host"=>"http://redmine-gitmine.heroku.com", "github" => "pcreux/gitmine"} end end - describe "#url (protected)" do - it "should build up URL based on the config" do - issue.send(:url, '123').should == 'http://localhost:3000/issues/123.xml?key=api_key' - end - - end - - describe "#get_for_commit" do it "should parse the commit message to find a commit_id and call #get" do commit_msg = 'A commit msg Issue #123' Gitmine::Issue.should_receive(:parse_for_issue_id).with(commit_msg) Gitmine::Issue.get_for_commit(commit_msg) end end - describe "#get (class method)" do + describe "#find (class method)" do it "should build_via_issue_id" do issue = Gitmine::Issue.new Gitmine::Issue.should_receive(:new) { issue } issue.should_receive(:build_via_issue_id) - Gitmine::Issue.get(123) + Gitmine::Issue.find(123) end end describe "#build_via_issue_id" do before do @httparty = mock(:http_party_response, :parsed_response => {'issue' => { 'subject' => 'A subject', 'status' => {'name' => 'Completed'}}}) - issue.stub!(:get) { @httparty } + issue.stub!(:http_get) { @httparty } end it "should get issue data and load attributes" do issue.should_receive(:build_via_issue_id).with(123) { @httparty } issue.build_via_issue_id(123) @@ -56,14 +48,13 @@ issue.subject.should == 'A subject' issue.status.should == 'Completed' end end - describe "#get (protected instance method)" do - it "should create a new issue via HTTParty" do - issue.stub!(:url) { 'the_url' } - HTTParty.should_receive(:get).with('the_url') - issue.send(:get, 123) + describe "#add_note" do + it "should PUT a note" do + issue.stub!(:id) { 1 } + issue.class.should_receive(:put).with('/1.xml', :query => {:notes => "Hello"}, :body => "") + issue.add_note("Hello") end end - end