lib/you_track/client/mock.rb in you_track-0.2.2 vs lib/you_track/client/mock.rb in you_track-0.3.0

- old
+ new

@@ -4,10 +4,26 @@ def self.data @data ||= Hash.new { |h,k| h[k] = { :issues => {}, :comments => {}, + :users => {}, + :projects => { + "YTD" => { + "name" => "You Track Dev", + "shortName" => "YTD", + "versions" => [], + "assignees" => {}, + "isImporting" => "false", + "description" => "Fake project for YouTrack development", + } + }, + :custom_fields => { + "YTD" => [ + {"name" => "Fix versions", "url" => "https://foo.bar/rest/admin/project/YTD/customfield/Fix%20versions"} + ] + } } } end def self.reset! @@ -31,10 +47,15 @@ end def initialize(options={}) @url = URI.parse(options[:url]) @username = options[:username] + self.data[:users][@username] = { + :email => @username, + :full_name => Faker::Name.name, + :last_created_project => SecureRandom.hex(2), + } end def response(options={}) body = options[:response_body] || options[:body] method = options[:method] || :get @@ -67,7 +88,11 @@ :status => status, ) Faraday::Response::RaiseError.new.on_complete(env) || Faraday::Response.new(env) + end + + def current_user + @current_user ||= users.current end end