source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/admin/users_controller_spec.rb
Ruby
mit
49,192
master
2,039
require 'rails_helper' describe Admin::UsersController do describe 'POST #create' do context 'with valid user params' do it 'imports the default scenario for the new user' do expect(DefaultScenarioImporter).to receive(:import).with(kind_of(User)) sign_in users(:jane), scope: :user p...
github
huginn/huginn
https://github.com/huginn/huginn
spec/controllers/concerns/sortable_table_spec.rb
Ruby
mit
49,192
master
1,825
require 'rails_helper' describe SortableTable do class SortableTestController attr_accessor :params def self.helper(foo) end include SortableTable public :set_table_sort public :table_sort end describe "#set_table_sort" do let(:controller) { SortableTestController.new } let(:d...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/feature_helpers.rb
Ruby
mit
49,192
master
425
module FeatureHelpers def select_agent_type(search) agent_name = search[/\A.*?Agent\b/] || search select2(agent_name, search:, from: "Type") expect(page).to have_no_css("form.agent-form.type-changing") # Wait for all parts of the Agent form to load: expect(page).to have_css(".json-editor-shell")...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/spec_helpers.rb
Ruby
mit
49,192
master
451
module SpecHelpers def build_events(options = {}) options[:values].map.with_index do |tuple, index| event = Event.new event.agent = agents(:bob_weather_agent) event.payload = (options[:pattern] || {}).dup.merge((options[:keys].zip(tuple)).inject({}) { |memo, (key, value)| memo[key] = value; memo...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/vcr_support.rb
Ruby
mit
49,192
master
244
require 'vcr' VCR.configure do |c| c.cassette_library_dir = 'spec/cassettes' c.allow_http_connections_when_no_cassette = false c.hook_into :webmock c.default_cassette_options = { record: :new_episodes} c.configure_rspec_metadata! end
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/fake_mqtt_server.rb
Ruby
mit
49,192
master
4,123
#!/usr/bin/env ruby # # This is a 'fake' MQTT server to help with testing client implementations # # See https://github.com/njh/ruby-mqtt/blob/master/spec/fake_server.rb # # It behaves in the following ways: # * Responses to CONNECT with a successful CONACK # * Responses to PUBLISH by echoing the packet back # * ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/alert_confirmer.rb
Ruby
mit
49,192
master
1,476
module AlertConfirmer def reject_confirm_from &block handle_js_modal 'confirm', false, &block end def accept_confirm_from &block handle_js_modal 'confirm', true, &block end def accept_alert_from &block handle_js_modal 'alert', true, &block end def get_alert_text_from &block handle_js_mo...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/shared_examples/email_concern.rb
Ruby
mit
49,192
master
2,720
require 'rails_helper' shared_examples_for EmailConcern do let(:valid_options) { { :subject => "hello!", :expected_receive_period_in_days => "2" } } let(:agent) do _agent = described_class.new(:name => "some email agent", :options => valid_options) _agent.user = users(:jane) _age...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/shared_examples/web_request_concern.rb
Ruby
mit
49,192
master
6,080
require 'rails_helper' shared_examples_for WebRequestConcern do let(:agent) do _agent = described_class.new(:name => "some agent", :options => @valid_options || {}) _agent.user = users(:jane) _agent end describe "validations" do it "should be valid" do expect(agent).to be_valid end ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/shared_examples/liquid_interpolatable.rb
Ruby
mit
49,192
master
3,704
require 'rails_helper' shared_examples_for LiquidInterpolatable do before(:each) do @valid_params = { "normal" => "just some normal text", "variable" => "{{variable}}", "text" => "Some test with an embedded {{variable}}", "escape" => "This should be {{hello_world | uri_escape}}" } ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/shared_examples/working_helpers.rb
Ruby
mit
49,192
master
2,585
require 'rails_helper' shared_examples_for WorkingHelpers do describe "recent_error_logs?" do it "returns true if last_error_log_at is near last_event_at" do agent = described_class.new agent.last_error_log_at = 10.minutes.ago agent.last_event_at = 10.minutes.ago expect(agent.recent_erro...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/shared_examples/file_handling_consumer.rb
Ruby
mit
49,192
master
1,319
require 'rails_helper' shared_examples_for 'FileHandlingConsumer' do let(:event) { Event.new(user: @checker.user, payload: {'file_pointer' => {'file' => 'text.txt', 'agent_id' => @checker.id}}) } it 'returns a file pointer' do expect(@checker.get_file_pointer('testfile')).to eq(file_pointer: { file: "testfile...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/shared_examples/has_guid.rb
Ruby
mit
49,192
master
323
require 'rails_helper' shared_examples_for HasGuid do it "gets created before_save, but only if it's not present" do instance = new_instance expect(instance.guid).to be_nil instance.save! expect(instance.guid).not_to be_nil expect { instance.save! }.not_to change { instance.reload.guid } end e...
github
huginn/huginn
https://github.com/huginn/huginn
spec/support/shared_examples/agent_controller_concern.rb
Ruby
mit
49,192
master
5,900
require 'rails_helper' shared_examples_for AgentControllerConcern do describe "preconditions" do it "must be satisfied for these shared examples" do expect(agent.user).to eq(users(:bob)) expect(agent.control_action).to eq('run') end end describe "validation" do describe "of action" do ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/gemfile_helper_spec.rb
Ruby
mit
49,192
master
1,831
require 'rails_helper' describe GemfileHelper do context 'parse_each_agent_gem' do VALID_STRINGS = [ ['huginn_nlp_agents(~> 0.2.1)', [ ['huginn_nlp_agents', '~> 0.2.1'] ]], ['huginn_nlp_agents(~> 0.2.1, git: http://github.com/dsander/huginn.git, branch: agents_in_gems)', [['hugi...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/huginn_scheduler_spec.rb
Ruby
mit
49,192
master
4,373
require 'rails_helper' require 'huginn_scheduler' describe HuginnScheduler do before(:each) do @rufus_scheduler = Rufus::Scheduler.new @scheduler = HuginnScheduler.new allow(@scheduler).to receive(:setup) @scheduler.setup!(@rufus_scheduler, Mutex.new) end after(:each) do @rufus_scheduler.shu...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/tumblr_api_client_spec.rb
Ruby
mit
49,192
master
3,049
# frozen_string_literal: true require "rails_helper" # rubocop:disable Metrics/BlockLength describe TumblrApiClient do subject(:client) do described_class.new( consumer_key: "consumer-key", consumer_secret: "consumer-secret", oauth_token: "oauth-token", oauth_token_secret: "oauth-token-s...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/google_calendar_spec.rb
Ruby
mit
49,192
master
336
require 'rails_helper' describe GoogleCalendar do it '#open does not mask exception in initlize' do allow(Google::Apis::CalendarV3::CalendarService).to receive(:new) do raise "test exception" end expect { GoogleCalendar.open({'google' => {}}, Rails.logger) {} }.to raise_error(/test except...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/utils_spec.rb
Ruby
mit
49,192
master
7,834
require 'rails_helper' describe Utils do describe "#unindent" do it "unindents to the level of the greatest consistant indention" do expect(Utils.unindent(<<-MD)).to eq("Hello World") Hello World MD expect(Utils.unindent(<<-MD)).to eq("Hello World\nThis is\nnot indented") Hello...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/delayed_job_worker_spec.rb
Ruby
mit
49,192
master
692
require 'rails_helper' describe DelayedJobWorker do before do @djw = DelayedJobWorker.new end it "should run" do expect_any_instance_of(Delayed::Worker).to receive(:start) @djw.run end it "should stop" do expect_any_instance_of(Delayed::Worker).to receive(:start) @djw.run expect_any...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/agents_exporter_spec.rb
Ruby
mit
49,192
master
4,064
require 'rails_helper' describe AgentsExporter do describe "#as_json" do let(:name) { "My set of Agents" } let(:description) { "These Agents work together nicely!" } let(:guid) { "some-guid" } let(:tag_fg_color) { "#ffffff" } let(:tag_bg_color) { "#000000" } let(:icon) { 'Camera' } let(:s...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/time_tracker_spec.rb
Ruby
mit
49,192
master
612
require 'rails_helper' describe TimeTracker do describe "#track" do it "tracks execution time" do tracked_result = TimeTracker.track { sleep(0.01) } expect(tracked_result.elapsed_time).to satisfy {|v| v > 0.01 && v < 0.1} end it "returns the proc return value" do tracked_result = TimeT...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/dropbox_api_client_spec.rb
Ruby
mit
49,192
master
4,691
require "rails_helper" describe DropboxApiClient do subject(:client) { described_class.new(access_token: "token") } let(:headers) do { "Authorization" => "Bearer token", "Content-Type" => "application/json" } end describe "#ls" do it "returns file entries across paginated responses" d...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/location_spec.rb
Ruby
mit
49,192
master
2,110
require 'rails_helper' describe Location do let(:location) { Location.new( lat: BigDecimal('2.0'), lng: BigDecimal('3.0'), radius: 300, speed: 2, course: 30) } it "converts values to Float" do expect(location.lat).to be_a Float expect(location.lat).to eq 2.0 expect(...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/agent_runner_spec.rb
Ruby
mit
49,192
master
3,500
require 'rails_helper' # RSpec-Mocks is extremely unstable when threads are heavily involved, so stick with RR here. require 'rr' describe AgentRunner do context "without traps" do before do RR.stub.instance_of(Rufus::Scheduler).every RR.stub.instance_of(AgentRunner).set_traps @agent_runner = A...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/liquid_migrator_spec.rb
Ruby
mit
49,192
master
7,430
require 'rails_helper' describe LiquidMigrator do describe "converting JSONPath strings" do it "should work" do expect(LiquidMigrator.convert_string("$.data", true)).to eq("{{data}}") expect(LiquidMigrator.convert_string("$.data.test", true)).to eq("{{data.test}}") expect(LiquidMigrator.convert...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/threads_api_client_spec.rb
Ruby
mit
49,192
master
2,637
require "rails_helper" describe ThreadsApiClient do subject(:client) { described_class.new(access_token_provider: -> { "token" }) } it "adds the access token to account requests" do stub_request(:get, "https://graph.threads.net/v1.0/me") .with(query: { access_token: "token", fields: "id" }) .to_re...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/weibo_api_client_spec.rb
Ruby
mit
49,192
master
1,647
require "rails_helper" require "tempfile" describe WeiboApiClient do subject(:client) { described_class.new(access_token: "token") } describe "#statuses" do it "fetches a user timeline" do stub_request(:get, "https://api.weibo.com/2/statuses/user_timeline.json") .with(query: { access_token: "tok...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/omniauth/strategies/tumblr_spec.rb
Ruby
mit
49,192
master
2,349
# frozen_string_literal: true require "spec_helper" require_relative "../../../../lib/omniauth/strategies/tumblr" # rubocop:disable Metrics/BlockLength describe OmniAuth::Strategies::Tumblr do let(:strategy) { described_class.new(nil, "tumblrappid", "tumblrsecret") } let(:access_token) { instance_double(OAuth::Ac...
github
huginn/huginn
https://github.com/huginn/huginn
spec/lib/omniauth/strategies/threads_spec.rb
Ruby
mit
49,192
master
2,133
require "spec_helper" require "webmock/rspec" require_relative "../../../../lib/omniauth/strategies/threads" # rubocop:disable Metrics/BlockLength describe OmniAuth::Strategies::Threads do let(:strategy) { described_class.new(nil, "threadsappid", "threadssecret") } let(:callback_url) { "https://agents.akinori.org/...
github
huginn/huginn
https://github.com/huginn/huginn
spec/db/seeds/admin_and_default_scenario_spec.rb
Ruby
mit
49,192
master
790
require 'rails_helper' require_relative '../../../db/seeds/seeder' describe Seeder do before do stub_puts_to_prevent_spew_in_spec_output end describe '.seed' do before(:each) do User.delete_all expect(User.count).to eq(0) end it 'imports a default scenario' do expect { Seeder....
github
huginn/huginn
https://github.com/huginn/huginn
spec/migrations/20161124065838_add_templates_to_resolve_url_spec.rb
Ruby
mit
49,192
master
1,052
load 'spec/rails_helper.rb' load File.join('db/migrate', File.basename(__FILE__, '_spec.rb') + '.rb') describe AddTemplatesToResolveUrl do let :valid_options do { 'name' => "XKCD", 'expected_update_period_in_days' => "2", 'type' => "html", 'url' => "http://xkcd.com", 'mode' => 'on_c...
github
huginn/huginn
https://github.com/huginn/huginn
spec/migrations/20161124061256_convert_website_agent_template_for_merge_spec.rb
Ruby
mit
49,192
master
2,564
load 'spec/rails_helper.rb' load File.join('db/migrate', File.basename(__FILE__, '_spec.rb') + '.rb') describe ConvertWebsiteAgentTemplateForMerge do let :old_extract do { 'url' => { 'css' => "#comic img", 'value' => "@src" }, 'title' => { 'css' => "#comic img", 'value' => "@alt" }, 'hovertext'...
github
huginn/huginn
https://github.com/huginn/huginn
spec/presenters/form_configurable_agent_presenter_spec.rb
Ruby
mit
49,192
master
3,198
require 'rails_helper' describe FormConfigurableAgentPresenter do include RSpecHtmlMatchers class FormConfigurableAgentPresenterAgent < Agent include FormConfigurable form_configurable :string, roles: :validatable form_configurable :number, type: :number, html_options: { min: 0 } form_configurable...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/user_credential_spec.rb
Ruby
mit
49,192
master
2,024
require 'rails_helper' describe UserCredential do subject(:user_credential) do described_class.new( credential_name: 'new_key', credential_value: 'secret', user: users(:bob) ) end describe "validation" do it "requires credential_name" do user_credential.credential_name = nil ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/user_spec.rb
Ruby
mit
49,192
master
3,094
require 'rails_helper' describe User do subject(:user) do described_class.new( username: 'test-user', email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invitation_code: User::INVITATION_CODES.last ) end let(:bob) { users(:bob) } describe...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agent_log_spec.rb
Ruby
mit
49,192
master
4,143
# -*- coding: utf-8 -*- require 'rails_helper' describe AgentLog do describe "validations" do before do @log = AgentLog.new(:agent => agents(:jane_website_agent), :message => "The agent did something", :level => 3) expect(@log).to be_valid end it "requires an agent" do @log.agent = nil...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/service_spec.rb
Ruby
mit
49,192
master
7,206
require 'rails_helper' describe Service do before(:each) do @user = users(:bob) end describe "#toggle_availability!" do it "should toggle the global flag" do @service = services(:generic) expect(@service.global).to eq(false) @service.toggle_availability! expect(@service.global).t...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/event_spec.rb
Ruby
mit
49,192
master
8,805
require 'rails_helper' describe Event do describe ".with_location" do it "selects events with location" do event = events(:bob_website_agent_event) event.lat = 2 event.lng = 3 event.save! expect(Event.with_location.pluck(:id)).to eq([event.id]) event.lat = nil event.sav...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agent_spec.rb
Ruby
mit
49,192
master
40,244
require 'rails_helper' describe Agent do it_behaves_like WorkingHelpers describe '.active/inactive' do let(:agent) { agents(:jane_website_agent) } it 'is active per default' do expect(Agent.active).to include(agent) expect(Agent.inactive).not_to include(agent) end it 'is not active w...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/scenario_spec.rb
Ruby
mit
49,192
master
3,022
require 'rails_helper' describe Scenario do let(:new_instance) { users(:bob).scenarios.build(:name => "some scenario") } it_behaves_like HasGuid describe "validations" do before do expect(new_instance).to be_valid end it "validates the presence of name" do new_instance.name = '' ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/dropbox_file_url_agent_spec.rb
Ruby
mit
49,192
master
4,479
require 'rails_helper' describe Agents::DropboxFileUrlAgent do before(:each) do @agent = Agents::DropboxFileUrlAgent.new( name: 'dropbox file to url', options: {} ) @agent.user = users(:bob) @agent.service = services(:generic) @agent.save! end it 'cannot be scheduled' do expe...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/pushbullet_agent_spec.rb
Ruby
mit
49,192
master
5,504
require 'rails_helper' describe Agents::PushbulletAgent do before(:each) do @valid_params = { 'api_key' => 'token', 'device_id' => '124', 'body' => '{{body}}', 'url' => 'url', 'name' =>...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/phantom_js_cloud_agent_spec.rb
Ruby
mit
49,192
master
5,342
require 'rails_helper' describe Agents::PhantomJsCloudAgent do before do @valid_options = { 'name' => "XKCD", 'render_type' => "html", 'url' => "http://xkcd.com", 'mode' => 'clean', 'api_key' => '1234567890' } @checker = Agents::PhantomJsCloudAgent.new(:name =>...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/gap_detector_agent_spec.rb
Ruby
mit
49,192
master
3,521
require 'rails_helper' describe Agents::GapDetectorAgent do let(:valid_params) { { 'name' => "my gap detector agent", 'options' => { 'window_duration_in_days' => "2", 'message' => "A gap was found!" } } } let(:agent) { _agent = Agents::GapDetectorAgent.new(valid_par...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twitter_publish_agent_spec.rb
Ruby
mit
49,192
master
1,976
require 'rails_helper' describe Agents::TwitterPublishAgent do before do @opts = { :username => "HuginnBot", :expected_update_period_in_days => "2", :consumer_key => "---", :consumer_secret => "---", :oauth_token => "---", :oauth_token_secret => "---", :message => "{{tex...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/peak_detector_agent_spec.rb
Ruby
mit
49,192
master
4,461
require 'rails_helper' describe Agents::PeakDetectorAgent do before do @valid_params = { 'name' => "my peak detector agent", 'options' => { 'expected_receive_period_in_days' => "2", 'group_by_path' => "filter", 'value_path' => "count", 'message' => "A peak ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/trigger_agent_spec.rb
Ruby
mit
49,192
master
14,396
require 'rails_helper' describe Agents::TriggerAgent do before do @valid_params = { 'name' => "my trigger agent", 'options' => { 'expected_receive_period_in_days' => 2, 'rules' => [{ 'type' => "regex", 'value' => "a\\db", 'path' => "foo.bar.baz", ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/java_script_agent_spec.rb
Ruby
mit
49,192
master
14,350
require 'rails_helper' describe Agents::JavaScriptAgent do before do @valid_params = { name: "somename", options: { code: "Agent.check = function() { this.createEvent({ 'message': 'hi' }); };", } } @agent = Agents::JavaScriptAgent.new(@valid_params) @agent.user = users(:jan...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/user_location_agent_spec.rb
Ruby
mit
49,192
master
4,690
require 'rails_helper' describe Agents::UserLocationAgent do before do @agent = Agent.build_for_type('Agents::UserLocationAgent', users(:bob), :name => 'something', :options => { :secret => 'my_secret', :max_a...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/liquid_output_agent_spec.rb
Ruby
mit
49,192
master
17,180
# encoding: utf-8 require 'rails_helper' describe Agents::LiquidOutputAgent do let(:agent) do _agent = Agents::LiquidOutputAgent.new(name: 'My Data Output Agent') _agent.options = _agent.default_options.merge( 'secret' => 'a secret1', 'events_to_show' => 3, ) _agent.user = users(:bob) ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/shell_command_agent_spec.rb
Ruby
mit
49,192
master
7,069
require 'rails_helper' describe Agents::ShellCommandAgent do before do @valid_path = Dir.pwd @valid_params = { path: @valid_path, command: 'pwd', expected_update_period_in_days: '1', } @valid_params2 = { path: @valid_path, command: [RbConfig.ruby, '-e', ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/read_file_agent_spec.rb
Ruby
mit
49,192
master
1,338
require 'rails_helper' describe Agents::ReadFileAgent do before(:each) do @valid_params = { 'data_key' => 'data', } @checker = Agents::ReadFileAgent.new(:name => 'somename', :options => @valid_params) @checker.user = users(:jane) @checker.save! end it_b...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twitter_user_agent_spec.rb
Ruby
mit
49,192
master
3,165
require 'rails_helper' describe Agents::TwitterUserAgent do before do # intercept the twitter API request for @tectonic's user profile stub_request(:any, "https://api.twitter.com/1.1/statuses/user_timeline.json?contributor_details=true&count=200&exclude_replies=false&include_entities=true&include_rts=true&sc...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/csv_agent_spec.rb
Ruby
mit
49,192
master
10,520
require 'rails_helper' describe Agents::CsvAgent do before(:each) do @valid_params = { 'mode' => 'parse', 'separator' => ',', 'use_fields' => '', 'output' => 'event_per_row', 'with_header' => 'true', ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twilio_agent_spec.rb
Ruby
mit
49,192
master
4,191
require 'rails_helper' describe Agents::TwilioAgent do before do @checker = Agents::TwilioAgent.new(:name => 'somename', :options => { :account_sid => 'x', :auth_token => 'x', ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/openai_llm_agent_spec.rb
Ruby
mit
49,192
master
6,723
require 'rails_helper' describe Agents::OpenaiLlmAgent do before do @valid_options = { 'api_key' => 'test-api-key', 'model' => 'gpt-4o-mini', 'system_message' => 'You are a helpful assistant.', 'user_message' => '{{ message }}', 'temperature' => '1', 'expected_receive_period_i...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/jira_agent_spec.rb
Ruby
mit
49,192
master
3,929
require 'rails_helper' describe Agents::JiraAgent do before(:each) do stub_request(:get, /atlassian.com/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/jira.json")), :status => 200, :headers => {"Content-Type" => "text/json"}) @valid_params = { :username => "user", :password...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/json_parse_agent_spec.rb
Ruby
mit
49,192
master
1,760
require 'rails_helper' describe Agents::JsonParseAgent do before(:each) do @checker = Agents::JsonParseAgent.new(:name => "somename", :options => Agents::JsonParseAgent.new.default_options) @checker.user = users(:jane) @checker.save! end it "event description does not throw an exception" do expe...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/attribute_difference_agent_spec.rb
Ruby
mit
49,192
master
3,598
require 'rails_helper' describe Agents::AttributeDifferenceAgent do def create_event(value=nil) event = Event.new event.agent = agents(:jane_weather_agent) event.payload = { rate: value } event.save! event end before do @valid_params = { path: 'rate', output: 'rate...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twilio_receive_text_agent_spec.rb
Ruby
mit
49,192
master
3,959
require 'rails_helper' # Twilio Params # https://www.twilio.com/docs/api/twiml/sms/twilio_request # url: https://b924379f.ngrok.io/users/1/web_requests/7/sms-endpoint # params: {"ToCountry"=>"US", "ToState"=>"NY", "SmsMessageSid"=>"SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "NumMedia"=>"0", "ToCity"=>"NEW YORK", "FromZip"=>...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/manual_event_agent_spec.rb
Ruby
mit
49,192
master
2,202
require 'rails_helper' describe Agents::ManualEventAgent do before do @checker = Agents::ManualEventAgent.new(name: "My Manual Event Agent") @checker.user = users(:jane) @checker.save! end describe "#handle_details_post" do it "emits an event with the given payload" do expect { jso...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/email_agent_spec.rb
Ruby
mit
49,192
master
4,612
require 'rails_helper' describe Agents::EmailAgent do it_behaves_like EmailConcern def get_message_part(mail, content_type) mail.body.parts.find { |p| p.content_type.match content_type }.body.raw_source end before do @checker = Agents::EmailAgent.new(:name => "something", :options => { :expected_rece...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/hipchat_agent_spec.rb
Ruby
mit
49,192
master
3,465
require 'rails_helper' describe Agents::HipchatAgent do before(:each) do @valid_params = { 'auth_token' => 'token', 'room_name' => 'test', 'username' => "{{username}}", 'message' => "{{message}}", 'notify' => 'false', 'color' => 'yellow', } @checker = Agents::HipchatA...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/scheduler_agent_spec.rb
Ruby
mit
49,192
master
2,192
require 'rails_helper' describe Agents::SchedulerAgent do let(:valid_params) { { name: 'Example', options: { 'action' => 'run', 'schedule' => '0 * * * *' }, } } let(:agent) { described_class.create!(valid_params) { |agent| agent.user = users(:bob) } } ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/dropbox_watch_agent_spec.rb
Ruby
mit
49,192
master
5,463
require 'rails_helper' describe Agents::DropboxWatchAgent do before(:each) do @agent = Agents::DropboxWatchAgent.new( name: 'save to dropbox', options: { access_token: '70k3n', dir_to_watch: '/my/dropbox/dir', expected_update_period_in_days: 2 } ) @agent.user = u...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/human_task_agent_spec.rb
Ruby
mit
49,192
master
28,398
require 'rails_helper' describe Agents::HumanTaskAgent do before do @checker = Agents::HumanTaskAgent.new(name: 'my human task agent') @checker.options = @checker.default_options @checker.user = users(:bob) @checker.save! @event = Event.new @event.agent = agents(:bob_rain_notifier_agent) ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/website_agent_spec.rb
Ruby
mit
49,192
master
54,380
require 'rails_helper' describe Agents::WebsiteAgent do describe "checking without basic auth" do before do stub_request(:any, /xkcd/).to_return(body: File.read(Rails.root.join("spec/data_fixtures/xkcd.html")), status: 200, ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/change_detector_agent_spec.rb
Ruby
mit
49,192
master
4,309
require 'rails_helper' describe Agents::ChangeDetectorAgent do def create_event(output=nil) event = Event.new event.agent = agents(:jane_weather_agent) event.payload = { :command => 'some-command', :output => output } event.save! event end before do @valid_params = { ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/imap_folder_agent_spec.rb
Ruby
mit
49,192
master
12,810
require 'rails_helper' require 'time' describe Agents::ImapFolderAgent do module MessageMixin def folder 'INBOX' end def uidvalidity 100 end def has_attachment? false end def body_parts(mime_types = %(text/plain text/enriched text/html)) mime_types.map do |type|...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/weibo_publish_agent_spec.rb
Ruby
mit
49,192
master
4,344
# encoding: utf-8 require 'rails_helper' describe Agents::WeiboPublishAgent do before do @opts = { :expected_update_period_in_days => "2", :access_token => "---", :message_path => "text", :pic_path => "pic" } @checker = Agents::WeiboPublishAgent.new(:name => "Weibo Publisher", :o...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/tumblr_likes_agent_spec.rb
Ruby
mit
49,192
master
1,528
require 'rails_helper' describe Agents::TumblrLikesAgent do before do allow_any_instance_of(Agents::TumblrLikesAgent).to receive(:tumblr) { double.tap { |obj| allow(obj).to receive(:blog_likes).with('wendys.tumblr.com', after: 0) { JSON.parse(File.read(Rails.root.join('spec/data_fixtures/...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/google_calendar_publish_agent_spec.rb
Ruby
mit
49,192
master
7,098
require 'rails_helper' describe Agents::GoogleCalendarPublishAgent do let(:valid_params) do { 'expected_update_period_in_days' => '10', 'calendar_id' => calendar_id, 'google' => { 'key_file' => File.dirname(__FILE__) + '/../../data_fixtures/private.key', 'key_secret' => 'notasec...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/jq_agent_spec.rb
Ruby
mit
49,192
master
4,028
require 'rails_helper' describe Agents::JqAgent do def create_event(payload) agents(:jane_weather_agent).events.create!(payload: payload) end let!(:agent) { Agents::JqAgent.create!( name: 'somename', options: { filter: '.+{"total": .numbers | add} | del(.numbers)' }, user...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/threads_publish_agent_spec.rb
Ruby
mit
49,192
master
2,682
require "rails_helper" describe Agents::ThreadsPublishAgent do before do @agent = Agents::ThreadsPublishAgent.new( name: "Threads publisher", options: { message: "{{text}}", expected_update_period_in_days: "2", }, ) @agent.service = services(:threads) @agent.user = u...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/webhook_agent_spec.rb
Ruby
mit
49,192
master
27,573
require 'rails_helper' describe Agents::WebhookAgent do let(:agent) do _agent = Agents::WebhookAgent.new(:name => 'webhook', :options => { 'secret' => 'foobar', 'payload_path' => 'some_key' }) _agent.user = users(:bob) _agent.save! _agent end let(:payload) { ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/data_output_agent_spec.rb
Ruby
mit
49,192
master
25,832
# encoding: utf-8 require 'rails_helper' describe Agents::DataOutputAgent do let(:agent) do _agent = Agents::DataOutputAgent.new(:name => 'My Data Output Agent') _agent.options = _agent.default_options.merge('secrets' => ['secret1', 'secret2'], 'events_to_show' => 3) _agent.options['template']['item']['...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/s3_agent_spec.rb
Ruby
mit
49,192
master
8,620
require 'rails_helper' describe Agents::S3Agent do before(:each) do @valid_params = { 'mode' => 'read', 'access_key_id' => '32343242', 'access_key_secret' => '1231312', 'watch' => 'false', 'bucket' => 't...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/openai_speech_agent_spec.rb
Ruby
mit
49,192
master
7,728
require 'rails_helper' describe Agents::OpenaiSpeechAgent do before do @valid_transcribe_options = { 'api_key' => 'test-api-key', 'mode' => 'transcribe', 'model' => 'whisper-1', 'audio_url' => 'https://example.com/audio.wav', 'expected_receive_period_in_days' => '1' } @vali...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/rss_agent_spec.rb
Ruby
mit
49,192
master
25,013
require 'rails_helper' describe Agents::RssAgent do before do @valid_options = { 'expected_update_period_in_days' => "2", 'url' => "https://github.com/cantino/huginn/commits/master.atom", } stub_request(:any, /github.com/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/gith...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/google_translation_agent_spec.rb
Ruby
mit
49,192
master
2,455
require 'rails_helper' describe Agents::GoogleTranslationAgent, :vcr do before do @valid_params = { name: "somename", options: { to: "sv", from: "en", google_api_key: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', expected_receive_period_in_days: 1, content: { ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/stubhub_agent_spec.rb
Ruby
mit
49,192
master
2,364
require 'rails_helper' describe Agents::StubhubAgent do let(:name) { 'Agent Name' } let(:url) { 'https://www.stubhub.com/event/name-1-1-2014-12345' } let(:parsed_body) { JSON.parse(body)['response']['docs'][0] } let(:valid_params) { { 'url' => parsed_body['url'] } } let(:body) { File.read(Rails.root.join('s...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/weibo_user_agent_spec.rb
Ruby
mit
49,192
master
807
# encoding: utf-8 require 'rails_helper' describe Agents::WeiboUserAgent do before do # intercept the twitter API request for @tectonic's user profile stub_request(:any, /\Ahttps:\/\/api\.weibo\.com\//).to_return( :body => File.read(Rails.root.join("spec/data_fixtures/one_weibo.json")), :status ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/aftership_agent_spec.rb
Ruby
mit
49,192
master
2,405
require 'rails_helper' describe Agents::AftershipAgent do before do stub_request(:get, /trackings/).to_return( :body => File.read(Rails.root.join("spec/data_fixtures/aftership.json")), :status => 200, :headers => {"Content-Type" => "text/json"} ) @opts = { "api_key" => '800deeaf...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twitter_action_agent_spec.rb
Ruby
mit
49,192
master
6,505
require 'rails_helper' describe Agents::TwitterActionAgent do describe '#receive' do before do @event1 = Event.new @event1.agent = agents(:bob_twitter_user_agent) @event1.payload = { id: 123, text: 'So awesome.. gotta retweet' } @event1.save! @tweet1 = Twitter::Tweet.new( id...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/pushover_agent_spec.rb
Ruby
mit
49,192
master
7,783
require 'rails_helper' describe Agents::PushoverAgent do before do @checker = Agents::PushoverAgent.new(name: 'Some Name', options: { token: 'x', user: 'x', ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/email_digest_agent_spec.rb
Ruby
mit
49,192
master
4,292
require 'rails_helper' describe Agents::EmailDigestAgent do it_behaves_like EmailConcern def get_message_part(mail, content_type) mail.body.parts.find { |p| p.content_type.match content_type }.body.raw_source end before do @checker = Agents::EmailDigestAgent.new(:name => "something", :options => {:ex...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/tumblr_publish_agent_spec.rb
Ruby
mit
49,192
master
2,847
require 'rails_helper' describe Agents::TumblrPublishAgent do describe "Should create post" do before do @opts = { :blog_name => "huginnbot.tumblr.com", :post_type => "text", :expected_update_period_in_days => "2", :options => { :title => "{{title}}", :bo...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/pdf_info_agent_spec.rb
Ruby
mit
49,192
master
1,986
require "rails_helper" describe Agents::PdfInfoAgent do let(:agent) do _agent = Agents::PdfInfoAgent.new(name: "PDF Info Agent") _agent.user = users(:bob) _agent.sources << agents(:bob_website_agent) _agent.save! _agent end def stub_faraday(url, pdf_path) stub_request(:get, url).to_retur...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/mqtt_agent_spec.rb
Ruby
mit
49,192
master
1,583
require 'rails_helper' require 'mqtt' require './spec/support/fake_mqtt_server' describe Agents::MqttAgent do before :each do @error_log = StringIO.new @server = MQTT::FakeServer.new('127.0.0.1') @server.logger = Logger.new(@error_log) @server.logger.level = Logger::DEBUG @server.start @va...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/digest_agent_spec.rb
Ruby
mit
49,192
master
5,063
require "rails_helper" describe Agents::DigestAgent do before do @checker = Agents::DigestAgent.new(:name => "something", :options => { :expected_receive_period_in_days => "2", :retained_events => "0", :message => "{{ events | map:'data' | join:';' }}" }) @checker.user = users(:bob) @checker.save! end ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/witai_agent_spec.rb
Ruby
mit
49,192
master
2,132
require 'rails_helper' describe Agents::WitaiAgent do before do stub_request(:get, /wit/).to_return(:body => File.read(Rails.root.join('spec/data_fixtures/witai.json')), :status => 200, :headers => {'Content-Type' => 'text/json'}) @valid_params = { :server_access_token => 'x', :expected_receive_...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/local_file_agent_spec.rb
Ruby
mit
49,192
master
9,829
require 'rails_helper' describe Agents::LocalFileAgent do before(:each) do @valid_params = { 'mode' => 'read', 'watch' => 'false', 'append' => 'false', 'path' => File.join(Rails.root, 'tmp', 'spec') } ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/commander_agent_spec.rb
Ruby
mit
49,192
master
2,461
require 'rails_helper' describe Agents::CommanderAgent do let(:target) { agents(:bob_website_agent) } let(:valid_params) { { name: 'Example', schedule: 'every_1h', options: { 'action' => 'run', }, user: users(:bob), control_targets: [target] } } let(:...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/openai_image_generation_agent_spec.rb
Ruby
mit
49,192
master
6,940
require 'rails_helper' describe Agents::OpenaiImageGenerationAgent do before do @valid_options = { 'api_key' => 'test-api-key', 'model' => 'dall-e-3', 'prompt' => 'A beautiful sunset over the ocean', 'n' => '1', 'size' => '1024x1024', 'quality' => 'standard', 'style' => ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/slack_agent_spec.rb
Ruby
mit
49,192
master
2,547
require 'rails_helper' describe Agents::SlackAgent do before(:each) do @fallback = "Its going to rain" @attachments = [{'fallback' => "{{fallback}}"}] @valid_params = { 'webhook_url' => 'https://hooks.slack.com/services/random1/random2/token', 'channel' => '#ra...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twitter_stream_agent_spec.rb
Ruby
mit
49,192
master
13,780
require 'rails_helper' describe Agents::TwitterStreamAgent do before do @opts = { consumer_key: "---", consumer_secret: "---", oauth_token: "---", oauth_token_secret: "---", filters: %w[keyword1 keyword2], expected_update_period_in_days: "2", generate: "events", in...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/evernote_agent_spec.rb
Ruby
mit
49,192
master
18,725
require 'rails_helper' describe Agents::EvernoteAgent do class FakeEvernoteNoteStore attr_accessor :notes, :tags, :notebooks def initialize @notes, @tags, @notebooks = [], [], [] end def createNote(note) note.attributes = OpenStruct.new(source: nil, sourceURL: nil) note.guid = @not...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/public_transport_agent_spec.rb
Ruby
mit
49,192
master
2,682
require 'rails_helper' describe Agents::PublicTransportAgent do before do valid_params = { "name" => "sf muni agent", "options" => { "alert_window_in_minutes" => "20", "stops" => ['N|5221', 'N|5215'], "agency" => "sf-muni" } } @agent = Agents::PublicTransportAgent...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/delay_agent_spec.rb
Ruby
mit
49,192
master
5,797
require 'rails_helper' describe Agents::DelayAgent do let(:agent) { Agents::DelayAgent.create!( name: 'My DelayAgent', user: users(:bob), options: default_options.merge('max_events' => 2), sources: [agents(:bob_website_agent)] ) } let(:default_options) { Agents::DelayAgent.new.de...