Browse Source

Migrate to RSpec's new expect syntax using Transpec.

We set `config.infer_spec_type_from_file_location!`, so the command I
ran is `transpec --no-explicit-spec-type`.
Akinori MUSHA 10 years ago
parent
commit
5031cbbbac
77 changed files with 1647 additions and 1640 deletions
  1. 2 2
      spec/concerns/inheritance_tracking_spec.rb
  2. 3 3
      spec/concerns/liquid_droppable_spec.rb
  3. 14 14
      spec/concerns/liquid_interpolatable_spec.rb
  4. 61 61
      spec/controllers/agents_controller_spec.rb
  5. 9 9
      spec/controllers/concerns/sortable_table_spec.rb
  6. 21 21
      spec/controllers/events_controller_spec.rb
  7. 5 5
      spec/controllers/jobs_controller_spec.rb
  8. 11 11
      spec/controllers/logs_controller_spec.rb
  9. 6 6
      spec/controllers/scenario_imports_controller_spec.rb
  10. 40 40
      spec/controllers/scenarios_controller_spec.rb
  11. 7 7
      spec/controllers/services_controller_spec.rb
  12. 15 15
      spec/controllers/user_credentials_controller_spec.rb
  13. 39 39
      spec/controllers/web_requests_controller_spec.rb
  14. 6 6
      spec/helpers/dot_helper_spec.rb
  15. 5 5
      spec/helpers/jobs_helper_spec.rb
  16. 2 2
      spec/helpers/markdown_helper_spec.rb
  17. 6 4
      spec/helpers/scenario_helper_spec.rb
  18. 21 21
      spec/lib/agents_exporter_spec.rb
  19. 5 5
      spec/lib/huginn_scheduler_spec.rb
  20. 24 19
      spec/lib/liquid_migrator_spec.rb
  21. 26 26
      spec/lib/utils_spec.rb
  22. 29 29
      spec/models/agent_log_spec.rb
  23. 175 175
      spec/models/agent_spec.rb
  24. 3 3
      spec/models/agents/adioso_agent_spec.rb
  25. 8 8
      spec/models/agents/basecamp_agent_spec.rb
  26. 7 7
      spec/models/agents/change_detector_agent_spec.rb
  27. 27 27
      spec/models/agents/data_output_agent_spec.rb
  28. 9 9
      spec/models/agents/email_agent_spec.rb
  29. 10 10
      spec/models/agents/email_digest_agent_spec.rb
  30. 18 18
      spec/models/agents/event_formatting_agent_spec.rb
  31. 21 21
      spec/models/agents/ftpsite_agent_spec.rb
  32. 1 1
      spec/models/agents/google_calendar_publish_agent_spec.rb
  33. 10 10
      spec/models/agents/growl_agent_spec.rb
  34. 10 10
      spec/models/agents/hipchat_agent_spec.rb
  35. 111 111
      spec/models/agents/human_task_agent_spec.rb
  36. 43 43
      spec/models/agents/imap_folder_agent_spec.rb
  37. 9 9
      spec/models/agents/jabber_agent_spec.rb
  38. 59 59
      spec/models/agents/java_script_agent_spec.rb
  39. 11 11
      spec/models/agents/jira_agent_spec.rb
  40. 3 3
      spec/models/agents/mqtt_agent_spec.rb
  41. 15 15
      spec/models/agents/peak_detector_agent_spec.rb
  42. 62 62
      spec/models/agents/post_agent_spec.rb
  43. 11 11
      spec/models/agents/public_transport_agent_spec.rb
  44. 7 7
      spec/models/agents/pushbullet_agent_spec.rb
  45. 27 27
      spec/models/agents/pushover_agent_spec.rb
  46. 20 20
      spec/models/agents/rss_agent_spec.rb
  47. 24 24
      spec/models/agents/scheduler_agent_spec.rb
  48. 11 11
      spec/models/agents/sentiment_agent_spec.rb
  49. 13 13
      spec/models/agents/shell_command_agent_spec.rb
  50. 1 1
      spec/models/agents/slack_agent_spec.rb
  51. 6 6
      spec/models/agents/stubhub_agent_spec.rb
  52. 12 12
      spec/models/agents/translation_agent_spec.rb
  53. 76 76
      spec/models/agents/trigger_agent_spec.rb
  54. 3 3
      spec/models/agents/tumblr_publish_agent_spec.rb
  55. 13 13
      spec/models/agents/twilio_agent_spec.rb
  56. 5 5
      spec/models/agents/twitter_publish_agent_spec.rb
  57. 24 24
      spec/models/agents/twitter_stream_agent_spec.rb
  58. 2 2
      spec/models/agents/twitter_user_agent_spec.rb
  59. 13 13
      spec/models/agents/user_location_agent_spec.rb
  60. 10 10
      spec/models/agents/webhook_agent_spec.rb
  61. 80 80
      spec/models/agents/website_agent_spec.rb
  62. 9 9
      spec/models/agents/weibo_publish_agent_spec.rb
  63. 2 2
      spec/models/agents/weibo_user_agent_spec.rb
  64. 3 3
      spec/models/concerns/oauthable.rb
  65. 51 51
      spec/models/event_spec.rb
  66. 127 127
      spec/models/scenario_import_spec.rb
  67. 15 15
      spec/models/scenario_spec.rb
  68. 29 29
      spec/models/service_spec.rb
  69. 9 9
      spec/models/user_credential_spec.rb
  70. 2 2
      spec/models/users_spec.rb
  71. 8 8
      spec/routing/webhooks_controller_spec.rb
  72. 1 1
      spec/spec_helper.rb
  73. 18 18
      spec/support/shared_examples/email_concern.rb
  74. 3 3
      spec/support/shared_examples/has_guid.rb
  75. 15 15
      spec/support/shared_examples/liquid_interpolatable.rb
  76. 19 19
      spec/support/shared_examples/web_request_concern.rb
  77. 9 9
      spec/support/shared_examples/working_helpers.rb

+ 2 - 2
spec/concerns/inheritance_tracking_spec.rb

@@ -10,12 +10,12 @@ describe InheritanceTracking do
   class Class3 < Class1; end
   class Class3 < Class1; end
 
 
   it "tracks subclasses" do
   it "tracks subclasses" do
-    Class1.subclasses.should == [Class2, Class3]
+    expect(Class1.subclasses).to eq([Class2, Class3])
   end
   end
 
 
   it "can be temporarily overridden with #with_subclasses" do
   it "can be temporarily overridden with #with_subclasses" do
     Class1.with_subclasses(Class2) do
     Class1.with_subclasses(Class2) do
-      Class1.subclasses.should == [Class2]
+      expect(Class1.subclasses).to eq([Class2])
     end
     end
   end
   end
 end
 end

+ 3 - 3
spec/concerns/liquid_droppable_spec.rb

@@ -26,9 +26,9 @@ describe LiquidDroppable do
   describe 'test class' do
   describe 'test class' do
     it 'should be droppable' do
     it 'should be droppable' do
       five = DroppableTest.new(5)
       five = DroppableTest.new(5)
-      five.to_liquid.class.should == DroppableTestDrop
-      Liquid::Template.parse('{{ x.value | plus:3 }}').render('x' => five).should == '8'
-      Liquid::Template.parse('{{ x }}').render('x' => five).should == '[value:5]'
+      expect(five.to_liquid.class).to eq(DroppableTestDrop)
+      expect(Liquid::Template.parse('{{ x.value | plus:3 }}').render('x' => five)).to eq('8')
+      expect(Liquid::Template.parse('{{ x }}').render('x' => five)).to eq('[value:5]')
     end
     end
   end
   end
 end
 end

+ 14 - 14
spec/concerns/liquid_interpolatable_spec.rb

@@ -10,11 +10,11 @@ describe LiquidInterpolatable::Filters do
 
 
   describe 'uri_escape' do
   describe 'uri_escape' do
     it 'should escape a string for use in URI' do
     it 'should escape a string for use in URI' do
-      @filter.uri_escape('abc:/?=').should == 'abc%3A%2F%3F%3D'
+      expect(@filter.uri_escape('abc:/?=')).to eq('abc%3A%2F%3F%3D')
     end
     end
 
 
     it 'should not raise an error when an operand is nil' do
     it 'should not raise an error when an operand is nil' do
-      @filter.uri_escape(nil).should be_nil
+      expect(@filter.uri_escape(nil)).to be_nil
     end
     end
   end
   end
 
 
@@ -33,8 +33,8 @@ describe LiquidInterpolatable::Filters do
 
 
     it "should finish without raising an exception" do
     it "should finish without raising an exception" do
       agent = Agents::InterpolatableAgent.new(name: "test", options: { 'foo' => '{{bar}' })
       agent = Agents::InterpolatableAgent.new(name: "test", options: { 'foo' => '{{bar}' })
-      agent.valid?.should == false
-      agent.errors[:options].first.should =~ /not properly terminated/
+      expect(agent.valid?).to eq(false)
+      expect(agent.errors[:options].first).to match(/not properly terminated/)
     end
     end
   end
   end
 
 
@@ -50,13 +50,13 @@ describe LiquidInterpolatable::Filters do
         %q{abc}.freeze,
         %q{abc}.freeze,
         %q{'a"bc'dfa""fds''fa}.freeze,
         %q{'a"bc'dfa""fds''fa}.freeze,
       ].each { |string|
       ].each { |string|
-        @filter.to_xpath_roundtrip(string).should == string
+        expect(@filter.to_xpath_roundtrip(string)).to eq(string)
       }
       }
     end
     end
 
 
     it 'should stringify a non-string operand' do
     it 'should stringify a non-string operand' do
-      @filter.to_xpath_roundtrip(nil).should == ''
-      @filter.to_xpath_roundtrip(1).should == '1'
+      expect(@filter.to_xpath_roundtrip(nil)).to eq('')
+      expect(@filter.to_xpath_roundtrip(1)).to eq('1')
     end
     end
   end
   end
 
 
@@ -67,33 +67,33 @@ describe LiquidInterpolatable::Filters do
     end
     end
 
 
     it 'should parse an abosule URI' do
     it 'should parse an abosule URI' do
-      @filter.to_uri('http://example.net/index.html', 'http://example.com/dir/1').should == URI('http://example.net/index.html')
+      expect(@filter.to_uri('http://example.net/index.html', 'http://example.com/dir/1')).to eq(URI('http://example.net/index.html'))
     end
     end
 
 
     it 'should parse an abosule URI with a base URI specified' do
     it 'should parse an abosule URI with a base URI specified' do
-      @filter.to_uri('http://example.net/index.html', 'http://example.com/dir/1').should == URI('http://example.net/index.html')
+      expect(@filter.to_uri('http://example.net/index.html', 'http://example.com/dir/1')).to eq(URI('http://example.net/index.html'))
     end
     end
 
 
     it 'should parse a relative URI with a base URI specified' do
     it 'should parse a relative URI with a base URI specified' do
-      @filter.to_uri('foo/index.html', 'http://example.com/dir/1').should == URI('http://example.com/dir/foo/index.html')
+      expect(@filter.to_uri('foo/index.html', 'http://example.com/dir/1')).to eq(URI('http://example.com/dir/foo/index.html'))
     end
     end
 
 
     it 'should parse an abosule URI with a base URI specified' do
     it 'should parse an abosule URI with a base URI specified' do
-      @filter.to_uri('http://example.net/index.html', 'http://example.com/dir/1').should == URI('http://example.net/index.html')
+      expect(@filter.to_uri('http://example.net/index.html', 'http://example.com/dir/1')).to eq(URI('http://example.net/index.html'))
     end
     end
 
 
     it 'should stringify a non-string operand' do
     it 'should stringify a non-string operand' do
-      @filter.to_uri(123, 'http://example.com/dir/1').should == URI('http://example.com/dir/123')
+      expect(@filter.to_uri(123, 'http://example.com/dir/1')).to eq(URI('http://example.com/dir/123'))
     end
     end
 
 
     it 'should return a URI value in interpolation' do
     it 'should return a URI value in interpolation' do
-      @agent.interpolated['foo'].should == '/dir/1'
+      expect(@agent.interpolated['foo']).to eq('/dir/1')
     end
     end
 
 
     it 'should return a URI value resolved against a base URI in interpolation' do
     it 'should return a URI value resolved against a base URI in interpolation' do
       @agent.options['foo'] = '{% assign u = s | to_uri:"http://example.com/dir/1" %}{{ u.path }}'
       @agent.options['foo'] = '{% assign u = s | to_uri:"http://example.com/dir/1" %}{{ u.path }}'
       @agent.interpolation_context['s'] = 'foo/index.html'
       @agent.interpolation_context['s'] = 'foo/index.html'
-      @agent.interpolated['foo'].should == '/dir/foo/index.html'
+      expect(@agent.interpolated['foo']).to eq('/dir/foo/index.html')
     end
     end
   end
   end
 end
 end

+ 61 - 61
spec/controllers/agents_controller_spec.rb

@@ -14,7 +14,7 @@ describe AgentsController do
     it "only returns Agents for the current user" do
     it "only returns Agents for the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :index
       get :index
-      assigns(:agents).all? {|i| i.user.should == users(:bob) }.should be_truthy
+      expect(assigns(:agents).all? {|i| expect(i.user).to eq(users(:bob)) }).to be_truthy
     end
     end
   end
   end
 
 
@@ -22,15 +22,15 @@ describe AgentsController do
     it "passes control to handle_details_post on the agent" do
     it "passes control to handle_details_post on the agent" do
       sign_in users(:bob)
       sign_in users(:bob)
       post :handle_details_post, :id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => "bar" }
       post :handle_details_post, :id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => "bar" }
-      JSON.parse(response.body).should == { "success" => true }
-      agents(:bob_manual_event_agent).events.last.payload.should == { 'foo' => "bar" }
+      expect(JSON.parse(response.body)).to eq({ "success" => true })
+      expect(agents(:bob_manual_event_agent).events.last.payload).to eq({ 'foo' => "bar" })
     end
     end
 
 
     it "can only be accessed by the Agent's owner" do
     it "can only be accessed by the Agent's owner" do
       sign_in users(:jane)
       sign_in users(:jane)
-      lambda {
+      expect {
         post :handle_details_post, :id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => :bar }
         post :handle_details_post, :id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => :bar }
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -43,9 +43,9 @@ describe AgentsController do
 
 
     it "can only be accessed by the Agent's owner" do
     it "can only be accessed by the Agent's owner" do
       sign_in users(:jane)
       sign_in users(:jane)
-      lambda {
+      expect {
         post :run, :id => agents(:bob_manual_event_agent).to_param
         post :run, :id => agents(:bob_manual_event_agent).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -55,15 +55,15 @@ describe AgentsController do
       agent_event = events(:bob_website_agent_event).id
       agent_event = events(:bob_website_agent_event).id
       other_event = events(:jane_website_agent_event).id
       other_event = events(:jane_website_agent_event).id
       post :remove_events, :id => agents(:bob_website_agent).to_param
       post :remove_events, :id => agents(:bob_website_agent).to_param
-      Event.where(:id => agent_event).count.should == 0
-      Event.where(:id => other_event).count.should == 1
+      expect(Event.where(:id => agent_event).count).to eq(0)
+      expect(Event.where(:id => other_event).count).to eq(1)
     end
     end
 
 
     it "can only be accessed by the Agent's owner" do
     it "can only be accessed by the Agent's owner" do
       sign_in users(:jane)
       sign_in users(:jane)
-      lambda {
+      expect {
         post :remove_events, :id => agents(:bob_website_agent).to_param
         post :remove_events, :id => agents(:bob_website_agent).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -79,11 +79,11 @@ describe AgentsController do
     it "only shows Agents for the current user" do
     it "only shows Agents for the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :show, :id => agents(:bob_website_agent).to_param
       get :show, :id => agents(:bob_website_agent).to_param
-      assigns(:agent).should eq(agents(:bob_website_agent))
+      expect(assigns(:agent)).to eq(agents(:bob_website_agent))
 
 
-      lambda {
+      expect {
         get :show, :id => agents(:jane_website_agent).to_param
         get :show, :id => agents(:jane_website_agent).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -91,15 +91,15 @@ describe AgentsController do
     it "opens a clone of a given Agent" do
     it "opens a clone of a given Agent" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :new, :id => agents(:bob_website_agent).to_param
       get :new, :id => agents(:bob_website_agent).to_param
-      assigns(:agent).attributes.should eq(users(:bob).agents.build_clone(agents(:bob_website_agent)).attributes)
+      expect(assigns(:agent).attributes).to eq(users(:bob).agents.build_clone(agents(:bob_website_agent)).attributes)
     end
     end
 
 
     it "only allows the current user to clone his own Agent" do
     it "only allows the current user to clone his own Agent" do
       sign_in users(:bob)
       sign_in users(:bob)
 
 
-      lambda {
+      expect {
         get :new, :id => agents(:jane_website_agent).to_param
         get :new, :id => agents(:jane_website_agent).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -107,11 +107,11 @@ describe AgentsController do
     it "only shows Agents for the current user" do
     it "only shows Agents for the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :edit, :id => agents(:bob_website_agent).to_param
       get :edit, :id => agents(:bob_website_agent).to_param
-      assigns(:agent).should eq(agents(:bob_website_agent))
+      expect(assigns(:agent)).to eq(agents(:bob_website_agent))
 
 
-      lambda {
+      expect {
         get :edit, :id => agents(:jane_website_agent).to_param
         get :edit, :id => agents(:jane_website_agent).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -121,28 +121,28 @@ describe AgentsController do
       expect {
       expect {
         post :create, :agent => valid_attributes(:type => "Agents::ThisIsFake")
         post :create, :agent => valid_attributes(:type => "Agents::ThisIsFake")
       }.not_to change { users(:bob).agents.count }
       }.not_to change { users(:bob).agents.count }
-      assigns(:agent).should be_a(Agent)
-      assigns(:agent).should have(1).error_on(:type)
+      expect(assigns(:agent)).to be_a(Agent)
+      expect(assigns(:agent)).to have(1).error_on(:type)
 
 
       sign_in users(:bob)
       sign_in users(:bob)
       expect {
       expect {
         post :create, :agent => valid_attributes(:type => "Object")
         post :create, :agent => valid_attributes(:type => "Object")
       }.not_to change { users(:bob).agents.count }
       }.not_to change { users(:bob).agents.count }
-      assigns(:agent).should be_a(Agent)
-      assigns(:agent).should have(1).error_on(:type)
+      expect(assigns(:agent)).to be_a(Agent)
+      expect(assigns(:agent)).to have(1).error_on(:type)
       sign_in users(:bob)
       sign_in users(:bob)
 
 
       expect {
       expect {
         post :create, :agent => valid_attributes(:type => "Agent")
         post :create, :agent => valid_attributes(:type => "Agent")
       }.not_to change { users(:bob).agents.count }
       }.not_to change { users(:bob).agents.count }
-      assigns(:agent).should be_a(Agent)
-      assigns(:agent).should have(1).error_on(:type)
+      expect(assigns(:agent)).to be_a(Agent)
+      expect(assigns(:agent)).to have(1).error_on(:type)
 
 
       expect {
       expect {
         post :create, :agent => valid_attributes(:type => "User")
         post :create, :agent => valid_attributes(:type => "User")
       }.not_to change { users(:bob).agents.count }
       }.not_to change { users(:bob).agents.count }
-      assigns(:agent).should be_a(Agent)
-      assigns(:agent).should have(1).error_on(:type)
+      expect(assigns(:agent)).to be_a(Agent)
+      expect(assigns(:agent)).to have(1).error_on(:type)
     end
     end
 
 
     it "creates Agents for the current user" do
     it "creates Agents for the current user" do
@@ -152,7 +152,7 @@ describe AgentsController do
           post :create, :agent => valid_attributes
           post :create, :agent => valid_attributes
         }.to change { users(:bob).agents.count }.by(1)
         }.to change { users(:bob).agents.count }.by(1)
       }.to change { Link.count }.by(1)
       }.to change { Link.count }.by(1)
-      assigns(:agent).should be_a(Agents::WebsiteAgent)
+      expect(assigns(:agent)).to be_a(Agents::WebsiteAgent)
     end
     end
 
 
     it "shows errors" do
     it "shows errors" do
@@ -160,8 +160,8 @@ describe AgentsController do
       expect {
       expect {
         post :create, :agent => valid_attributes(:name => "")
         post :create, :agent => valid_attributes(:name => "")
       }.not_to change { users(:bob).agents.count }
       }.not_to change { users(:bob).agents.count }
-      assigns(:agent).should have(1).errors_on(:name)
-      response.should render_template("new")
+      expect(assigns(:agent)).to have(1).errors_on(:name)
+      expect(response).to render_template("new")
     end
     end
 
 
     it "will not accept Agent sources owned by other users" do
     it "will not accept Agent sources owned by other users" do
@@ -178,46 +178,46 @@ describe AgentsController do
     it "does not allow changing types" do
     it "does not allow changing types" do
       sign_in users(:bob)
       sign_in users(:bob)
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:type => "Agents::WeatherAgent")
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:type => "Agents::WeatherAgent")
-      assigns(:agent).should have(1).errors_on(:type)
-      response.should render_template("edit")
+      expect(assigns(:agent)).to have(1).errors_on(:type)
+      expect(response).to render_template("edit")
     end
     end
 
 
     it "updates attributes on Agents for the current user" do
     it "updates attributes on Agents for the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name")
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name")
-      response.should redirect_to(agents_path)
-      agents(:bob_website_agent).reload.name.should == "New name"
+      expect(response).to redirect_to(agents_path)
+      expect(agents(:bob_website_agent).reload.name).to eq("New name")
 
 
-      lambda {
+      expect {
         post :update, :id => agents(:jane_website_agent).to_param, :agent => valid_attributes(:name => "New name")
         post :update, :id => agents(:jane_website_agent).to_param, :agent => valid_attributes(:name => "New name")
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
 
 
     it "accepts JSON requests" do
     it "accepts JSON requests" do
       sign_in users(:bob)
       sign_in users(:bob)
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :format => :json
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :format => :json
-      agents(:bob_website_agent).reload.name.should == "New name"
-      JSON.parse(response.body)['name'].should == "New name"
-      response.should be_success
+      expect(agents(:bob_website_agent).reload.name).to eq("New name")
+      expect(JSON.parse(response.body)['name']).to eq("New name")
+      expect(response).to be_success
     end
     end
 
 
     it "will not accept Agent sources owned by other users" do
     it "will not accept Agent sources owned by other users" do
       sign_in users(:bob)
       sign_in users(:bob)
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:source_ids => [agents(:jane_weather_agent).id])
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:source_ids => [agents(:jane_weather_agent).id])
-      assigns(:agent).should have(1).errors_on(:sources)
+      expect(assigns(:agent)).to have(1).errors_on(:sources)
     end
     end
 
 
     it "will not accept Scenarios owned by other users" do
     it "will not accept Scenarios owned by other users" do
       sign_in users(:bob)
       sign_in users(:bob)
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:scenario_ids => [scenarios(:jane_weather).id])
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:scenario_ids => [scenarios(:jane_weather).id])
-      assigns(:agent).should have(1).errors_on(:scenarios)
+      expect(assigns(:agent)).to have(1).errors_on(:scenarios)
     end
     end
 
 
     it "shows errors" do
     it "shows errors" do
       sign_in users(:bob)
       sign_in users(:bob)
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "")
       post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "")
-      assigns(:agent).should have(1).errors_on(:name)
-      response.should render_template("edit")
+      expect(assigns(:agent)).to have(1).errors_on(:name)
+      expect(response).to render_template("edit")
     end
     end
 
 
     describe "redirecting back" do
     describe "redirecting back" do
@@ -227,28 +227,28 @@ describe AgentsController do
 
 
       it "can redirect back to the show path" do
       it "can redirect back to the show path" do
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "show"
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "show"
-        response.should redirect_to(agent_path(agents(:bob_website_agent)))
+        expect(response).to redirect_to(agent_path(agents(:bob_website_agent)))
       end
       end
 
 
       it "redirect back to the index path by default" do
       it "redirect back to the index path by default" do
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name")
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name")
-        response.should redirect_to(agents_path)
+        expect(response).to redirect_to(agents_path)
       end
       end
 
 
       it "accepts return paths to scenarios" do
       it "accepts return paths to scenarios" do
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenarios/2"
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenarios/2"
-        response.should redirect_to("/scenarios/2")
+        expect(response).to redirect_to("/scenarios/2")
       end
       end
 
 
       it "sanitizes return paths" do
       it "sanitizes return paths" do
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenar"
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenar"
-        response.should redirect_to(agents_path)
+        expect(response).to redirect_to(agents_path)
 
 
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "http://google.com"
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "http://google.com"
-        response.should redirect_to(agents_path)
+        expect(response).to redirect_to(agents_path)
 
 
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "javascript:alert(1)"
         post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "javascript:alert(1)"
-        response.should redirect_to(agents_path)
+        expect(response).to redirect_to(agents_path)
       end
       end
     end
     end
 
 
@@ -260,8 +260,8 @@ describe AgentsController do
       agent.save!
       agent.save!
       post :update, id: agents(:bob_website_agent).to_param, agent: { disabled: 'false', drop_pending_events: 'true' }
       post :update, id: agents(:bob_website_agent).to_param, agent: { disabled: 'false', drop_pending_events: 'true' }
       agent.reload
       agent.reload
-      agent.disabled.should == false
-      agent.last_checked_event_id.should == Event.maximum(:id)
+      expect(agent.disabled).to eq(false)
+      expect(agent.last_checked_event_id).to eq(Event.maximum(:id))
     end
     end
   end
   end
 
 
@@ -269,15 +269,15 @@ describe AgentsController do
     it "removes an Agent from the given Scenario for the current user" do
     it "removes an Agent from the given Scenario for the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
 
 
-      agents(:bob_weather_agent).scenarios.should include(scenarios(:bob_weather))
+      expect(agents(:bob_weather_agent).scenarios).to include(scenarios(:bob_weather))
       put :leave_scenario, :id => agents(:bob_weather_agent).to_param, :scenario_id => scenarios(:bob_weather).to_param
       put :leave_scenario, :id => agents(:bob_weather_agent).to_param, :scenario_id => scenarios(:bob_weather).to_param
-      agents(:bob_weather_agent).scenarios.should_not include(scenarios(:bob_weather))
+      expect(agents(:bob_weather_agent).scenarios).not_to include(scenarios(:bob_weather))
 
 
-      Scenario.where(:id => scenarios(:bob_weather).id).should exist
+      expect(Scenario.where(:id => scenarios(:bob_weather).id)).to exist
 
 
-      lambda {
+      expect {
         put :leave_scenario, :id => agents(:jane_weather_agent).to_param, :scenario_id => scenarios(:jane_weather).to_param
         put :leave_scenario, :id => agents(:jane_weather_agent).to_param, :scenario_id => scenarios(:jane_weather).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -288,23 +288,23 @@ describe AgentsController do
         delete :destroy, :id => agents(:bob_website_agent).to_param
         delete :destroy, :id => agents(:bob_website_agent).to_param
       }.to change(Agent, :count).by(-1)
       }.to change(Agent, :count).by(-1)
 
 
-      lambda {
+      expect {
         delete :destroy, :id => agents(:jane_website_agent).to_param
         delete :destroy, :id => agents(:jane_website_agent).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
 
 
     it "redirects correctly when the Agent is deleted from the Agent itself" do
     it "redirects correctly when the Agent is deleted from the Agent itself" do
       sign_in users(:bob)
       sign_in users(:bob)
 
 
       delete :destroy, :id => agents(:bob_website_agent).to_param
       delete :destroy, :id => agents(:bob_website_agent).to_param
-      response.should redirect_to agents_path
+      expect(response).to redirect_to agents_path
     end
     end
 
 
     it "redirects correctly when the Agent is deleted from a Scenario" do
     it "redirects correctly when the Agent is deleted from a Scenario" do
       sign_in users(:bob)
       sign_in users(:bob)
 
 
       delete :destroy, :id => agents(:bob_weather_agent).to_param, :return => scenario_path(scenarios(:bob_weather)).to_param
       delete :destroy, :id => agents(:bob_weather_agent).to_param, :return => scenario_path(scenarios(:bob_weather)).to_param
-      response.should redirect_to scenario_path(scenarios(:bob_weather))
+      expect(response).to redirect_to scenario_path(scenarios(:bob_weather))
     end
     end
   end
   end
 end
 end

+ 9 - 9
spec/controllers/concerns/sortable_table_spec.rb

@@ -21,41 +21,41 @@ describe SortableTable do
     it "uses a default when no sort is given" do
     it "uses a default when no sort is given" do
       controller.params = {}
       controller.params = {}
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == default
+      expect(controller.table_sort).to eq(default)
     end
     end
 
 
     it "applies the given sort when one is passed in" do
     it "applies the given sort when one is passed in" do
       controller.params = { sort: "column1.desc" }
       controller.params = { sort: "column1.desc" }
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == { column1: :desc }
+      expect(controller.table_sort).to eq({ column1: :desc })
 
 
       controller.params = { sort: "column1.asc" }
       controller.params = { sort: "column1.asc" }
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == { column1: :asc }
+      expect(controller.table_sort).to eq({ column1: :asc })
 
 
       controller.params = { sort: "column2.desc" }
       controller.params = { sort: "column2.desc" }
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == { column2: :desc }
+      expect(controller.table_sort).to eq({ column2: :desc })
     end
     end
 
 
     it "ignores unknown directions" do
     it "ignores unknown directions" do
       controller.params = { sort: "column1.foo" }
       controller.params = { sort: "column1.foo" }
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == { column1: :asc }
+      expect(controller.table_sort).to eq({ column1: :asc })
 
 
       controller.params = { sort: "column1.foo drop tables" }
       controller.params = { sort: "column1.foo drop tables" }
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == { column1: :asc }
+      expect(controller.table_sort).to eq({ column1: :asc })
     end
     end
 
 
     it "ignores unknown columns" do
     it "ignores unknown columns" do
       controller.params = { sort: "foo.asc" }
       controller.params = { sort: "foo.asc" }
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == default
+      expect(controller.table_sort).to eq(default)
 
 
       controller.params = { sort: ";drop table;.asc" }
       controller.params = { sort: ";drop table;.asc" }
       controller.set_table_sort options
       controller.set_table_sort options
-      controller.table_sort.should == default
+      expect(controller.table_sort).to eq(default)
     end
     end
   end
   end
-end
+end

+ 21 - 21
spec/controllers/events_controller_spec.rb

@@ -2,26 +2,26 @@ require 'spec_helper'
 
 
 describe EventsController do
 describe EventsController do
   before do
   before do
-    Event.where(:user_id => users(:bob).id).count.should > 0
-    Event.where(:user_id => users(:jane).id).count.should > 0
+    expect(Event.where(:user_id => users(:bob).id).count).to be > 0
+    expect(Event.where(:user_id => users(:jane).id).count).to be > 0
   end
   end
 
 
   describe "GET index" do
   describe "GET index" do
     it "only returns Events created by Agents of the current user" do
     it "only returns Events created by Agents of the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :index
       get :index
-      assigns(:events).all? {|i| i.user.should == users(:bob) }.should be_truthy
+      expect(assigns(:events).all? {|i| expect(i.user).to eq(users(:bob)) }).to be_truthy
     end
     end
 
 
     it "can filter by Agent" do
     it "can filter by Agent" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :index, :agent_id => agents(:bob_website_agent)
       get :index, :agent_id => agents(:bob_website_agent)
-      assigns(:events).length.should == agents(:bob_website_agent).events.length
-      assigns(:events).all? {|i| i.agent.should == agents(:bob_website_agent) }.should be_truthy
+      expect(assigns(:events).length).to eq(agents(:bob_website_agent).events.length)
+      expect(assigns(:events).all? {|i| expect(i.agent).to eq(agents(:bob_website_agent)) }).to be_truthy
 
 
-      lambda {
+      expect {
         get :index, :agent_id => agents(:jane_website_agent)
         get :index, :agent_id => agents(:jane_website_agent)
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -29,11 +29,11 @@ describe EventsController do
     it "only shows Events for the current user" do
     it "only shows Events for the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :show, :id => events(:bob_website_agent_event).to_param
       get :show, :id => events(:bob_website_agent_event).to_param
-      assigns(:event).should eq(events(:bob_website_agent_event))
+      expect(assigns(:event)).to eq(events(:bob_website_agent_event))
 
 
-      lambda {
+      expect {
         get :show, :id => events(:jane_website_agent_event).to_param
         get :show, :id => events(:jane_website_agent_event).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -44,31 +44,31 @@ describe EventsController do
     end
     end
 
 
     it "clones and re-emits events" do
     it "clones and re-emits events" do
-      lambda {
+      expect {
         post :reemit, :id => events(:bob_website_agent_event).to_param
         post :reemit, :id => events(:bob_website_agent_event).to_param
-      }.should change { Event.count }.by(1)
-      Event.last.payload.should == events(:bob_website_agent_event).payload
-      Event.last.agent.should == events(:bob_website_agent_event).agent
-      Event.last.created_at.to_i.should be_within(2).of(Time.now.to_i)
+      }.to change { Event.count }.by(1)
+      expect(Event.last.payload).to eq(events(:bob_website_agent_event).payload)
+      expect(Event.last.agent).to eq(events(:bob_website_agent_event).agent)
+      expect(Event.last.created_at.to_i).to be_within(2).of(Time.now.to_i)
     end
     end
 
 
     it "can only re-emit Events for the current user" do
     it "can only re-emit Events for the current user" do
-      lambda {
+      expect {
         post :reemit, :id => events(:jane_website_agent_event).to_param
         post :reemit, :id => events(:jane_website_agent_event).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
   describe "DELETE destroy" do
   describe "DELETE destroy" do
     it "only deletes events for the current user" do
     it "only deletes events for the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
-      lambda {
+      expect {
         delete :destroy, :id => events(:bob_website_agent_event).to_param
         delete :destroy, :id => events(:bob_website_agent_event).to_param
-      }.should change { Event.count }.by(-1)
+      }.to change { Event.count }.by(-1)
 
 
-      lambda {
+      expect {
         delete :destroy, :id => events(:jane_website_agent_event).to_param
         delete :destroy, :id => events(:jane_website_agent_event).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 end
 end

+ 5 - 5
spec/controllers/jobs_controller_spec.rb

@@ -6,20 +6,20 @@ describe JobsController do
     before do
     before do
       Delayed::Job.create!
       Delayed::Job.create!
       Delayed::Job.create!
       Delayed::Job.create!
-      Delayed::Job.count.should > 0
+      expect(Delayed::Job.count).to be > 0
     end
     end
 
 
     it "does not allow normal users" do
     it "does not allow normal users" do
-      users(:bob).should_not be_admin
+      expect(users(:bob)).not_to be_admin
       sign_in users(:bob)
       sign_in users(:bob)
-      get(:index).should redirect_to(root_path)
+      expect(get(:index)).to redirect_to(root_path)
     end
     end
 
 
     it "returns all jobs" do
     it "returns all jobs" do
-      users(:jane).should be_admin
+      expect(users(:jane)).to be_admin
       sign_in users(:jane)
       sign_in users(:jane)
       get :index
       get :index
-      assigns(:jobs).length.should == 2
+      expect(assigns(:jobs).length).to eq(2)
     end
     end
   end
   end
 
 

+ 11 - 11
spec/controllers/logs_controller_spec.rb

@@ -5,15 +5,15 @@ describe LogsController do
     it "can filter by Agent" do
     it "can filter by Agent" do
       sign_in users(:bob)
       sign_in users(:bob)
       get :index, :agent_id => agents(:bob_weather_agent).id
       get :index, :agent_id => agents(:bob_weather_agent).id
-      assigns(:logs).length.should == agents(:bob_weather_agent).logs.length
-      assigns(:logs).all? {|i| i.agent.should == agents(:bob_weather_agent) }.should be_truthy
+      expect(assigns(:logs).length).to eq(agents(:bob_weather_agent).logs.length)
+      expect(assigns(:logs).all? {|i| expect(i.agent).to eq(agents(:bob_weather_agent)) }).to be_truthy
     end
     end
 
 
     it "only loads Agents owned by the current user" do
     it "only loads Agents owned by the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
-      lambda {
+      expect {
         get :index, :agent_id => agents(:jane_weather_agent).id
         get :index, :agent_id => agents(:jane_weather_agent).id
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -21,19 +21,19 @@ describe LogsController do
     it "deletes all logs for a specific Agent" do
     it "deletes all logs for a specific Agent" do
       agents(:bob_weather_agent).last_error_log_at = 2.hours.ago
       agents(:bob_weather_agent).last_error_log_at = 2.hours.ago
       sign_in users(:bob)
       sign_in users(:bob)
-      lambda {
+      expect {
         delete :clear, :agent_id => agents(:bob_weather_agent).id
         delete :clear, :agent_id => agents(:bob_weather_agent).id
-      }.should change { AgentLog.count }.by(-1 * agents(:bob_weather_agent).logs.count)
-      assigns(:logs).length.should == 0
-      agents(:bob_weather_agent).reload.logs.count.should == 0
-      agents(:bob_weather_agent).last_error_log_at.should be_nil
+      }.to change { AgentLog.count }.by(-1 * agents(:bob_weather_agent).logs.count)
+      expect(assigns(:logs).length).to eq(0)
+      expect(agents(:bob_weather_agent).reload.logs.count).to eq(0)
+      expect(agents(:bob_weather_agent).last_error_log_at).to be_nil
     end
     end
 
 
     it "only deletes logs for an Agent owned by the current user" do
     it "only deletes logs for an Agent owned by the current user" do
       sign_in users(:bob)
       sign_in users(:bob)
-      lambda {
+      expect {
         delete :clear, :agent_id => agents(:jane_weather_agent).id
         delete :clear, :agent_id => agents(:jane_weather_agent).id
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 end
 end

+ 6 - 6
spec/controllers/scenario_imports_controller_spec.rb

@@ -8,18 +8,18 @@ describe ScenarioImportsController do
   describe "GET new" do
   describe "GET new" do
     it "initializes a new ScenarioImport and renders new" do
     it "initializes a new ScenarioImport and renders new" do
       get :new
       get :new
-      assigns(:scenario_import).should be_a(ScenarioImport)
-      response.should render_template(:new)
+      expect(assigns(:scenario_import)).to be_a(ScenarioImport)
+      expect(response).to render_template(:new)
     end
     end
   end
   end
 
 
   describe "POST create" do
   describe "POST create" do
     it "initializes a ScenarioImport for current_user, passing in params" do
     it "initializes a ScenarioImport for current_user, passing in params" do
       post :create, :scenario_import => { :url => "bad url" }
       post :create, :scenario_import => { :url => "bad url" }
-      assigns(:scenario_import).user.should == users(:bob)
-      assigns(:scenario_import).url.should == "bad url"
-      assigns(:scenario_import).should_not be_valid
-      response.should render_template(:new)
+      expect(assigns(:scenario_import).user).to eq(users(:bob))
+      expect(assigns(:scenario_import).url).to eq("bad url")
+      expect(assigns(:scenario_import)).not_to be_valid
+      expect(response).to render_template(:new)
     end
     end
   end
   end
 end
 end

+ 40 - 40
spec/controllers/scenarios_controller_spec.rb

@@ -12,59 +12,59 @@ describe ScenariosController do
   describe "GET index" do
   describe "GET index" do
     it "only returns Scenarios for the current user" do
     it "only returns Scenarios for the current user" do
       get :index
       get :index
-      assigns(:scenarios).all? {|i| i.user.should == users(:bob) }.should be_truthy
+      expect(assigns(:scenarios).all? {|i| expect(i.user).to eq(users(:bob)) }).to be_truthy
     end
     end
   end
   end
 
 
   describe "GET show" do
   describe "GET show" do
     it "only shows Scenarios for the current user" do
     it "only shows Scenarios for the current user" do
       get :show, :id => scenarios(:bob_weather).to_param
       get :show, :id => scenarios(:bob_weather).to_param
-      assigns(:scenario).should eq(scenarios(:bob_weather))
+      expect(assigns(:scenario)).to eq(scenarios(:bob_weather))
 
 
-      lambda {
+      expect {
         get :show, :id => scenarios(:jane_weather).to_param
         get :show, :id => scenarios(:jane_weather).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
 
 
     it "loads Agents for the requested Scenario" do
     it "loads Agents for the requested Scenario" do
       get :show, :id => scenarios(:bob_weather).to_param
       get :show, :id => scenarios(:bob_weather).to_param
-      assigns(:agents).pluck(:id).should eq(scenarios(:bob_weather).agents.pluck(:id))
+      expect(assigns(:agents).pluck(:id)).to eq(scenarios(:bob_weather).agents.pluck(:id))
     end
     end
   end
   end
 
 
   describe "GET share" do
   describe "GET share" do
     it "only displays Scenario share information for the current user" do
     it "only displays Scenario share information for the current user" do
       get :share, :id => scenarios(:bob_weather).to_param
       get :share, :id => scenarios(:bob_weather).to_param
-      assigns(:scenario).should eq(scenarios(:bob_weather))
+      expect(assigns(:scenario)).to eq(scenarios(:bob_weather))
 
 
-      lambda {
+      expect {
         get :share, :id => scenarios(:jane_weather).to_param
         get :share, :id => scenarios(:jane_weather).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
   describe "GET export" do
   describe "GET export" do
     it "returns a JSON file download from an instantiated AgentsExporter" do
     it "returns a JSON file download from an instantiated AgentsExporter" do
       get :export, :id => scenarios(:bob_weather).to_param
       get :export, :id => scenarios(:bob_weather).to_param
-      assigns(:exporter).options[:name].should == scenarios(:bob_weather).name
-      assigns(:exporter).options[:description].should == scenarios(:bob_weather).description
-      assigns(:exporter).options[:agents].should == scenarios(:bob_weather).agents
-      assigns(:exporter).options[:guid].should == scenarios(:bob_weather).guid
-      assigns(:exporter).options[:tag_fg_color].should == scenarios(:bob_weather).tag_fg_color
-      assigns(:exporter).options[:tag_bg_color].should == scenarios(:bob_weather).tag_bg_color
-      assigns(:exporter).options[:source_url].should be_falsey
-      response.headers['Content-Disposition'].should == 'attachment; filename="bob-s-weather-alert-scenario.json"'
-      response.headers['Content-Type'].should == 'application/json; charset=utf-8'
-      JSON.parse(response.body)["name"].should == scenarios(:bob_weather).name
+      expect(assigns(:exporter).options[:name]).to eq(scenarios(:bob_weather).name)
+      expect(assigns(:exporter).options[:description]).to eq(scenarios(:bob_weather).description)
+      expect(assigns(:exporter).options[:agents]).to eq(scenarios(:bob_weather).agents)
+      expect(assigns(:exporter).options[:guid]).to eq(scenarios(:bob_weather).guid)
+      expect(assigns(:exporter).options[:tag_fg_color]).to eq(scenarios(:bob_weather).tag_fg_color)
+      expect(assigns(:exporter).options[:tag_bg_color]).to eq(scenarios(:bob_weather).tag_bg_color)
+      expect(assigns(:exporter).options[:source_url]).to be_falsey
+      expect(response.headers['Content-Disposition']).to eq('attachment; filename="bob-s-weather-alert-scenario.json"')
+      expect(response.headers['Content-Type']).to eq('application/json; charset=utf-8')
+      expect(JSON.parse(response.body)["name"]).to eq(scenarios(:bob_weather).name)
     end
     end
 
 
     it "only exports private Scenarios for the current user" do
     it "only exports private Scenarios for the current user" do
       get :export, :id => scenarios(:bob_weather).to_param
       get :export, :id => scenarios(:bob_weather).to_param
-      assigns(:scenario).should eq(scenarios(:bob_weather))
+      expect(assigns(:scenario)).to eq(scenarios(:bob_weather))
 
 
-      lambda {
+      expect {
         get :export, :id => scenarios(:jane_weather).to_param
         get :export, :id => scenarios(:jane_weather).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
 
 
     describe "public exports" do
     describe "public exports" do
@@ -74,15 +74,15 @@ describe ScenariosController do
 
 
       it "exports public scenarios for other users when logged in" do
       it "exports public scenarios for other users when logged in" do
         get :export, :id => scenarios(:jane_weather).to_param
         get :export, :id => scenarios(:jane_weather).to_param
-        assigns(:scenario).should eq(scenarios(:jane_weather))
-        assigns(:exporter).options[:source_url].should == export_scenario_url(scenarios(:jane_weather))
+        expect(assigns(:scenario)).to eq(scenarios(:jane_weather))
+        expect(assigns(:exporter).options[:source_url]).to eq(export_scenario_url(scenarios(:jane_weather)))
       end
       end
 
 
       it "exports public scenarios for other users when logged out" do
       it "exports public scenarios for other users when logged out" do
         sign_out :user
         sign_out :user
         get :export, :id => scenarios(:jane_weather).to_param
         get :export, :id => scenarios(:jane_weather).to_param
-        assigns(:scenario).should eq(scenarios(:jane_weather))
-        assigns(:exporter).options[:source_url].should == export_scenario_url(scenarios(:jane_weather))
+        expect(assigns(:scenario)).to eq(scenarios(:jane_weather))
+        expect(assigns(:exporter).options[:source_url]).to eq(export_scenario_url(scenarios(:jane_weather)))
       end
       end
     end
     end
   end
   end
@@ -90,11 +90,11 @@ describe ScenariosController do
   describe "GET edit" do
   describe "GET edit" do
     it "only shows Scenarios for the current user" do
     it "only shows Scenarios for the current user" do
       get :edit, :id => scenarios(:bob_weather).to_param
       get :edit, :id => scenarios(:bob_weather).to_param
-      assigns(:scenario).should eq(scenarios(:bob_weather))
+      expect(assigns(:scenario)).to eq(scenarios(:bob_weather))
 
 
-      lambda {
+      expect {
         get :edit, :id => scenarios(:jane_weather).to_param
         get :edit, :id => scenarios(:jane_weather).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -109,8 +109,8 @@ describe ScenariosController do
       expect {
       expect {
         post :create, :scenario => valid_attributes(:name => "")
         post :create, :scenario => valid_attributes(:name => "")
       }.not_to change { users(:bob).scenarios.count }
       }.not_to change { users(:bob).scenarios.count }
-      assigns(:scenario).should have(1).errors_on(:name)
-      response.should render_template("new")
+      expect(assigns(:scenario)).to have(1).errors_on(:name)
+      expect(response).to render_template("new")
     end
     end
 
 
     it "will not create Scenarios for other users" do
     it "will not create Scenarios for other users" do
@@ -123,20 +123,20 @@ describe ScenariosController do
   describe "PUT update" do
   describe "PUT update" do
     it "updates attributes on Scenarios for the current user" do
     it "updates attributes on Scenarios for the current user" do
       post :update, :id => scenarios(:bob_weather).to_param, :scenario => { :name => "new_name", :public => "1" }
       post :update, :id => scenarios(:bob_weather).to_param, :scenario => { :name => "new_name", :public => "1" }
-      response.should redirect_to(scenario_path(scenarios(:bob_weather)))
-      scenarios(:bob_weather).reload.name.should == "new_name"
-      scenarios(:bob_weather).should be_public
+      expect(response).to redirect_to(scenario_path(scenarios(:bob_weather)))
+      expect(scenarios(:bob_weather).reload.name).to eq("new_name")
+      expect(scenarios(:bob_weather)).to be_public
 
 
-      lambda {
+      expect {
         post :update, :id => scenarios(:jane_weather).to_param, :scenario => { :name => "new_name" }
         post :update, :id => scenarios(:jane_weather).to_param, :scenario => { :name => "new_name" }
-      }.should raise_error(ActiveRecord::RecordNotFound)
-      scenarios(:jane_weather).reload.name.should_not == "new_name"
+      }.to raise_error(ActiveRecord::RecordNotFound)
+      expect(scenarios(:jane_weather).reload.name).not_to eq("new_name")
     end
     end
 
 
     it "shows errors" do
     it "shows errors" do
       post :update, :id => scenarios(:bob_weather).to_param, :scenario => { :name => "" }
       post :update, :id => scenarios(:bob_weather).to_param, :scenario => { :name => "" }
-      assigns(:scenario).should have(1).errors_on(:name)
-      response.should render_template("edit")
+      expect(assigns(:scenario)).to have(1).errors_on(:name)
+      expect(response).to render_template("edit")
     end
     end
   end
   end
 
 
@@ -146,9 +146,9 @@ describe ScenariosController do
         delete :destroy, :id => scenarios(:bob_weather).to_param
         delete :destroy, :id => scenarios(:bob_weather).to_param
       }.to change(Scenario, :count).by(-1)
       }.to change(Scenario, :count).by(-1)
 
 
-      lambda {
+      expect {
         delete :destroy, :id => scenarios(:jane_weather).to_param
         delete :destroy, :id => scenarios(:jane_weather).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 end
 end

+ 7 - 7
spec/controllers/services_controller_spec.rb

@@ -10,21 +10,21 @@ describe ServicesController do
   describe "GET index" do
   describe "GET index" do
     it "only returns sevices of the current user" do
     it "only returns sevices of the current user" do
       get :index
       get :index
-      assigns(:services).all? {|i| i.user.should == users(:bob) }.should == true
+      expect(assigns(:services).all? {|i| expect(i.user).to eq(users(:bob)) }).to eq(true)
     end
     end
   end
   end
 
 
   describe "POST toggle_availability" do
   describe "POST toggle_availability" do
     it "should work for service of the user" do
     it "should work for service of the user" do
       post :toggle_availability, :id => services(:generic).to_param
       post :toggle_availability, :id => services(:generic).to_param
-      assigns(:service).should eq(services(:generic))
+      expect(assigns(:service)).to eq(services(:generic))
       redirect_to(services_path)
       redirect_to(services_path)
     end
     end
 
 
     it "should not work for a service of another user" do
     it "should not work for a service of another user" do
-      lambda {
+      expect {
         post :toggle_availability, :id => services(:global).to_param
         post :toggle_availability, :id => services(:global).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -34,9 +34,9 @@ describe ServicesController do
         delete :destroy, :id => services(:generic).to_param
         delete :destroy, :id => services(:generic).to_param
       }.to change(Service, :count).by(-1)
       }.to change(Service, :count).by(-1)
 
 
-      lambda {
+      expect {
         delete :destroy, :id => services(:global).to_param
         delete :destroy, :id => services(:global).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -52,7 +52,7 @@ describe ServicesController do
       expect {
       expect {
         get :callback, provider: 'unknown'
         get :callback, provider: 'unknown'
       }.to change { users(:bob).services.count }.by(1)
       }.to change { users(:bob).services.count }.by(1)
-      users(:bob).services.first.provider.should == 'unknown'
+      expect(users(:bob).services.first.provider).to eq('unknown')
     end
     end
   end
   end
 end
 end

+ 15 - 15
spec/controllers/user_credentials_controller_spec.rb

@@ -15,18 +15,18 @@ describe UserCredentialsController do
   describe "GET index" do
   describe "GET index" do
     it "only returns UserCredentials for the current user" do
     it "only returns UserCredentials for the current user" do
       get :index
       get :index
-      assigns(:user_credentials).all? {|i| i.user.should == users(:bob) }.should be_truthy
+      expect(assigns(:user_credentials).all? {|i| expect(i.user).to eq(users(:bob)) }).to be_truthy
     end
     end
   end
   end
 
 
   describe "GET edit" do
   describe "GET edit" do
     it "only shows UserCredentials for the current user" do
     it "only shows UserCredentials for the current user" do
       get :edit, :id => user_credentials(:bob_aws_secret).to_param
       get :edit, :id => user_credentials(:bob_aws_secret).to_param
-      assigns(:user_credential).should eq(user_credentials(:bob_aws_secret))
+      expect(assigns(:user_credential)).to eq(user_credentials(:bob_aws_secret))
 
 
-      lambda {
+      expect {
         get :edit, :id => user_credentials(:jane_aws_secret).to_param
         get :edit, :id => user_credentials(:jane_aws_secret).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 
 
@@ -41,8 +41,8 @@ describe UserCredentialsController do
       expect {
       expect {
         post :create, :user_credential => valid_attributes(:credential_name => "")
         post :create, :user_credential => valid_attributes(:credential_name => "")
       }.not_to change { users(:bob).user_credentials.count }
       }.not_to change { users(:bob).user_credentials.count }
-      assigns(:user_credential).should have(1).errors_on(:credential_name)
-      response.should render_template("new")
+      expect(assigns(:user_credential)).to have(1).errors_on(:credential_name)
+      expect(response).to render_template("new")
     end
     end
 
 
     it "will not create UserCredentials for other users" do
     it "will not create UserCredentials for other users" do
@@ -55,19 +55,19 @@ describe UserCredentialsController do
   describe "PUT update" do
   describe "PUT update" do
     it "updates attributes on UserCredentials for the current user" do
     it "updates attributes on UserCredentials for the current user" do
       post :update, :id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "new_name" }
       post :update, :id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "new_name" }
-      response.should redirect_to(user_credentials_path)
-      user_credentials(:bob_aws_key).reload.credential_name.should == "new_name"
+      expect(response).to redirect_to(user_credentials_path)
+      expect(user_credentials(:bob_aws_key).reload.credential_name).to eq("new_name")
 
 
-      lambda {
+      expect {
         post :update, :id => user_credentials(:jane_aws_key).to_param, :user_credential => { :credential_name => "new_name" }
         post :update, :id => user_credentials(:jane_aws_key).to_param, :user_credential => { :credential_name => "new_name" }
-      }.should raise_error(ActiveRecord::RecordNotFound)
-      user_credentials(:jane_aws_key).reload.credential_name.should_not == "new_name"
+      }.to raise_error(ActiveRecord::RecordNotFound)
+      expect(user_credentials(:jane_aws_key).reload.credential_name).not_to eq("new_name")
     end
     end
 
 
     it "shows errors" do
     it "shows errors" do
       post :update, :id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "" }
       post :update, :id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "" }
-      assigns(:user_credential).should have(1).errors_on(:credential_name)
-      response.should render_template("edit")
+      expect(assigns(:user_credential)).to have(1).errors_on(:credential_name)
+      expect(response).to render_template("edit")
     end
     end
   end
   end
 
 
@@ -77,9 +77,9 @@ describe UserCredentialsController do
         delete :destroy, :id => user_credentials(:bob_aws_key).to_param
         delete :destroy, :id => user_credentials(:bob_aws_key).to_param
       }.to change(UserCredential, :count).by(-1)
       }.to change(UserCredential, :count).by(-1)
 
 
-      lambda {
+      expect {
         delete :destroy, :id => user_credentials(:jane_aws_key).to_param
         delete :destroy, :id => user_credentials(:jane_aws_key).to_param
-      }.should raise_error(ActiveRecord::RecordNotFound)
+      }.to raise_error(ActiveRecord::RecordNotFound)
     end
     end
   end
   end
 end
 end

+ 39 - 39
spec/controllers/web_requests_controller_spec.rb

@@ -25,74 +25,74 @@ describe WebRequestsController do
   end
   end
 
 
   it "should not require login to receive a web request" do
   it "should not require login to receive a web request" do
-    @agent.last_web_request_at.should be_nil
+    expect(@agent.last_web_request_at).to be_nil
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
-    @agent.reload.last_web_request_at.should be_within(2).of(Time.now)
-    response.body.should == "success"
-    response.should be_success
+    expect(@agent.reload.last_web_request_at).to be_within(2).of(Time.now)
+    expect(response.body).to eq("success")
+    expect(response).to be_success
   end
   end
 
 
   it "should call receive_web_request" do
   it "should call receive_web_request" do
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
     @agent.reload
     @agent.reload
-    @agent.memory[:web_request_values].should == { 'key' => "value", 'another_key' => "5" }
-    @agent.memory[:web_request_format].should == "text/html"
-    @agent.memory[:web_request_method].should == "post"
-    response.body.should == "success"
-    response.headers['Content-Type'].should == 'text/plain; charset=utf-8'
-    response.should be_success
+    expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
+    expect(@agent.memory[:web_request_format]).to eq("text/html")
+    expect(@agent.memory[:web_request_method]).to eq("post")
+    expect(response.body).to eq("success")
+    expect(response.headers['Content-Type']).to eq('text/plain; charset=utf-8')
+    expect(response).to be_success
 
 
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "not_my_secret", :no => "go"
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "not_my_secret", :no => "go"
-    @agent.reload.memory[:web_request_values].should_not == { 'no' => "go" }
-    response.body.should == "failure"
-    response.should be_missing
+    expect(@agent.reload.memory[:web_request_values]).not_to eq({ 'no' => "go" })
+    expect(response.body).to eq("failure")
+    expect(response).to be_missing
   end
   end
 
 
   it "should accept gets" do
   it "should accept gets" do
     get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
     get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
     @agent.reload
     @agent.reload
-    @agent.memory[:web_request_values].should == { 'key' => "value", 'another_key' => "5" }
-    @agent.memory[:web_request_format].should == "text/html"
-    @agent.memory[:web_request_method].should == "get"
-    response.body.should == "success"
-    response.should be_success
+    expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
+    expect(@agent.memory[:web_request_format]).to eq("text/html")
+    expect(@agent.memory[:web_request_method]).to eq("get")
+    expect(response.body).to eq("success")
+    expect(response).to be_success
   end
   end
 
 
   it "should pass through the received format" do
   it "should pass through the received format" do
     get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :json
     get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :json
     @agent.reload
     @agent.reload
-    @agent.memory[:web_request_values].should == { 'key' => "value", 'another_key' => "5" }
-    @agent.memory[:web_request_format].should == "application/json"
-    @agent.memory[:web_request_method].should == "get"
+    expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
+    expect(@agent.memory[:web_request_format]).to eq("application/json")
+    expect(@agent.memory[:web_request_method]).to eq("get")
 
 
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :xml
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :xml
     @agent.reload
     @agent.reload
-    @agent.memory[:web_request_values].should == { 'key' => "value", 'another_key' => "5" }
-    @agent.memory[:web_request_format].should == "application/xml"
-    @agent.memory[:web_request_method].should == "post"
+    expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
+    expect(@agent.memory[:web_request_format]).to eq("application/xml")
+    expect(@agent.memory[:web_request_method]).to eq("post")
 
 
     put :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :atom
     put :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :atom
     @agent.reload
     @agent.reload
-    @agent.memory[:web_request_values].should == { 'key' => "value", 'another_key' => "5" }
-    @agent.memory[:web_request_format].should == "application/atom+xml"
-    @agent.memory[:web_request_method].should == "put"
+    expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
+    expect(@agent.memory[:web_request_format]).to eq("application/atom+xml")
+    expect(@agent.memory[:web_request_method]).to eq("put")
   end
   end
 
 
   it "can accept a content-type to return" do
   it "can accept a content-type to return" do
     @agent.memory['content_type'] = 'application/json'
     @agent.memory['content_type'] = 'application/json'
     @agent.save!
     @agent.save!
     get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
     get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"
-    response.headers['Content-Type'].should == 'application/json; charset=utf-8'
+    expect(response.headers['Content-Type']).to eq('application/json; charset=utf-8')
   end
   end
 
 
   it "should fail on incorrect users" do
   it "should fail on incorrect users" do
     post :handle_request, :user_id => users(:jane).to_param, :agent_id => @agent.id, :secret => "my_secret", :no => "go"
     post :handle_request, :user_id => users(:jane).to_param, :agent_id => @agent.id, :secret => "my_secret", :no => "go"
-    response.should be_missing
+    expect(response).to be_missing
   end
   end
 
 
   it "should fail on incorrect agents" do
   it "should fail on incorrect agents" do
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => 454545, :secret => "my_secret", :no => "go"
     post :handle_request, :user_id => users(:bob).to_param, :agent_id => 454545, :secret => "my_secret", :no => "go"
-    response.should be_missing
+    expect(response).to be_missing
   end
   end
 
 
   describe "legacy update_location endpoint" do
   describe "legacy update_location endpoint" do
@@ -103,9 +103,9 @@ describe WebRequestsController do
 
 
     it "should create events without requiring login" do
     it "should create events without requiring login" do
       post :update_location, user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else"
       post :update_location, user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else"
-      @agent.events.last.payload.should == { 'longitude' => "123", 'latitude' => "45", 'something' => "else" }
-      @agent.events.last.lat.should == 45
-      @agent.events.last.lng.should == 123
+      expect(@agent.events.last.payload).to eq({ 'longitude' => "123", 'latitude' => "45", 'something' => "else" })
+      expect(@agent.events.last.lat).to eq(45)
+      expect(@agent.events.last.lng).to eq(123)
     end
     end
 
 
     it "should only consider Agents::UserLocationAgents for the given user" do
     it "should only consider Agents::UserLocationAgents for the given user" do
@@ -113,23 +113,23 @@ describe WebRequestsController do
       @jane_agent.save!
       @jane_agent.save!
 
 
       post :update_location, user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else"
       post :update_location, user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else"
-      @agent.events.last.payload.should == { 'longitude' => "123", 'latitude' => "45", 'something' => "else" }
-      @jane_agent.events.should be_empty
+      expect(@agent.events.last.payload).to eq({ 'longitude' => "123", 'latitude' => "45", 'something' => "else" })
+      expect(@jane_agent.events).to be_empty
     end
     end
 
 
     it "should raise a 404 error when given an invalid user id" do
     it "should raise a 404 error when given an invalid user id" do
       post :update_location, user_id: "123", secret: "not_my_secret", longitude: 123, latitude: 45, something: "else"
       post :update_location, user_id: "123", secret: "not_my_secret", longitude: 123, latitude: 45, something: "else"
-      response.should be_missing
+      expect(response).to be_missing
     end
     end
 
 
     it "should only look at agents with the given secret" do
     it "should only look at agents with the given secret" do
       @agent2 = Agent.build_for_type("Agents::UserLocationAgent", users(:bob), name: "something", options: { secret: "my_secret2" })
       @agent2 = Agent.build_for_type("Agents::UserLocationAgent", users(:bob), name: "something", options: { secret: "my_secret2" })
       @agent2.save!
       @agent2.save!
 
 
-      lambda {
+      expect {
         post :update_location, user_id: users(:bob).to_param, secret: "my_secret2", longitude: 123, latitude: 45, something: "else"
         post :update_location, user_id: users(:bob).to_param, secret: "my_secret2", longitude: 123, latitude: 45, something: "else"
-        @agent2.events.last.payload.should == { 'longitude' => "123", 'latitude' => "45", 'something' => "else" }
-      }.should_not change { @agent.events.count }
+        expect(@agent2.events.last.payload).to eq({ 'longitude' => "123", 'latitude' => "45", 'something' => "else" })
+      }.not_to change { @agent.events.count }
     end
     end
   end
   end
 end
 end

+ 6 - 6
spec/helpers/dot_helper_spec.rb

@@ -54,7 +54,7 @@ describe DotHelper do
       end
       end
 
 
       it "generates a DOT script" do
       it "generates a DOT script" do
-        agents_dot(@agents).should =~ %r{
+        expect(agents_dot(@agents)).to match(%r{
           \A
           \A
           digraph \x20 "Agent \x20 Event \x20 Flow" \{
           digraph \x20 "Agent \x20 Event \x20 Flow" \{
             node \[ [^\]]+ \];
             node \[ [^\]]+ \];
@@ -68,11 +68,11 @@ describe DotHelper do
             \k<bar3> \[label=bar3\];
             \k<bar3> \[label=bar3\];
           \}
           \}
           \z
           \z
-        }x
+        }x)
       end
       end
 
 
       it "generates a richer DOT script" do
       it "generates a richer DOT script" do
-        agents_dot(@agents, true).should =~ %r{
+        expect(agents_dot(@agents, true)).to match(%r{
           \A
           \A
           digraph \x20 "Agent \x20 Event \x20 Flow" \{
           digraph \x20 "Agent \x20 Event \x20 Flow" \{
             node \[ [^\]]+ \];
             node \[ [^\]]+ \];
@@ -86,7 +86,7 @@ describe DotHelper do
             \k<bar3> \[label=bar3,tooltip="Dot \x20 Bar",URL="#{Regexp.quote(agent_path(@bar3))}"\];
             \k<bar3> \[label=bar3,tooltip="Dot \x20 Bar",URL="#{Regexp.quote(agent_path(@bar3))}"\];
           \}
           \}
           \z
           \z
-        }x
+        }x)
       end
       end
     end
     end
   end
   end
@@ -94,9 +94,9 @@ describe DotHelper do
   describe "DotHelper::DotDrawer" do
   describe "DotHelper::DotDrawer" do
     describe "#id" do
     describe "#id" do
       it "properly escapes double quotaion and backslash" do
       it "properly escapes double quotaion and backslash" do
-        DotHelper::DotDrawer.draw(foo: "") {
+        expect(DotHelper::DotDrawer.draw(foo: "") {
           id('hello\\"')
           id('hello\\"')
-        }.should == '"hello\\\\\\""'
+        }).to eq('"hello\\\\\\""')
       end
       end
     end
     end
   end
   end

+ 5 - 5
spec/helpers/jobs_helper_spec.rb

@@ -6,27 +6,27 @@ describe JobsHelper do
   describe '#status' do
   describe '#status' do
     it "works for failed jobs" do
     it "works for failed jobs" do
       job.failed_at = Time.now
       job.failed_at = Time.now
-      status(job).should == '<span class="label label-danger">failed</span>'
+      expect(status(job)).to eq('<span class="label label-danger">failed</span>')
     end
     end
 
 
     it "works for running jobs" do
     it "works for running jobs" do
       job.locked_at = Time.now
       job.locked_at = Time.now
       job.locked_by = 'test'
       job.locked_by = 'test'
-      status(job).should == '<span class="label label-info">running</span>'
+      expect(status(job)).to eq('<span class="label label-info">running</span>')
     end
     end
 
 
     it "works for queued jobs" do
     it "works for queued jobs" do
-      status(job).should == '<span class="label label-warning">queued</span>'
+      expect(status(job)).to eq('<span class="label label-warning">queued</span>')
     end
     end
   end
   end
 
 
   describe '#relative_distance_of_time_in_words' do
   describe '#relative_distance_of_time_in_words' do
     it "in the past" do
     it "in the past" do
-      relative_distance_of_time_in_words(Time.now-5.minutes).should == '5m ago'
+      expect(relative_distance_of_time_in_words(Time.now-5.minutes)).to eq('5m ago')
     end
     end
 
 
     it "in the future" do
     it "in the future" do
-      relative_distance_of_time_in_words(Time.now+5.minutes).should == 'in 5m'
+      expect(relative_distance_of_time_in_words(Time.now+5.minutes)).to eq('in 5m')
     end
     end
   end
   end
 end
 end

+ 2 - 2
spec/helpers/markdown_helper_spec.rb

@@ -5,8 +5,8 @@ describe MarkdownHelper do
   describe '#markdown' do
   describe '#markdown' do
 
 
     it 'renders HTML from a markdown text' do
     it 'renders HTML from a markdown text' do
-      markdown('# Header').should =~ /<h1>Header<\/h1>/
-      markdown('## Header 2').should =~ /<h2>Header 2<\/h2>/
+      expect(markdown('# Header')).to match(/<h1>Header<\/h1>/)
+      expect(markdown('## Header 2')).to match(/<h2>Header 2<\/h2>/)
     end
     end
 
 
   end
   end

+ 6 - 4
spec/helpers/scenario_helper_spec.rb

@@ -5,25 +5,27 @@ describe ScenarioHelper do
 
 
   describe '#style_colors' do
   describe '#style_colors' do
     it 'returns a css style-formated version of the scenario foreground and background colors' do
     it 'returns a css style-formated version of the scenario foreground and background colors' do
-      style_colors(scenario).should == "color:#AAAAAA;background-color:#000000"
+      expect(style_colors(scenario)).to eq("color:#AAAAAA;background-color:#000000")
     end
     end
 
 
     it 'defauls foreground and background colors' do
     it 'defauls foreground and background colors' do
       scenario.tag_fg_color = nil
       scenario.tag_fg_color = nil
       scenario.tag_bg_color = nil
       scenario.tag_bg_color = nil
-      style_colors(scenario).should == "color:#FFFFFF;background-color:#5BC0DE"
+      expect(style_colors(scenario)).to eq("color:#FFFFFF;background-color:#5BC0DE")
     end
     end
   end
   end
 
 
   describe '#scenario_label' do
   describe '#scenario_label' do
     it 'creates a scenario label with the scenario name' do
     it 'creates a scenario label with the scenario name' do
-      scenario_label(scenario).should ==
+      expect(scenario_label(scenario)).to eq(
         '<span class="label scenario" style="color:#AAAAAA;background-color:#000000">Scene</span>'
         '<span class="label scenario" style="color:#AAAAAA;background-color:#000000">Scene</span>'
+      )
     end
     end
 
 
     it 'creates a scenario label with the given text' do
     it 'creates a scenario label with the given text' do
-      scenario_label(scenario, 'Other').should ==
+      expect(scenario_label(scenario, 'Other')).to eq(
         '<span class="label scenario" style="color:#AAAAAA;background-color:#000000">Other</span>'
         '<span class="label scenario" style="color:#AAAAAA;background-color:#000000">Other</span>'
+      )
     end
     end
   end
   end
 
 

+ 21 - 21
spec/lib/agents_exporter_spec.rb

@@ -17,51 +17,51 @@ describe AgentsExporter do
 
 
     it "outputs a structure containing name, description, the date, all agents & their links" do
     it "outputs a structure containing name, description, the date, all agents & their links" do
       data = exporter.as_json
       data = exporter.as_json
-      data[:name].should == name
-      data[:description].should == description
-      data[:source_url].should == source_url
-      data[:guid].should == guid
-      data[:tag_fg_color].should == tag_fg_color
-      data[:tag_bg_color].should == tag_bg_color
-      Time.parse(data[:exported_at]).should be_within(2).of(Time.now.utc)
-      data[:links].should == [{ :source => 0, :receiver => 1 }]
-      data[:agents].should == agent_list.map { |agent| exporter.agent_as_json(agent) }
-      data[:agents].all? { |agent_json| agent_json[:guid].present? && agent_json[:type].present? && agent_json[:name].present? }.should be_truthy
+      expect(data[:name]).to eq(name)
+      expect(data[:description]).to eq(description)
+      expect(data[:source_url]).to eq(source_url)
+      expect(data[:guid]).to eq(guid)
+      expect(data[:tag_fg_color]).to eq(tag_fg_color)
+      expect(data[:tag_bg_color]).to eq(tag_bg_color)
+      expect(Time.parse(data[:exported_at])).to be_within(2).of(Time.now.utc)
+      expect(data[:links]).to eq([{ :source => 0, :receiver => 1 }])
+      expect(data[:agents]).to eq(agent_list.map { |agent| exporter.agent_as_json(agent) })
+      expect(data[:agents].all? { |agent_json| agent_json[:guid].present? && agent_json[:type].present? && agent_json[:name].present? }).to be_truthy
 
 
-      data[:agents][0].should_not have_key(:propagate_immediately) # can't receive events
-      data[:agents][1].should_not have_key(:schedule) # can't be scheduled
+      expect(data[:agents][0]).not_to have_key(:propagate_immediately) # can't receive events
+      expect(data[:agents][1]).not_to have_key(:schedule) # can't be scheduled
     end
     end
 
 
     it "does not output links to other agents outside of the incoming set" do
     it "does not output links to other agents outside of the incoming set" do
       Link.create!(:source_id => agents(:jane_weather_agent).id, :receiver_id => agents(:jane_website_agent).id)
       Link.create!(:source_id => agents(:jane_weather_agent).id, :receiver_id => agents(:jane_website_agent).id)
       Link.create!(:source_id => agents(:jane_website_agent).id, :receiver_id => agents(:jane_rain_notifier_agent).id)
       Link.create!(:source_id => agents(:jane_website_agent).id, :receiver_id => agents(:jane_rain_notifier_agent).id)
 
 
-      exporter.as_json[:links].should == [{ :source => 0, :receiver => 1 }]
+      expect(exporter.as_json[:links]).to eq([{ :source => 0, :receiver => 1 }])
     end
     end
   end
   end
 
 
   describe "#filename" do
   describe "#filename" do
     it "strips special characters" do
     it "strips special characters" do
-      AgentsExporter.new(:name => "ƏfooƐƕƺbar").filename.should == "foo-bar.json"
+      expect(AgentsExporter.new(:name => "ƏfooƐƕƺbar").filename).to eq("foo-bar.json")
     end
     end
 
 
     it "strips punctuation" do
     it "strips punctuation" do
-      AgentsExporter.new(:name => "foo,bar").filename.should == "foo-bar.json"
+      expect(AgentsExporter.new(:name => "foo,bar").filename).to eq("foo-bar.json")
     end
     end
 
 
     it "strips leading and trailing dashes" do
     it "strips leading and trailing dashes" do
-      AgentsExporter.new(:name => ",foo,").filename.should == "foo.json"
+      expect(AgentsExporter.new(:name => ",foo,").filename).to eq("foo.json")
     end
     end
 
 
     it "has a default when options[:name] is nil" do
     it "has a default when options[:name] is nil" do
-      AgentsExporter.new(:name => nil).filename.should == "exported-agents.json"
+      expect(AgentsExporter.new(:name => nil).filename).to eq("exported-agents.json")
     end
     end
 
 
     it "has a default when the result is empty" do
     it "has a default when the result is empty" do
-      AgentsExporter.new(:name => "").filename.should == "exported-agents.json"
-      AgentsExporter.new(:name => "Ə").filename.should == "exported-agents.json"
-      AgentsExporter.new(:name => "-").filename.should == "exported-agents.json"
-      AgentsExporter.new(:name => ",,").filename.should == "exported-agents.json"
+      expect(AgentsExporter.new(:name => "").filename).to eq("exported-agents.json")
+      expect(AgentsExporter.new(:name => "Ə").filename).to eq("exported-agents.json")
+      expect(AgentsExporter.new(:name => "-").filename).to eq("exported-agents.json")
+      expect(AgentsExporter.new(:name => ",,").filename).to eq("exported-agents.json")
     end
     end
   end
   end
 end
 end

+ 5 - 5
spec/lib/huginn_scheduler_spec.rb

@@ -37,19 +37,19 @@ describe HuginnScheduler do
 
 
   describe "#hour_to_schedule_name" do
   describe "#hour_to_schedule_name" do
     it "for 0h" do
     it "for 0h" do
-      @scheduler.send(:hour_to_schedule_name, 0).should == 'midnight'
+      expect(@scheduler.send(:hour_to_schedule_name, 0)).to eq('midnight')
     end
     end
 
 
     it "for the forenoon" do
     it "for the forenoon" do
-      @scheduler.send(:hour_to_schedule_name, 6).should == '6am'
+      expect(@scheduler.send(:hour_to_schedule_name, 6)).to eq('6am')
     end
     end
 
 
     it "for 12h" do
     it "for 12h" do
-      @scheduler.send(:hour_to_schedule_name, 12).should == 'noon'
+      expect(@scheduler.send(:hour_to_schedule_name, 12)).to eq('noon')
     end
     end
 
 
     it "for the afternoon" do
     it "for the afternoon" do
-      @scheduler.send(:hour_to_schedule_name, 17).should == '5pm'
+      expect(@scheduler.send(:hour_to_schedule_name, 17)).to eq('5pm')
     end
     end
   end
   end
 
 
@@ -64,7 +64,7 @@ describe HuginnScheduler do
     it "work with set FAILED_JOBS_TO_KEEP env variable", focus: true do
     it "work with set FAILED_JOBS_TO_KEEP env variable", focus: true do
       expect { @scheduler.send(:cleanup_failed_jobs!) }.to change(Delayed::Job, :count).by(-1)
       expect { @scheduler.send(:cleanup_failed_jobs!) }.to change(Delayed::Job, :count).by(-1)
       expect { @scheduler.send(:cleanup_failed_jobs!) }.to change(Delayed::Job, :count).by(0)
       expect { @scheduler.send(:cleanup_failed_jobs!) }.to change(Delayed::Job, :count).by(0)
-      @keep.id.should == Delayed::Job.order(:failed_at)[0].id
+      expect(@keep.id).to eq(Delayed::Job.order(:failed_at)[0].id)
     end
     end
 
 
 
 

+ 24 - 19
spec/lib/liquid_migrator_spec.rb

@@ -3,16 +3,16 @@ require 'spec_helper'
 describe LiquidMigrator do
 describe LiquidMigrator do
   describe "converting JSONPath strings" do
   describe "converting JSONPath strings" do
     it "should work" do
     it "should work" do
-      LiquidMigrator.convert_string("$.data", true).should == "{{data}}"
-      LiquidMigrator.convert_string("$.data.test", true).should == "{{data.test}}"
-      LiquidMigrator.convert_string("$first_title", true).should == "{{first_title}}"
+      expect(LiquidMigrator.convert_string("$.data", true)).to eq("{{data}}")
+      expect(LiquidMigrator.convert_string("$.data.test", true)).to eq("{{data.test}}")
+      expect(LiquidMigrator.convert_string("$first_title", true)).to eq("{{first_title}}")
     end
     end
 
 
     it "should ignore strings which just contain a JSONPath" do
     it "should ignore strings which just contain a JSONPath" do
-      LiquidMigrator.convert_string("$.data").should == "$.data"
-      LiquidMigrator.convert_string("$first_title").should == "$first_title"
-      LiquidMigrator.convert_string(" $.data", true).should == " $.data"
-      LiquidMigrator.convert_string("lorem $.data", true).should == "lorem $.data"
+      expect(LiquidMigrator.convert_string("$.data")).to eq("$.data")
+      expect(LiquidMigrator.convert_string("$first_title")).to eq("$first_title")
+      expect(LiquidMigrator.convert_string(" $.data", true)).to eq(" $.data")
+      expect(LiquidMigrator.convert_string("lorem $.data", true)).to eq("lorem $.data")
     end
     end
     it "should raise an exception when encountering complex JSONPaths" do
     it "should raise an exception when encountering complex JSONPaths" do
       expect { LiquidMigrator.convert_string("$.data.test.*", true) }.
       expect { LiquidMigrator.convert_string("$.data.test.*", true) }.
@@ -22,13 +22,15 @@ describe LiquidMigrator do
 
 
   describe "converting escaped JSONPath strings" do
   describe "converting escaped JSONPath strings" do
     it "should work" do
     it "should work" do
-      LiquidMigrator.convert_string("Weather looks like <$.conditions> according to the forecast at <$.pretty_date.time>").should ==
+      expect(LiquidMigrator.convert_string("Weather looks like <$.conditions> according to the forecast at <$.pretty_date.time>")).to eq(
                                     "Weather looks like {{conditions}} according to the forecast at {{pretty_date.time}}"
                                     "Weather looks like {{conditions}} according to the forecast at {{pretty_date.time}}"
+      )
     end
     end
 
 
     it "should convert the 'escape' method correctly" do
     it "should convert the 'escape' method correctly" do
-      LiquidMigrator.convert_string("Escaped: <escape $.content.name>\nNot escaped: <$.content.name>").should ==
+      expect(LiquidMigrator.convert_string("Escaped: <escape $.content.name>\nNot escaped: <$.content.name>")).to eq(
                                     "Escaped: {{content.name | uri_escape}}\nNot escaped: {{content.name}}"
                                     "Escaped: {{content.name | uri_escape}}\nNot escaped: {{content.name}}"
+      )
     end
     end
 
 
     it "should raise an exception when encountering complex JSONPaths" do
     it "should raise an exception when encountering complex JSONPaths" do
@@ -39,16 +41,19 @@ describe LiquidMigrator do
 
 
   describe "migrating a hash" do
   describe "migrating a hash" do
     it "should convert every attribute" do
     it "should convert every attribute" do
-      LiquidMigrator.convert_hash({'a' => "$.data", 'b' => "This is a <$.test>"}).should ==
+      expect(LiquidMigrator.convert_hash({'a' => "$.data", 'b' => "This is a <$.test>"})).to eq(
                                   {'a' => "$.data", 'b' => "This is a {{test}}"}
                                   {'a' => "$.data", 'b' => "This is a {{test}}"}
+      )
     end
     end
     it "should work with leading_dollarsign_is_jsonpath" do
     it "should work with leading_dollarsign_is_jsonpath" do
-      LiquidMigrator.convert_hash({'a' => "$.data", 'b' => "This is a <$.test>"}, leading_dollarsign_is_jsonpath: true).should ==
+      expect(LiquidMigrator.convert_hash({'a' => "$.data", 'b' => "This is a <$.test>"}, leading_dollarsign_is_jsonpath: true)).to eq(
                                   {'a' => "{{data}}", 'b' => "This is a {{test}}"}
                                   {'a' => "{{data}}", 'b' => "This is a {{test}}"}
+      )
     end
     end
     it "should use the corresponding *_path attributes when using merge_path_attributes"do
     it "should use the corresponding *_path attributes when using merge_path_attributes"do
-      LiquidMigrator.convert_hash({'a' => "default", 'a_path' => "$.data"}, {leading_dollarsign_is_jsonpath: true, merge_path_attributes: true}).should ==
+      expect(LiquidMigrator.convert_hash({'a' => "default", 'a_path' => "$.data"}, {leading_dollarsign_is_jsonpath: true, merge_path_attributes: true})).to eq(
                                   {'a' => "{{data}}"}
                                   {'a' => "{{data}}"}
+      )
     end
     end
     it "should raise an exception when encountering complex JSONPaths" do
     it "should raise an exception when encountering complex JSONPaths" do
       expect { LiquidMigrator.convert_hash({'b' => "This is <$.complex[2]>"}) }.
       expect { LiquidMigrator.convert_hash({'b' => "This is <$.complex[2]>"}) }.
@@ -58,9 +63,9 @@ describe LiquidMigrator do
 
 
   describe "migrating the 'make_message' format" do
   describe "migrating the 'make_message' format" do
     it "should work" do
     it "should work" do
-      LiquidMigrator.convert_make_message('<message>').should == '{{message}}'
-      LiquidMigrator.convert_make_message('<new.message>').should == '{{new.message}}'
-      LiquidMigrator.convert_make_message('Hello <world>. How is <nested.life>').should == 'Hello {{world}}. How is {{nested.life}}'
+      expect(LiquidMigrator.convert_make_message('<message>')).to eq('{{message}}')
+      expect(LiquidMigrator.convert_make_message('<new.message>')).to eq('{{new.message}}')
+      expect(LiquidMigrator.convert_make_message('Hello <world>. How is <nested.life>')).to eq('Hello {{world}}. How is {{nested.life}}')
     end
     end
   end
   end
 
 
@@ -87,19 +92,19 @@ describe LiquidMigrator do
 
 
     it "should work" do
     it "should work" do
       LiquidMigrator.convert_all_agent_options(@agent)
       LiquidMigrator.convert_all_agent_options(@agent)
-      @agent.reload.options.should == {"auth_token" => 'token', 'color' => 'yellow', 'notify' => false, 'room_name' => 'test', 'username' => '{{username}}', 'message' => '{{message}}'}
+      expect(@agent.reload.options).to eq({"auth_token" => 'token', 'color' => 'yellow', 'notify' => false, 'room_name' => 'test', 'username' => '{{username}}', 'message' => '{{message}}'})
     end
     end
 
 
     it "should work with nested hashes" do
     it "should work with nested hashes" do
       @agent.options['very'] = {'nested' => '$.value'}
       @agent.options['very'] = {'nested' => '$.value'}
       LiquidMigrator.convert_all_agent_options(@agent)
       LiquidMigrator.convert_all_agent_options(@agent)
-      @agent.reload.options.should == {"auth_token" => 'token', 'color' => 'yellow', 'very' => {'nested' => '{{value}}'}, 'notify' => false, 'room_name' => 'test', 'username' => '{{username}}', 'message' => '{{message}}'}
+      expect(@agent.reload.options).to eq({"auth_token" => 'token', 'color' => 'yellow', 'very' => {'nested' => '{{value}}'}, 'notify' => false, 'room_name' => 'test', 'username' => '{{username}}', 'message' => '{{message}}'})
     end
     end
 
 
     it "should work with nested arrays" do
     it "should work with nested arrays" do
       @agent.options['array'] = ["one", "$.two"]
       @agent.options['array'] = ["one", "$.two"]
       LiquidMigrator.convert_all_agent_options(@agent)
       LiquidMigrator.convert_all_agent_options(@agent)
-      @agent.reload.options.should == {"auth_token" => 'token', 'color' => 'yellow', 'array' => ['one', '{{two}}'], 'notify' => false, 'room_name' => 'test', 'username' => '{{username}}', 'message' => '{{message}}'}
+      expect(@agent.reload.options).to eq({"auth_token" => 'token', 'color' => 'yellow', 'array' => ['one', '{{two}}'], 'notify' => false, 'room_name' => 'test', 'username' => '{{username}}', 'message' => '{{message}}'})
     end
     end
 
 
     it "should raise an exception when encountering complex JSONPaths" do
     it "should raise an exception when encountering complex JSONPaths" do
@@ -150,7 +155,7 @@ describe LiquidMigrator do
       @agent = Agents::HumanTaskAgent.new(:name => "somename", :options => valid_params)
       @agent = Agents::HumanTaskAgent.new(:name => "somename", :options => valid_params)
       @agent.user = users(:jane)
       @agent.user = users(:jane)
       LiquidMigrator.convert_all_agent_options(@agent)
       LiquidMigrator.convert_all_agent_options(@agent)
-      @agent.reload.options['hit']['description'].should == "Please rate the sentiment of this message: '{{message}}'"
+      expect(@agent.reload.options['hit']['description']).to eq("Please rate the sentiment of this message: '{{message}}'")
     end
     end
   end
   end
 end
 end

+ 26 - 26
spec/lib/utils_spec.rb

@@ -3,27 +3,27 @@ require 'spec_helper'
 describe Utils do
 describe Utils do
   describe "#unindent" do
   describe "#unindent" do
     it "unindents to the level of the greatest consistant indention" do
     it "unindents to the level of the greatest consistant indention" do
-      Utils.unindent(<<-MD).should == "Hello World"
+      expect(Utils.unindent(<<-MD)).to eq("Hello World")
         Hello World
         Hello World
       MD
       MD
 
 
-      Utils.unindent(<<-MD).should == "Hello World\nThis is\nnot indented"
+      expect(Utils.unindent(<<-MD)).to eq("Hello World\nThis is\nnot indented")
         Hello World
         Hello World
         This is
         This is
         not indented
         not indented
       MD
       MD
 
 
-      Utils.unindent(<<-MD).should == "Hello World\n  This is\n  indented\nthough"
+      expect(Utils.unindent(<<-MD)).to eq("Hello World\n  This is\n  indented\nthough")
         Hello World
         Hello World
           This is
           This is
           indented
           indented
         though
         though
       MD
       MD
 
 
-      Utils.unindent("Hello\n  I am indented").should == "Hello\n  I am indented"
+      expect(Utils.unindent("Hello\n  I am indented")).to eq("Hello\n  I am indented")
 
 
       a = "        Events will have the fields you specified.  Your options look like:\n\n            {\n      \"url\": {\n        \"css\": \"#comic img\",\n        \"value\": \"@src\"\n      },\n      \"title\": {\n        \"css\": \"#comic img\",\n        \"value\": \"@title\"\n      }\n    }\"\n"
       a = "        Events will have the fields you specified.  Your options look like:\n\n            {\n      \"url\": {\n        \"css\": \"#comic img\",\n        \"value\": \"@src\"\n      },\n      \"title\": {\n        \"css\": \"#comic img\",\n        \"value\": \"@title\"\n      }\n    }\"\n"
-      Utils.unindent(a).should == "Events will have the fields you specified.  Your options look like:\n\n    {\n      \"url\": {\n\"css\": \"#comic img\",\n\"value\": \"@src\"\n      },\n      \"title\": {\n\"css\": \"#comic img\",\n\"value\": \"@title\"\n      }\n    }\""
+      expect(Utils.unindent(a)).to eq("Events will have the fields you specified.  Your options look like:\n\n    {\n      \"url\": {\n\"css\": \"#comic img\",\n\"value\": \"@src\"\n      },\n      \"title\": {\n\"css\": \"#comic img\",\n\"value\": \"@title\"\n      }\n    }\"")
     end
     end
   end
   end
 
 
@@ -31,12 +31,12 @@ describe Utils do
     let(:payload) { { :there => { :world => "WORLD" }, :works => "should work" } }
     let(:payload) { { :there => { :world => "WORLD" }, :works => "should work" } }
 
 
     it "interpolates jsonpath expressions between matching <>'s" do
     it "interpolates jsonpath expressions between matching <>'s" do
-      Utils.interpolate_jsonpaths("hello <$.there.world> this <escape works>", payload).should == "hello WORLD this should+work"
+      expect(Utils.interpolate_jsonpaths("hello <$.there.world> this <escape works>", payload)).to eq("hello WORLD this should+work")
     end
     end
 
 
     it "optionally supports treating values that start with '$' as raw JSONPath" do
     it "optionally supports treating values that start with '$' as raw JSONPath" do
-      Utils.interpolate_jsonpaths("$.there.world", payload).should == "$.there.world"
-      Utils.interpolate_jsonpaths("$.there.world", payload, :leading_dollarsign_is_jsonpath => true).should == "WORLD"
+      expect(Utils.interpolate_jsonpaths("$.there.world", payload)).to eq("$.there.world")
+      expect(Utils.interpolate_jsonpaths("$.there.world", payload, :leading_dollarsign_is_jsonpath => true)).to eq("WORLD")
     end
     end
   end
   end
 
 
@@ -52,7 +52,7 @@ describe Utils do
         }
         }
       }
       }
       data = { :there => { :world => "WORLD" }, :works => "should work" }
       data = { :there => { :world => "WORLD" }, :works => "should work" }
-      Utils.recursively_interpolate_jsonpaths(struct, data).should == {
+      expect(Utils.recursively_interpolate_jsonpaths(struct, data)).to eq({
         :int => 5,
         :int => 5,
         :string => "this should+work",
         :string => "this should+work",
         :array => ["should work", "now", "WORLD"],
         :array => ["should work", "now", "WORLD"],
@@ -60,58 +60,58 @@ describe Utils do
           :string => "hello WORLD",
           :string => "hello WORLD",
           :hello => :world
           :hello => :world
         }
         }
-      }
+      })
     end
     end
   end
   end
 
 
   describe "#value_at" do
   describe "#value_at" do
     it "returns the value at a JSON path" do
     it "returns the value at a JSON path" do
-      Utils.value_at({ :foo => { :bar => :baz }}.to_json, "foo.bar").should == "baz"
-      Utils.value_at({ :foo => { :bar => { :bing => 2 } }}, "foo.bar.bing").should == 2
+      expect(Utils.value_at({ :foo => { :bar => :baz }}.to_json, "foo.bar")).to eq("baz")
+      expect(Utils.value_at({ :foo => { :bar => { :bing => 2 } }}, "foo.bar.bing")).to eq(2)
     end
     end
 
 
     it "returns nil when the path cannot be followed" do
     it "returns nil when the path cannot be followed" do
-      Utils.value_at({ :foo => { :bar => :baz }}, "foo.bing").should be_nil
+      expect(Utils.value_at({ :foo => { :bar => :baz }}, "foo.bing")).to be_nil
     end
     end
 
 
     it "does not eval" do
     it "does not eval" do
-      lambda {
+      expect {
         Utils.value_at({ :foo => 2 }, "foo[?(@ > 1)]")
         Utils.value_at({ :foo => 2 }, "foo[?(@ > 1)]")
-      }.should raise_error(RuntimeError, /Cannot use .*? eval/)
+      }.to raise_error(RuntimeError, /Cannot use .*? eval/)
     end
     end
   end
   end
 
 
   describe "#values_at" do
   describe "#values_at" do
     it "returns arrays of matching values" do
     it "returns arrays of matching values" do
-      Utils.values_at({ :foo => { :bar => :baz }}, "foo.bar").should == %w[baz]
-      Utils.values_at({ :foo => [ { :bar => :baz }, { :bar => :bing } ]}, "foo[*].bar").should == %w[baz bing]
-      Utils.values_at({ :foo => [ { :bar => :baz }, { :bar => :bing } ]}, "foo[*].bar").should == %w[baz bing]
+      expect(Utils.values_at({ :foo => { :bar => :baz }}, "foo.bar")).to eq(%w[baz])
+      expect(Utils.values_at({ :foo => [ { :bar => :baz }, { :bar => :bing } ]}, "foo[*].bar")).to eq(%w[baz bing])
+      expect(Utils.values_at({ :foo => [ { :bar => :baz }, { :bar => :bing } ]}, "foo[*].bar")).to eq(%w[baz bing])
     end
     end
 
 
     it "should allow escaping" do
     it "should allow escaping" do
-      Utils.values_at({ :foo => { :bar => "escape this!?" }}, "escape $.foo.bar").should == ["escape+this%21%3F"]
+      expect(Utils.values_at({ :foo => { :bar => "escape this!?" }}, "escape $.foo.bar")).to eq(["escape+this%21%3F"])
     end
     end
   end
   end
 
 
   describe "#jsonify" do
   describe "#jsonify" do
     it "escapes </script> tags in the output JSON" do
     it "escapes </script> tags in the output JSON" do
       cleaned_json = Utils.jsonify(:foo => "bar", :xss => "</script><script>alert('oh no!')</script>")
       cleaned_json = Utils.jsonify(:foo => "bar", :xss => "</script><script>alert('oh no!')</script>")
-      cleaned_json.should_not include("</script>")
-      cleaned_json.should include('\\u003c/script\\u003e')
+      expect(cleaned_json).not_to include("</script>")
+      expect(cleaned_json).to include('\\u003c/script\\u003e')
     end
     end
 
 
     it "html_safes the output unless :skip_safe is passed in" do
     it "html_safes the output unless :skip_safe is passed in" do
-      Utils.jsonify({:foo => "bar"}).should be_html_safe
-      Utils.jsonify({:foo => "bar"}, :skip_safe => false).should be_html_safe
-      Utils.jsonify({:foo => "bar"}, :skip_safe => true).should_not be_html_safe
+      expect(Utils.jsonify({:foo => "bar"})).to be_html_safe
+      expect(Utils.jsonify({:foo => "bar"}, :skip_safe => false)).to be_html_safe
+      expect(Utils.jsonify({:foo => "bar"}, :skip_safe => true)).not_to be_html_safe
     end
     end
   end
   end
 
 
   describe "#pretty_jsonify" do
   describe "#pretty_jsonify" do
     it "escapes </script> tags in the output JSON" do
     it "escapes </script> tags in the output JSON" do
       cleaned_json = Utils.pretty_jsonify(:foo => "bar", :xss => "</script><script>alert('oh no!')</script>")
       cleaned_json = Utils.pretty_jsonify(:foo => "bar", :xss => "</script><script>alert('oh no!')</script>")
-      cleaned_json.should_not include("</script>")
-      cleaned_json.should include("<\\/script>")
+      expect(cleaned_json).not_to include("</script>")
+      expect(cleaned_json).to include("<\\/script>")
     end
     end
   end
   end
 end
 end

+ 29 - 29
spec/models/agent_log_spec.rb

@@ -4,41 +4,41 @@ describe AgentLog do
   describe "validations" do
   describe "validations" do
     before do
     before do
       @log = AgentLog.new(:agent => agents(:jane_website_agent), :message => "The agent did something", :level => 3)
       @log = AgentLog.new(:agent => agents(:jane_website_agent), :message => "The agent did something", :level => 3)
-      @log.should be_valid
+      expect(@log).to be_valid
     end
     end
 
 
     it "requires an agent" do
     it "requires an agent" do
       @log.agent = nil
       @log.agent = nil
-      @log.should_not be_valid
-      @log.should have(1).error_on(:agent)
+      expect(@log).not_to be_valid
+      expect(@log).to have(1).error_on(:agent)
     end
     end
 
 
     it "requires a message" do
     it "requires a message" do
       @log.message = ""
       @log.message = ""
-      @log.should_not be_valid
+      expect(@log).not_to be_valid
       @log.message = nil
       @log.message = nil
-      @log.should_not be_valid
-      @log.should have(1).error_on(:message)
+      expect(@log).not_to be_valid
+      expect(@log).to have(1).error_on(:message)
     end
     end
 
 
     it "requires a valid log level" do
     it "requires a valid log level" do
       @log.level = nil
       @log.level = nil
-      @log.should_not be_valid
-      @log.should have(1).error_on(:level)
+      expect(@log).not_to be_valid
+      expect(@log).to have(1).error_on(:level)
 
 
       @log.level = -1
       @log.level = -1
-      @log.should_not be_valid
-      @log.should have(1).error_on(:level)
+      expect(@log).not_to be_valid
+      expect(@log).to have(1).error_on(:level)
 
 
       @log.level = 5
       @log.level = 5
-      @log.should_not be_valid
-      @log.should have(1).error_on(:level)
+      expect(@log).not_to be_valid
+      expect(@log).to have(1).error_on(:level)
 
 
       @log.level = 4
       @log.level = 4
-      @log.should be_valid
+      expect(@log).to be_valid
 
 
       @log.level = 0
       @log.level = 0
-      @log.should be_valid
+      expect(@log).to be_valid
     end
     end
   end
   end
 
 
@@ -46,17 +46,17 @@ describe AgentLog do
     log = AgentLog.new(:agent => agents(:jane_website_agent), :level => 3)
     log = AgentLog.new(:agent => agents(:jane_website_agent), :level => 3)
     log.message = "a" * 3000
     log.message = "a" * 3000
     log.save!
     log.save!
-    log.message.length.should == 2048
+    expect(log.message.length).to eq(2048)
   end
   end
 
 
   describe "#log_for_agent" do
   describe "#log_for_agent" do
     it "creates AgentLogs" do
     it "creates AgentLogs" do
       log = AgentLog.log_for_agent(agents(:jane_website_agent), "some message", :level => 4, :outbound_event => events(:jane_website_agent_event))
       log = AgentLog.log_for_agent(agents(:jane_website_agent), "some message", :level => 4, :outbound_event => events(:jane_website_agent_event))
-      log.should_not be_new_record
-      log.agent.should == agents(:jane_website_agent)
-      log.outbound_event.should == events(:jane_website_agent_event)
-      log.message.should == "some message"
-      log.level.should == 4
+      expect(log).not_to be_new_record
+      expect(log.agent).to eq(agents(:jane_website_agent))
+      expect(log.outbound_event).to eq(events(:jane_website_agent_event))
+      expect(log.message).to eq("some message")
+      expect(log.level).to eq(4)
     end
     end
 
 
     it "cleans up old logs when there are more than log_length" do
     it "cleans up old logs when there are more than log_length" do
@@ -65,28 +65,28 @@ describe AgentLog do
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 2")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 2")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 3")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 3")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 4")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 4")
-      agents(:jane_website_agent).logs.order("agent_logs.id desc").first.message.should == "message 4"
-      agents(:jane_website_agent).logs.order("agent_logs.id desc").last.message.should == "message 1"
+      expect(agents(:jane_website_agent).logs.order("agent_logs.id desc").first.message).to eq("message 4")
+      expect(agents(:jane_website_agent).logs.order("agent_logs.id desc").last.message).to eq("message 1")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 5")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 5")
-      agents(:jane_website_agent).logs.order("agent_logs.id desc").first.message.should == "message 5"
-      agents(:jane_website_agent).logs.order("agent_logs.id desc").last.message.should == "message 2"
+      expect(agents(:jane_website_agent).logs.order("agent_logs.id desc").first.message).to eq("message 5")
+      expect(agents(:jane_website_agent).logs.order("agent_logs.id desc").last.message).to eq("message 2")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 6")
       AgentLog.log_for_agent(agents(:jane_website_agent), "message 6")
-      agents(:jane_website_agent).logs.order("agent_logs.id desc").first.message.should == "message 6"
-      agents(:jane_website_agent).logs.order("agent_logs.id desc").last.message.should == "message 3"
+      expect(agents(:jane_website_agent).logs.order("agent_logs.id desc").first.message).to eq("message 6")
+      expect(agents(:jane_website_agent).logs.order("agent_logs.id desc").last.message).to eq("message 3")
     end
     end
 
 
     it "updates Agents' last_error_log_at when an error is logged" do
     it "updates Agents' last_error_log_at when an error is logged" do
       AgentLog.log_for_agent(agents(:jane_website_agent), "some message", :level => 3, :outbound_event => events(:jane_website_agent_event))
       AgentLog.log_for_agent(agents(:jane_website_agent), "some message", :level => 3, :outbound_event => events(:jane_website_agent_event))
-      agents(:jane_website_agent).reload.last_error_log_at.should be_nil
+      expect(agents(:jane_website_agent).reload.last_error_log_at).to be_nil
 
 
       AgentLog.log_for_agent(agents(:jane_website_agent), "some message", :level => 4, :outbound_event => events(:jane_website_agent_event))
       AgentLog.log_for_agent(agents(:jane_website_agent), "some message", :level => 4, :outbound_event => events(:jane_website_agent_event))
-      agents(:jane_website_agent).reload.last_error_log_at.to_i.should be_within(2).of(Time.now.to_i)
+      expect(agents(:jane_website_agent).reload.last_error_log_at.to_i).to be_within(2).of(Time.now.to_i)
     end
     end
   end
   end
 
 
   describe "#log_length" do
   describe "#log_length" do
     it "defaults to 200" do
     it "defaults to 200" do
-      AgentLog.log_length.should == 200
+      expect(AgentLog.log_length).to eq(200)
     end
     end
   end
   end
 end
 end

+ 175 - 175
spec/models/agent_spec.rb

@@ -22,8 +22,8 @@ describe Agent do
 
 
   describe ".run_schedule" do
   describe ".run_schedule" do
     before do
     before do
-      Agents::WeatherAgent.count.should > 0
-      Agents::WebsiteAgent.count.should > 0
+      expect(Agents::WeatherAgent.count).to be > 0
+      expect(Agents::WebsiteAgent.count).to be > 0
     end
     end
 
 
     it "runs agents with the given schedule" do
     it "runs agents with the given schedule" do
@@ -31,7 +31,7 @@ describe Agent do
       stub(Agents::WeatherAgent).async_check(anything) {|agent_id| weather_agent_ids.delete(agent_id) }
       stub(Agents::WeatherAgent).async_check(anything) {|agent_id| weather_agent_ids.delete(agent_id) }
       stub(Agents::WebsiteAgent).async_check(agents(:bob_website_agent).id)
       stub(Agents::WebsiteAgent).async_check(agents(:bob_website_agent).id)
       Agent.run_schedule("midnight")
       Agent.run_schedule("midnight")
-      weather_agent_ids.should be_empty
+      expect(weather_agent_ids).to be_empty
     end
     end
 
 
     it "groups agents by type" do
     it "groups agents by type" do
@@ -54,20 +54,20 @@ describe Agent do
 
 
   describe "credential" do
   describe "credential" do
     it "should return the value of the credential when credential is present" do
     it "should return the value of the credential when credential is present" do
-      agents(:bob_weather_agent).credential("aws_secret").should == user_credentials(:bob_aws_secret).credential_value
+      expect(agents(:bob_weather_agent).credential("aws_secret")).to eq(user_credentials(:bob_aws_secret).credential_value)
     end
     end
 
 
     it "should return nil when credential is not present" do
     it "should return nil when credential is not present" do
-      agents(:bob_weather_agent).credential("non_existing_credential").should == nil
+      expect(agents(:bob_weather_agent).credential("non_existing_credential")).to eq(nil)
     end
     end
 
 
     it "should memoize the load" do
     it "should memoize the load" do
       mock.any_instance_of(UserCredential).credential_value.twice { "foo" }
       mock.any_instance_of(UserCredential).credential_value.twice { "foo" }
-      agents(:bob_weather_agent).credential("aws_secret").should == "foo"
-      agents(:bob_weather_agent).credential("aws_secret").should == "foo"
+      expect(agents(:bob_weather_agent).credential("aws_secret")).to eq("foo")
+      expect(agents(:bob_weather_agent).credential("aws_secret")).to eq("foo")
       agents(:bob_weather_agent).reload
       agents(:bob_weather_agent).reload
-      agents(:bob_weather_agent).credential("aws_secret").should == "foo"
-      agents(:bob_weather_agent).credential("aws_secret").should == "foo"
+      expect(agents(:bob_weather_agent).credential("aws_secret")).to eq("foo")
+      expect(agents(:bob_weather_agent).credential("aws_secret")).to eq("foo")
     end
     end
   end
   end
 
 
@@ -75,21 +75,21 @@ describe Agent do
     it "validates types" do
     it "validates types" do
       source = Agent.new
       source = Agent.new
       source.type = "Agents::WeatherAgent"
       source.type = "Agents::WeatherAgent"
-      source.should have(0).errors_on(:type)
+      expect(source).to have(0).errors_on(:type)
       source.type = "Agents::WebsiteAgent"
       source.type = "Agents::WebsiteAgent"
-      source.should have(0).errors_on(:type)
+      expect(source).to have(0).errors_on(:type)
       source.type = "Agents::Fake"
       source.type = "Agents::Fake"
-      source.should have(1).error_on(:type)
+      expect(source).to have(1).error_on(:type)
     end
     end
 
 
     it "disallows changes to type once a record has been saved" do
     it "disallows changes to type once a record has been saved" do
       source = agents(:bob_website_agent)
       source = agents(:bob_website_agent)
       source.type = "Agents::WeatherAgent"
       source.type = "Agents::WeatherAgent"
-      source.should have(1).error_on(:type)
+      expect(source).to have(1).error_on(:type)
     end
     end
 
 
     it "should know about available types" do
     it "should know about available types" do
-      Agent.types.should include(Agents::WeatherAgent, Agents::WebsiteAgent)
+      expect(Agent.types).to include(Agents::WeatherAgent, Agents::WebsiteAgent)
     end
     end
   end
   end
 
 
@@ -134,44 +134,44 @@ describe Agent do
 
 
     describe ".short_type" do
     describe ".short_type" do
       it "returns a short name without 'Agents::'" do
       it "returns a short name without 'Agents::'" do
-        Agents::SomethingSource.new.short_type.should == "SomethingSource"
-        Agents::CannotBeScheduled.new.short_type.should == "CannotBeScheduled"
+        expect(Agents::SomethingSource.new.short_type).to eq("SomethingSource")
+        expect(Agents::CannotBeScheduled.new.short_type).to eq("CannotBeScheduled")
       end
       end
     end
     end
 
 
     describe ".default_schedule" do
     describe ".default_schedule" do
       it "stores the default on the class" do
       it "stores the default on the class" do
-        Agents::SomethingSource.default_schedule.should == "2pm"
-        Agents::SomethingSource.new.default_schedule.should == "2pm"
+        expect(Agents::SomethingSource.default_schedule).to eq("2pm")
+        expect(Agents::SomethingSource.new.default_schedule).to eq("2pm")
       end
       end
 
 
       it "sets the default on new instances, allows setting new schedules, and prevents invalid schedules" do
       it "sets the default on new instances, allows setting new schedules, and prevents invalid schedules" do
         @checker = Agents::SomethingSource.new(:name => "something")
         @checker = Agents::SomethingSource.new(:name => "something")
         @checker.user = users(:bob)
         @checker.user = users(:bob)
-        @checker.schedule.should == "2pm"
+        expect(@checker.schedule).to eq("2pm")
         @checker.save!
         @checker.save!
-        @checker.reload.schedule.should == "2pm"
+        expect(@checker.reload.schedule).to eq("2pm")
         @checker.update_attribute :schedule, "5pm"
         @checker.update_attribute :schedule, "5pm"
-        @checker.reload.schedule.should == "5pm"
+        expect(@checker.reload.schedule).to eq("5pm")
 
 
-        @checker.reload.schedule.should == "5pm"
+        expect(@checker.reload.schedule).to eq("5pm")
 
 
         @checker.schedule = "this_is_not_real"
         @checker.schedule = "this_is_not_real"
-        @checker.should have(1).errors_on(:schedule)
+        expect(@checker).to have(1).errors_on(:schedule)
       end
       end
 
 
       it "should have an empty schedule if it cannot_be_scheduled" do
       it "should have an empty schedule if it cannot_be_scheduled" do
         @checker = Agents::CannotBeScheduled.new(:name => "something")
         @checker = Agents::CannotBeScheduled.new(:name => "something")
         @checker.user = users(:bob)
         @checker.user = users(:bob)
-        @checker.schedule.should be_nil
-        @checker.should be_valid
+        expect(@checker.schedule).to be_nil
+        expect(@checker).to be_valid
         @checker.schedule = "5pm"
         @checker.schedule = "5pm"
         @checker.save!
         @checker.save!
-        @checker.schedule.should be_nil
+        expect(@checker.schedule).to be_nil
 
 
         @checker.schedule = "5pm"
         @checker.schedule = "5pm"
-        @checker.should have(0).errors_on(:schedule)
-        @checker.schedule.should be_nil
+        expect(@checker).to have(0).errors_on(:schedule)
+        expect(@checker.schedule).to be_nil
       end
       end
     end
     end
 
 
@@ -184,15 +184,15 @@ describe Agent do
 
 
       it "should use the checker's user" do
       it "should use the checker's user" do
         @checker.check
         @checker.check
-        Event.last.user.should == @checker.user
+        expect(Event.last.user).to eq(@checker.user)
       end
       end
 
 
       it "should log an error if the Agent has been marked with 'cannot_create_events!'" do
       it "should log an error if the Agent has been marked with 'cannot_create_events!'" do
         mock(@checker).can_create_events? { false }
         mock(@checker).can_create_events? { false }
-        lambda {
+        expect {
           @checker.check
           @checker.check
-        }.should_not change { Event.count }
-        @checker.logs.first.message.should =~ /cannot create events/i
+        }.not_to change { Event.count }
+        expect(@checker.logs.first.message).to match(/cannot create events/i)
       end
       end
     end
     end
 
 
@@ -210,10 +210,10 @@ describe Agent do
 
 
         mock(Agent).find(@checker.id) { @checker }
         mock(Agent).find(@checker.id) { @checker }
 
 
-        @checker.last_check_at.should be_nil
+        expect(@checker.last_check_at).to be_nil
         Agents::SomethingSource.async_check(@checker.id)
         Agents::SomethingSource.async_check(@checker.id)
-        @checker.reload.last_check_at.should be_within(2).of(Time.now)
-        @checker.reload.options[:new].should be_truthy # Show that we save options
+        expect(@checker.reload.last_check_at).to be_within(2).of(Time.now)
+        expect(@checker.reload.options[:new]).to be_truthy # Show that we save options
       end
       end
 
 
       it "should log exceptions" do
       it "should log exceptions" do
@@ -221,12 +221,12 @@ describe Agent do
           raise "foo"
           raise "foo"
         }
         }
         mock(Agent).find(@checker.id) { @checker }
         mock(Agent).find(@checker.id) { @checker }
-        lambda {
+        expect {
           Agents::SomethingSource.async_check(@checker.id)
           Agents::SomethingSource.async_check(@checker.id)
-        }.should raise_error
+        }.to raise_error
         log = @checker.logs.first
         log = @checker.logs.first
-        log.message.should =~ /Exception/
-        log.level.should == 4
+        expect(log.message).to match(/Exception/)
+        expect(log.level).to eq(4)
       end
       end
 
 
       it "should not run disabled Agents" do
       it "should not run disabled Agents" do
@@ -261,24 +261,24 @@ describe Agent do
           raise "foo"
           raise "foo"
         }
         }
         Agent.async_check(agents(:bob_weather_agent).id)
         Agent.async_check(agents(:bob_weather_agent).id)
-        lambda {
+        expect {
           Agent.async_receive(agents(:bob_rain_notifier_agent).id, [agents(:bob_weather_agent).events.last.id])
           Agent.async_receive(agents(:bob_rain_notifier_agent).id, [agents(:bob_weather_agent).events.last.id])
-        }.should raise_error
+        }.to raise_error
         log = agents(:bob_rain_notifier_agent).logs.first
         log = agents(:bob_rain_notifier_agent).logs.first
-        log.message.should =~ /Exception/
-        log.level.should == 4
+        expect(log.message).to match(/Exception/)
+        expect(log.level).to eq(4)
       end
       end
 
 
       it "should track when events have been seen and not received them again" do
       it "should track when events have been seen and not received them again" do
         mock.any_instance_of(Agents::TriggerAgent).receive(anything).once
         mock.any_instance_of(Agents::TriggerAgent).receive(anything).once
         Agent.async_check(agents(:bob_weather_agent).id)
         Agent.async_check(agents(:bob_weather_agent).id)
-        lambda {
+        expect {
           Agent.receive!
           Agent.receive!
-        }.should change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
+        }.to change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
 
 
-        lambda {
+        expect {
           Agent.receive!
           Agent.receive!
-        }.should_not change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
+        }.not_to change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
       end
       end
 
 
       it "should not run consumers that have nothing to do" do
       it "should not run consumers that have nothing to do" do
@@ -288,7 +288,7 @@ describe Agent do
 
 
       it "should group events" do
       it "should group events" do
         mock.any_instance_of(Agents::TriggerAgent).receive(anything).twice { |events|
         mock.any_instance_of(Agents::TriggerAgent).receive(anything).twice { |events|
-          events.map(&:user).map(&:username).uniq.length.should == 1
+          expect(events.map(&:user).map(&:username).uniq.length).to eq(1)
         }
         }
         Agent.async_check(agents(:bob_weather_agent).id)
         Agent.async_check(agents(:bob_weather_agent).id)
         Agent.async_check(agents(:jane_weather_agent).id)
         Agent.async_check(agents(:jane_weather_agent).id)
@@ -304,9 +304,9 @@ describe Agent do
         mock.any_instance_of(Agents::TriggerAgent).receive(anything).twice
         mock.any_instance_of(Agents::TriggerAgent).receive(anything).twice
         agents(:bob_weather_agent).check # bob_weather_agent makes an event
         agents(:bob_weather_agent).check # bob_weather_agent makes an event
 
 
-        lambda {
+        expect {
           Agent.receive! # event gets propagated
           Agent.receive! # event gets propagated
-        }.should change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
+        }.to change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
 
 
         # This agent creates a few events before we link to it, but after our last check.
         # This agent creates a few events before we link to it, but after our last check.
         agent2.check
         agent2.check
@@ -314,18 +314,18 @@ describe Agent do
 
 
         # Now we link to it.
         # Now we link to it.
         agents(:bob_rain_notifier_agent).sources << agent2
         agents(:bob_rain_notifier_agent).sources << agent2
-        agent2.links_as_source.first.event_id_at_creation.should == agent2.events.reorder("events.id desc").first.id
+        expect(agent2.links_as_source.first.event_id_at_creation).to eq(agent2.events.reorder("events.id desc").first.id)
 
 
-        lambda {
+        expect {
           Agent.receive! # but we don't receive those events because they're too old
           Agent.receive! # but we don't receive those events because they're too old
-        }.should_not change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
+        }.not_to change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
 
 
         # Now a new event is created by agent2
         # Now a new event is created by agent2
         agent2.check
         agent2.check
 
 
-        lambda {
+        expect {
           Agent.receive! # and we receive it
           Agent.receive! # and we receive it
-        }.should change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
+        }.to change { agents(:bob_rain_notifier_agent).reload.last_checked_event_id }
       end
       end
     end
     end
 
 
@@ -346,19 +346,19 @@ describe Agent do
         sender.save!
         sender.save!
         sender.create_event :payload => {}
         sender.create_event :payload => {}
         sender.create_event :payload => {}
         sender.create_event :payload => {}
-        sender.events.count.should == 2
+        expect(sender.events.count).to eq(2)
 
 
         receiver = Agents::CannotBeScheduled.new(:name => "Receiving Agent")
         receiver = Agents::CannotBeScheduled.new(:name => "Receiving Agent")
         receiver.user = users(:bob)
         receiver.user = users(:bob)
         receiver.sources << sender
         receiver.sources << sender
         receiver.save!
         receiver.save!
 
 
-        receiver.events.count.should == 0
+        expect(receiver.events.count).to eq(0)
         Agent.receive!
         Agent.receive!
-        receiver.events.count.should == 0
+        expect(receiver.events.count).to eq(0)
         sender.create_event :payload => {}
         sender.create_event :payload => {}
         Agent.receive!
         Agent.receive!
-        receiver.events.count.should == 1
+        expect(receiver.events.count).to eq(1)
       end
       end
     end
     end
 
 
@@ -378,8 +378,8 @@ describe Agent do
         receiver.save!
         receiver.save!
 
 
         sender.create_event :payload => {"message" => "new payload"}
         sender.create_event :payload => {"message" => "new payload"}
-        sender.events.count.should == 1
-        receiver.events.count.should == 1
+        expect(sender.events.count).to eq(1)
+        expect(receiver.events.count).to eq(1)
         #should be true without calling Agent.receive!
         #should be true without calling Agent.receive!
       end
       end
 
 
@@ -405,15 +405,15 @@ describe Agent do
         slow_receiver.save!
         slow_receiver.save!
 
 
         sender.create_event :payload => {"message" => "new payload"}
         sender.create_event :payload => {"message" => "new payload"}
-        sender.events.count.should == 1
-        im_receiver.events.count.should == 1
+        expect(sender.events.count).to eq(1)
+        expect(im_receiver.events.count).to eq(1)
         #we should get the quick one
         #we should get the quick one
         #but not the slow one
         #but not the slow one
-        slow_receiver.events.count.should == 0
+        expect(slow_receiver.events.count).to eq(0)
         Agent.receive!
         Agent.receive!
         #now we should have one in both
         #now we should have one in both
-        im_receiver.events.count.should == 1
-        slow_receiver.events.count.should == 1
+        expect(im_receiver.events.count).to eq(1)
+        expect(slow_receiver.events.count).to eq(1)
       end
       end
     end
     end
 
 
@@ -422,18 +422,18 @@ describe Agent do
         agent = Agents::SomethingSource.new(:name => "something")
         agent = Agents::SomethingSource.new(:name => "something")
         agent.user = users(:bob)
         agent.user = users(:bob)
         agent.options[:bad] = true
         agent.options[:bad] = true
-        agent.should have(1).error_on(:base)
+        expect(agent).to have(1).error_on(:base)
         agent.options[:bad] = false
         agent.options[:bad] = false
-        agent.should have(0).errors_on(:base)
+        expect(agent).to have(0).errors_on(:base)
       end
       end
 
 
       it "makes options symbol-indifferent before validating" do
       it "makes options symbol-indifferent before validating" do
         agent = Agents::SomethingSource.new(:name => "something")
         agent = Agents::SomethingSource.new(:name => "something")
         agent.user = users(:bob)
         agent.user = users(:bob)
         agent.options["bad"] = true
         agent.options["bad"] = true
-        agent.should have(1).error_on(:base)
+        expect(agent).to have(1).error_on(:base)
         agent.options["bad"] = false
         agent.options["bad"] = false
-        agent.should have(0).errors_on(:base)
+        expect(agent).to have(0).errors_on(:base)
       end
       end
 
 
       it "makes memory symbol-indifferent before validating" do
       it "makes memory symbol-indifferent before validating" do
@@ -441,82 +441,82 @@ describe Agent do
         agent.user = users(:bob)
         agent.user = users(:bob)
         agent.memory["bad"] = 2
         agent.memory["bad"] = 2
         agent.save
         agent.save
-        agent.memory[:bad].should == 2
+        expect(agent.memory[:bad]).to eq(2)
       end
       end
 
 
       it "should work when assigned a hash or JSON string" do
       it "should work when assigned a hash or JSON string" do
         agent = Agents::SomethingSource.new(:name => "something")
         agent = Agents::SomethingSource.new(:name => "something")
         agent.memory = {}
         agent.memory = {}
-        agent.memory.should == {}
-        agent.memory["foo"].should be_nil
+        expect(agent.memory).to eq({})
+        expect(agent.memory["foo"]).to be_nil
 
 
         agent.memory = ""
         agent.memory = ""
-        agent.memory["foo"].should be_nil
-        agent.memory.should == {}
+        expect(agent.memory["foo"]).to be_nil
+        expect(agent.memory).to eq({})
 
 
         agent.memory = '{"hi": "there"}'
         agent.memory = '{"hi": "there"}'
-        agent.memory.should == { "hi" => "there" }
+        expect(agent.memory).to eq({ "hi" => "there" })
 
 
         agent.memory = '{invalid}'
         agent.memory = '{invalid}'
-        agent.memory.should == { "hi" => "there" }
-        agent.should have(1).errors_on(:memory)
+        expect(agent.memory).to eq({ "hi" => "there" })
+        expect(agent).to have(1).errors_on(:memory)
 
 
         agent.memory = "{}"
         agent.memory = "{}"
-        agent.memory["foo"].should be_nil
-        agent.memory.should == {}
-        agent.should have(0).errors_on(:memory)
+        expect(agent.memory["foo"]).to be_nil
+        expect(agent.memory).to eq({})
+        expect(agent).to have(0).errors_on(:memory)
 
 
         agent.options = "{}"
         agent.options = "{}"
-        agent.options["foo"].should be_nil
-        agent.options.should == {}
-        agent.should have(0).errors_on(:options)
+        expect(agent.options["foo"]).to be_nil
+        expect(agent.options).to eq({})
+        expect(agent).to have(0).errors_on(:options)
 
 
         agent.options = '{"hi": 2}'
         agent.options = '{"hi": 2}'
-        agent.options["hi"].should == 2
-        agent.should have(0).errors_on(:options)
+        expect(agent.options["hi"]).to eq(2)
+        expect(agent).to have(0).errors_on(:options)
 
 
         agent.options = '{"hi": wut}'
         agent.options = '{"hi": wut}'
-        agent.options["hi"].should == 2
-        agent.should have(1).errors_on(:options)
-        agent.errors_on(:options).should include("was assigned invalid JSON")
+        expect(agent.options["hi"]).to eq(2)
+        expect(agent).to have(1).errors_on(:options)
+        expect(agent.errors_on(:options)).to include("was assigned invalid JSON")
 
 
         agent.options = 5
         agent.options = 5
-        agent.options["hi"].should == 2
-        agent.should have(1).errors_on(:options)
-        agent.errors_on(:options).should include("cannot be set to an instance of Fixnum")
+        expect(agent.options["hi"]).to eq(2)
+        expect(agent).to have(1).errors_on(:options)
+        expect(agent.errors_on(:options)).to include("cannot be set to an instance of Fixnum")
       end
       end
 
 
       it "should not allow source agents owned by other people" do
       it "should not allow source agents owned by other people" do
         agent = Agents::SomethingSource.new(:name => "something")
         agent = Agents::SomethingSource.new(:name => "something")
         agent.user = users(:bob)
         agent.user = users(:bob)
         agent.source_ids = [agents(:bob_weather_agent).id]
         agent.source_ids = [agents(:bob_weather_agent).id]
-        agent.should have(0).errors_on(:sources)
+        expect(agent).to have(0).errors_on(:sources)
         agent.source_ids = [agents(:jane_weather_agent).id]
         agent.source_ids = [agents(:jane_weather_agent).id]
-        agent.should have(1).errors_on(:sources)
+        expect(agent).to have(1).errors_on(:sources)
         agent.user = users(:jane)
         agent.user = users(:jane)
-        agent.should have(0).errors_on(:sources)
+        expect(agent).to have(0).errors_on(:sources)
       end
       end
 
 
       it "should not allow controller agents owned by other people" do
       it "should not allow controller agents owned by other people" do
         agent = Agents::SomethingSource.new(:name => "something")
         agent = Agents::SomethingSource.new(:name => "something")
         agent.user = users(:bob)
         agent.user = users(:bob)
         agent.controller_ids = [agents(:bob_weather_agent).id]
         agent.controller_ids = [agents(:bob_weather_agent).id]
-        agent.should have(0).errors_on(:controllers)
+        expect(agent).to have(0).errors_on(:controllers)
         agent.controller_ids = [agents(:jane_weather_agent).id]
         agent.controller_ids = [agents(:jane_weather_agent).id]
-        agent.should have(1).errors_on(:controllers)
+        expect(agent).to have(1).errors_on(:controllers)
         agent.user = users(:jane)
         agent.user = users(:jane)
-        agent.should have(0).errors_on(:controllers)
+        expect(agent).to have(0).errors_on(:controllers)
       end
       end
 
 
       it "should not allow control target agents owned by other people" do
       it "should not allow control target agents owned by other people" do
         agent = Agents::CannotBeScheduled.new(:name => "something")
         agent = Agents::CannotBeScheduled.new(:name => "something")
         agent.user = users(:bob)
         agent.user = users(:bob)
         agent.control_target_ids = [agents(:bob_weather_agent).id]
         agent.control_target_ids = [agents(:bob_weather_agent).id]
-        agent.should have(0).errors_on(:control_targets)
+        expect(agent).to have(0).errors_on(:control_targets)
         agent.control_target_ids = [agents(:jane_weather_agent).id]
         agent.control_target_ids = [agents(:jane_weather_agent).id]
-        agent.should have(1).errors_on(:control_targets)
+        expect(agent).to have(1).errors_on(:control_targets)
         agent.user = users(:jane)
         agent.user = users(:jane)
-        agent.should have(0).errors_on(:control_targets)
+        expect(agent).to have(0).errors_on(:control_targets)
       end
       end
 
 
       it "should not allow scenarios owned by other people" do
       it "should not allow scenarios owned by other people" do
@@ -524,38 +524,38 @@ describe Agent do
         agent.user = users(:bob)
         agent.user = users(:bob)
 
 
         agent.scenario_ids = [scenarios(:bob_weather).id]
         agent.scenario_ids = [scenarios(:bob_weather).id]
-        agent.should have(0).errors_on(:scenarios)
+        expect(agent).to have(0).errors_on(:scenarios)
 
 
         agent.scenario_ids = [scenarios(:bob_weather).id, scenarios(:jane_weather).id]
         agent.scenario_ids = [scenarios(:bob_weather).id, scenarios(:jane_weather).id]
-        agent.should have(1).errors_on(:scenarios)
+        expect(agent).to have(1).errors_on(:scenarios)
 
 
         agent.scenario_ids = [scenarios(:jane_weather).id]
         agent.scenario_ids = [scenarios(:jane_weather).id]
-        agent.should have(1).errors_on(:scenarios)
+        expect(agent).to have(1).errors_on(:scenarios)
 
 
         agent.user = users(:jane)
         agent.user = users(:jane)
-        agent.should have(0).errors_on(:scenarios)
+        expect(agent).to have(0).errors_on(:scenarios)
       end
       end
 
 
       it "validates keep_events_for" do
       it "validates keep_events_for" do
         agent = Agents::SomethingSource.new(:name => "something")
         agent = Agents::SomethingSource.new(:name => "something")
         agent.user = users(:bob)
         agent.user = users(:bob)
-        agent.should be_valid
+        expect(agent).to be_valid
         agent.keep_events_for = nil
         agent.keep_events_for = nil
-        agent.should have(1).errors_on(:keep_events_for)
+        expect(agent).to have(1).errors_on(:keep_events_for)
         agent.keep_events_for = 1000
         agent.keep_events_for = 1000
-        agent.should have(1).errors_on(:keep_events_for)
+        expect(agent).to have(1).errors_on(:keep_events_for)
         agent.keep_events_for = ""
         agent.keep_events_for = ""
-        agent.should have(1).errors_on(:keep_events_for)
+        expect(agent).to have(1).errors_on(:keep_events_for)
         agent.keep_events_for = 5
         agent.keep_events_for = 5
-        agent.should be_valid
+        expect(agent).to be_valid
         agent.keep_events_for = 0
         agent.keep_events_for = 0
-        agent.should be_valid
+        expect(agent).to be_valid
         agent.keep_events_for = 365
         agent.keep_events_for = 365
-        agent.should be_valid
+        expect(agent).to be_valid
 
 
         # Rails seems to call to_i on the input. This guards against future changes to that behavior.
         # Rails seems to call to_i on the input. This guards against future changes to that behavior.
         agent.keep_events_for = "drop table;"
         agent.keep_events_for = "drop table;"
-        agent.keep_events_for.should == 0
+        expect(agent.keep_events_for).to eq(0)
       end
       end
     end
     end
 
 
@@ -566,7 +566,7 @@ describe Agent do
         @agent.user = users(:bob)
         @agent.user = users(:bob)
         @agent.save!
         @agent.save!
         @event = @agent.create_event :payload => { "hello" => "world" }
         @event = @agent.create_event :payload => { "hello" => "world" }
-        @event.expires_at.to_i.should be_within(2).of(5.days.from_now.to_i)
+        expect(@event.expires_at.to_i).to be_within(2).of(5.days.from_now.to_i)
       end
       end
 
 
       describe "when keep_events_for has not changed" do
       describe "when keep_events_for has not changed" do
@@ -584,32 +584,32 @@ describe Agent do
 
 
       describe "when keep_events_for is changed" do
       describe "when keep_events_for is changed" do
         it "updates events' expires_at" do
         it "updates events' expires_at" do
-          lambda {
+          expect {
             @agent.options[:foo] = "bar1"
             @agent.options[:foo] = "bar1"
             @agent.keep_events_for = 3
             @agent.keep_events_for = 3
             @agent.save!
             @agent.save!
-          }.should change { @event.reload.expires_at }
-          @event.expires_at.to_i.should be_within(2).of(3.days.from_now.to_i)
+          }.to change { @event.reload.expires_at }
+          expect(@event.expires_at.to_i).to be_within(2).of(3.days.from_now.to_i)
         end
         end
 
 
         it "updates events relative to their created_at" do
         it "updates events relative to their created_at" do
           @event.update_attribute :created_at, 2.days.ago
           @event.update_attribute :created_at, 2.days.ago
-          @event.reload.created_at.to_i.should be_within(2).of(2.days.ago.to_i)
+          expect(@event.reload.created_at.to_i).to be_within(2).of(2.days.ago.to_i)
 
 
-          lambda {
+          expect {
             @agent.options[:foo] = "bar2"
             @agent.options[:foo] = "bar2"
             @agent.keep_events_for = 3
             @agent.keep_events_for = 3
             @agent.save!
             @agent.save!
-          }.should change { @event.reload.expires_at }
-          @event.expires_at.to_i.should be_within(60 * 61).of(1.days.from_now.to_i) # The larger time is to deal with daylight savings
+          }.to change { @event.reload.expires_at }
+          expect(@event.expires_at.to_i).to be_within(60 * 61).of(1.days.from_now.to_i) # The larger time is to deal with daylight savings
         end
         end
 
 
         it "nulls out expires_at when keep_events_for is set to 0" do
         it "nulls out expires_at when keep_events_for is set to 0" do
-          lambda {
+          expect {
             @agent.options[:foo] = "bar"
             @agent.options[:foo] = "bar"
             @agent.keep_events_for = 0
             @agent.keep_events_for = 0
             @agent.save!
             @agent.save!
-          }.should change { @event.reload.expires_at }.to(nil)
+          }.to change { @event.reload.expires_at }.to(nil)
         end
         end
       end
       end
     end
     end
@@ -625,7 +625,7 @@ describe Agent do
         @sender.save!
         @sender.save!
         @sender.create_event :payload => {}
         @sender.create_event :payload => {}
         @sender.create_event :payload => {}
         @sender.create_event :payload => {}
-        @sender.events.count.should == 2
+        expect(@sender.events.count).to eq(2)
 
 
         @receiver = Agents::CannotBeScheduled.new(
         @receiver = Agents::CannotBeScheduled.new(
           name: 'Agent',
           name: 'Agent',
@@ -641,21 +641,21 @@ describe Agent do
       it "should create a clone of a given agent for editing" do
       it "should create a clone of a given agent for editing" do
         sender_clone = users(:bob).agents.build_clone(@sender)
         sender_clone = users(:bob).agents.build_clone(@sender)
 
 
-        sender_clone.attributes.should == Agent.new.attributes.
+        expect(sender_clone.attributes).to eq(Agent.new.attributes.
           update(@sender.slice(:user_id, :type,
           update(@sender.slice(:user_id, :type,
             :options, :schedule, :keep_events_for, :propagate_immediately)).
             :options, :schedule, :keep_events_for, :propagate_immediately)).
-          update('name' => 'Agent (2) (2)', 'options' => { 'foo' => 'bar2' })
+          update('name' => 'Agent (2) (2)', 'options' => { 'foo' => 'bar2' }))
 
 
-        sender_clone.source_ids.should == []
+        expect(sender_clone.source_ids).to eq([])
 
 
         receiver_clone = users(:bob).agents.build_clone(@receiver)
         receiver_clone = users(:bob).agents.build_clone(@receiver)
 
 
-        receiver_clone.attributes.should == Agent.new.attributes.
+        expect(receiver_clone.attributes).to eq(Agent.new.attributes.
           update(@receiver.slice(:user_id, :type,
           update(@receiver.slice(:user_id, :type,
             :options, :schedule, :keep_events_for, :propagate_immediately)).
             :options, :schedule, :keep_events_for, :propagate_immediately)).
-          update('name' => 'Agent (3)', 'options' => { 'foo' => 'bar3' })
+          update('name' => 'Agent (3)', 'options' => { 'foo' => 'bar3' }))
 
 
-        receiver_clone.source_ids.should == [@sender.id]
+        expect(receiver_clone.source_ids).to eq([@sender.id])
       end
       end
     end
     end
   end
   end
@@ -683,8 +683,8 @@ describe Agent do
 
 
       it "calls the .receive_web_request hook, updates last_web_request_at, and saves" do
       it "calls the .receive_web_request hook, updates last_web_request_at, and saves" do
         @agent.trigger_web_request({ :some_param => "some_value" }, "post", "text/html")
         @agent.trigger_web_request({ :some_param => "some_value" }, "post", "text/html")
-        @agent.reload.memory['last_request'].should == [ { "some_param" => "some_value" }, "post", "text/html" ]
-        @agent.last_web_request_at.to_i.should be_within(1).of(Time.now.to_i)
+        expect(@agent.reload.memory['last_request']).to eq([ { "some_param" => "some_value" }, "post", "text/html" ])
+        expect(@agent.last_web_request_at.to_i).to be_within(1).of(Time.now.to_i)
       end
       end
     end
     end
 
 
@@ -703,8 +703,8 @@ describe Agent do
       it "outputs a deprecation warning and calls .receive_webhook with the params" do
       it "outputs a deprecation warning and calls .receive_webhook with the params" do
         mock(Rails.logger).warn("DEPRECATED: The .receive_webhook method is deprecated, please switch your Agent to use .receive_web_request.")
         mock(Rails.logger).warn("DEPRECATED: The .receive_webhook method is deprecated, please switch your Agent to use .receive_web_request.")
         @agent.trigger_web_request({ :some_param => "some_value" }, "post", "text/html")
         @agent.trigger_web_request({ :some_param => "some_value" }, "post", "text/html")
-        @agent.reload.memory['last_webhook_request'].should == { "some_param" => "some_value" }
-        @agent.last_web_request_at.to_i.should be_within(1).of(Time.now.to_i)
+        expect(@agent.reload.memory['last_webhook_request']).to eq({ "some_param" => "some_value" })
+        expect(@agent.last_web_request_at.to_i).to be_within(1).of(Time.now.to_i)
       end
       end
     end
     end
   end
   end
@@ -713,23 +713,23 @@ describe Agent do
     describe "of_type" do
     describe "of_type" do
       it "should accept classes" do
       it "should accept classes" do
         agents = Agent.of_type(Agents::WebsiteAgent)
         agents = Agent.of_type(Agents::WebsiteAgent)
-        agents.should include(agents(:bob_website_agent))
-        agents.should include(agents(:jane_website_agent))
-        agents.should_not include(agents(:bob_weather_agent))
+        expect(agents).to include(agents(:bob_website_agent))
+        expect(agents).to include(agents(:jane_website_agent))
+        expect(agents).not_to include(agents(:bob_weather_agent))
       end
       end
 
 
       it "should accept strings" do
       it "should accept strings" do
         agents = Agent.of_type("Agents::WebsiteAgent")
         agents = Agent.of_type("Agents::WebsiteAgent")
-        agents.should include(agents(:bob_website_agent))
-        agents.should include(agents(:jane_website_agent))
-        agents.should_not include(agents(:bob_weather_agent))
+        expect(agents).to include(agents(:bob_website_agent))
+        expect(agents).to include(agents(:jane_website_agent))
+        expect(agents).not_to include(agents(:bob_weather_agent))
       end
       end
 
 
       it "should accept instances of an Agent" do
       it "should accept instances of an Agent" do
         agents = Agent.of_type(agents(:bob_website_agent))
         agents = Agent.of_type(agents(:bob_website_agent))
-        agents.should include(agents(:bob_website_agent))
-        agents.should include(agents(:jane_website_agent))
-        agents.should_not include(agents(:bob_weather_agent))
+        expect(agents).to include(agents(:bob_website_agent))
+        expect(agents).to include(agents(:jane_website_agent))
+        expect(agents).not_to include(agents(:bob_weather_agent))
       end
       end
     end
     end
   end
   end
@@ -737,23 +737,23 @@ describe Agent do
   describe "#create_event" do
   describe "#create_event" do
     describe "when the agent has keep_events_for set" do
     describe "when the agent has keep_events_for set" do
       before do
       before do
-        agents(:jane_weather_agent).keep_events_for.should > 0
+        expect(agents(:jane_weather_agent).keep_events_for).to be > 0
       end
       end
 
 
       it "sets expires_at on created events" do
       it "sets expires_at on created events" do
         event = agents(:jane_weather_agent).create_event :payload => { 'hi' => 'there' }
         event = agents(:jane_weather_agent).create_event :payload => { 'hi' => 'there' }
-        event.expires_at.to_i.should be_within(5).of(agents(:jane_weather_agent).keep_events_for.days.from_now.to_i)
+        expect(event.expires_at.to_i).to be_within(5).of(agents(:jane_weather_agent).keep_events_for.days.from_now.to_i)
       end
       end
     end
     end
 
 
     describe "when the agent does not have keep_events_for set" do
     describe "when the agent does not have keep_events_for set" do
       before do
       before do
-        agents(:jane_website_agent).keep_events_for.should == 0
+        expect(agents(:jane_website_agent).keep_events_for).to eq(0)
       end
       end
 
 
       it "does not set expires_at on created events" do
       it "does not set expires_at on created events" do
         event = agents(:jane_website_agent).create_event :payload => { 'hi' => 'there' }
         event = agents(:jane_website_agent).create_event :payload => { 'hi' => 'there' }
-        event.expires_at.should be_nil
+        expect(event.expires_at).to be_nil
       end
       end
     end
     end
   end
   end
@@ -764,13 +764,13 @@ describe Agent do
       agent.last_checked_event_id = nil
       agent.last_checked_event_id = nil
       agent.save!
       agent.save!
       agent.update!(drop_pending_events: true)
       agent.update!(drop_pending_events: true)
-      agent.reload.last_checked_event_id.should == Event.maximum(:id)
+      expect(agent.reload.last_checked_event_id).to eq(Event.maximum(:id))
     end
     end
 
 
     it "should not affect a virtual attribute drop_pending_events" do
     it "should not affect a virtual attribute drop_pending_events" do
       agent = agents(:bob_rain_notifier_agent)
       agent = agents(:bob_rain_notifier_agent)
       agent.update!(drop_pending_events: true)
       agent.update!(drop_pending_events: true)
-      agent.reload.drop_pending_events.should == false
+      expect(agent.reload.drop_pending_events).to eq(false)
     end
     end
   end
   end
 
 
@@ -784,30 +784,30 @@ describe Agent do
       agent1 = agents(:bob_weather_agent)
       agent1 = agents(:bob_weather_agent)
       agent2 = agents(:bob_rain_notifier_agent)
       agent2 = agents(:bob_rain_notifier_agent)
 
 
-      -> {
-        -> {
+      expect {
+        expect {
           Agent.async_check(agent1.id)
           Agent.async_check(agent1.id)
           Agent.receive!
           Agent.receive!
-        }.should change { agent1.events.count }.by(1)
-      }.should change { agent2.events.count }.by(1)
+        }.to change { agent1.events.count }.by(1)
+      }.to change { agent2.events.count }.by(1)
 
 
       agent2.disabled = true
       agent2.disabled = true
       agent2.save!
       agent2.save!
 
 
-      -> {
-        -> {
+      expect {
+        expect {
           Agent.async_check(agent1.id)
           Agent.async_check(agent1.id)
           Agent.receive!
           Agent.receive!
-        }.should change { agent1.events.count }.by(1)
-      }.should_not change { agent2.events.count }
+        }.to change { agent1.events.count }.by(1)
+      }.not_to change { agent2.events.count }
 
 
       agent2.disabled = false
       agent2.disabled = false
       agent2.drop_pending_events = true
       agent2.drop_pending_events = true
       agent2.save!
       agent2.save!
 
 
-      -> {
+      expect {
         Agent.receive!
         Agent.receive!
-      }.should_not change { agent2.events.count }
+      }.not_to change { agent2.events.count }
     end
     end
   end
   end
 end
 end
@@ -872,37 +872,37 @@ describe AgentDrop do
   end
   end
 
 
   it 'should be created via Agent#to_liquid' do
   it 'should be created via Agent#to_liquid' do
-    @wsa1.to_liquid.class.should be(AgentDrop)
-    @wsa2.to_liquid.class.should be(AgentDrop)
-    @efa.to_liquid.class.should be(AgentDrop)
+    expect(@wsa1.to_liquid.class).to be(AgentDrop)
+    expect(@wsa2.to_liquid.class).to be(AgentDrop)
+    expect(@efa.to_liquid.class).to be(AgentDrop)
   end
   end
 
 
   it 'should have .type and .name' do
   it 'should have .type and .name' do
     t = '{{agent.type}}: {{agent.name}}'
     t = '{{agent.type}}: {{agent.name}}'
-    interpolate(t, @wsa1).should eq('WebsiteAgent: XKCD')
-    interpolate(t, @wsa2).should eq('WebsiteAgent: Dilbert')
-    interpolate(t, @efa).should eq('EventFormattingAgent: Formatter')
+    expect(interpolate(t, @wsa1)).to eq('WebsiteAgent: XKCD')
+    expect(interpolate(t, @wsa2)).to eq('WebsiteAgent: Dilbert')
+    expect(interpolate(t, @efa)).to eq('EventFormattingAgent: Formatter')
   end
   end
 
 
   it 'should have .options' do
   it 'should have .options' do
     t = '{{agent.options.url}}'
     t = '{{agent.options.url}}'
-    interpolate(t, @wsa1).should eq('http://xkcd.com/')
-    interpolate(t, @wsa2).should eq('http://dilbert.com/')
-    interpolate('{{agent.options.instructions.message}}',
-                @efa).should eq('{{agent.name}}: {{title}} {{url}}')
+    expect(interpolate(t, @wsa1)).to eq('http://xkcd.com/')
+    expect(interpolate(t, @wsa2)).to eq('http://dilbert.com/')
+    expect(interpolate('{{agent.options.instructions.message}}',
+                @efa)).to eq('{{agent.name}}: {{title}} {{url}}')
   end
   end
 
 
   it 'should have .sources' do
   it 'should have .sources' do
     t = '{{agent.sources.size}}: {{agent.sources | map:"name" | join:", "}}'
     t = '{{agent.sources.size}}: {{agent.sources | map:"name" | join:", "}}'
-    interpolate(t, @wsa1).should eq('0: ')
-    interpolate(t, @wsa2).should eq('0: ')
-    interpolate(t, @efa).should eq('2: XKCD, Dilbert')
+    expect(interpolate(t, @wsa1)).to eq('0: ')
+    expect(interpolate(t, @wsa2)).to eq('0: ')
+    expect(interpolate(t, @efa)).to eq('2: XKCD, Dilbert')
   end
   end
 
 
   it 'should have .receivers' do
   it 'should have .receivers' do
     t = '{{agent.receivers.size}}: {{agent.receivers | map:"name" | join:", "}}'
     t = '{{agent.receivers.size}}: {{agent.receivers | map:"name" | join:", "}}'
-    interpolate(t, @wsa1).should eq('1: Formatter')
-    interpolate(t, @wsa2).should eq('1: Formatter')
-    interpolate(t, @efa).should eq('0: ')
+    expect(interpolate(t, @wsa1)).to eq('1: Formatter')
+    expect(interpolate(t, @wsa2)).to eq('1: Formatter')
+    expect(interpolate(t, @efa)).to eq('0: ')
   end
   end
 end
 end

+ 3 - 3
spec/models/agents/adioso_agent_spec.rb

@@ -27,12 +27,12 @@ describe Agents::AdiosoAgent do
 
 
 	describe "#working?" do
 	describe "#working?" do
 		it "checks if its generating events as scheduled" do
 		it "checks if its generating events as scheduled" do
-			@checker.should_not be_working
+			expect(@checker).not_to be_working
 			@checker.check
 			@checker.check
-			@checker.reload.should be_working
+			expect(@checker.reload).to be_working
 			three_days_from_now = 3.days.from_now
 			three_days_from_now = 3.days.from_now
 			stub(Time).now { three_days_from_now }
 			stub(Time).now { three_days_from_now }
-			@checker.should_not be_working
+			expect(@checker).not_to be_working
 		end
 		end
 	end
 	end
 end
 end

+ 8 - 8
spec/models/agents/basecamp_agent_spec.rb

@@ -17,35 +17,35 @@ describe Agents::BasecampAgent do
 
 
   describe "validating" do
   describe "validating" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should require the basecamp project_id" do
     it "should require the basecamp project_id" do
       @checker.options['project_id'] = nil
       @checker.options['project_id'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
   end
   end
 
 
   describe "helpers" do
   describe "helpers" do
     it "should generate a correct request options hash" do
     it "should generate a correct request options hash" do
-      @checker.send(:request_options).should == {:headers => {"User-Agent" => "Huginn (https://github.com/cantino/huginn)", "Authorization" => 'Bearer "1234token"'}}
+      expect(@checker.send(:request_options)).to eq({:headers => {"User-Agent" => "Huginn (https://github.com/cantino/huginn)", "Authorization" => 'Bearer "1234token"'}})
     end
     end
 
 
     it "should generate the currect request url" do
     it "should generate the currect request url" do
-      @checker.send(:request_url).should == "https://basecamp.com/12345/api/v1/projects/6789/events.json"
+      expect(@checker.send(:request_url)).to eq("https://basecamp.com/12345/api/v1/projects/6789/events.json")
     end
     end
 
 
 
 
     it "should not provide the since attribute on first run" do
     it "should not provide the since attribute on first run" do
-      @checker.send(:query_parameters).should == {}
+      expect(@checker.send(:query_parameters)).to eq({})
     end
     end
 
 
     it "should provide the since attribute after the first run" do
     it "should provide the since attribute after the first run" do
       time = (Time.now-1.minute).iso8601
       time = (Time.now-1.minute).iso8601
       @checker.memory[:last_event] = time
       @checker.memory[:last_event] = time
       @checker.save
       @checker.save
-      @checker.reload.send(:query_parameters).should == {:query => {:since => time}}
+      expect(@checker.reload.send(:query_parameters)).to eq({:query => {:since => time}})
     end
     end
   end
   end
   describe "#check" do
   describe "#check" do
@@ -61,10 +61,10 @@ describe Agents::BasecampAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "it is working when at least one event was emited" do
     it "it is working when at least one event was emited" do
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
       @checker.memory[:last_event] = '2014-04-17T10:25:31.000+02:00'
       @checker.memory[:last_event] = '2014-04-17T10:25:31.000+02:00'
       @checker.check
       @checker.check
-      @checker.reload.should be_working
+      expect(@checker.reload).to be_working
     end
     end
   end
   end
 end
 end

+ 7 - 7
spec/models/agents/change_detector_agent_spec.rb

@@ -26,17 +26,17 @@ describe Agents::ChangeDetectorAgent do
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of property" do
     it "should validate presence of property" do
       @checker.options[:property] = nil
       @checker.options[:property] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of property" do
     it "should validate presence of property" do
       @checker.options[:expected_update_period_in_days] = nil
       @checker.options[:expected_update_period_in_days] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
   end
   end
 
 
@@ -49,14 +49,14 @@ describe Agents::ChangeDetectorAgent do
 
 
     it "is when event created within :expected_update_period_in_days" do
     it "is when event created within :expected_update_period_in_days" do
       @checker.options[:expected_update_period_in_days] = 2
       @checker.options[:expected_update_period_in_days] = 2
-      @checker.should be_working
+      expect(@checker).to be_working
     end
     end
 
 
     it "isnt when event created outside :expected_update_period_in_days" do
     it "isnt when event created outside :expected_update_period_in_days" do
       @checker.options[:expected_update_period_in_days] = 2
       @checker.options[:expected_update_period_in_days] = 2
 
 
       time_travel_to 2.days.from_now do
       time_travel_to 2.days.from_now do
-          @checker.should_not be_working
+          expect(@checker).not_to be_working
       end
       end
     end
     end
   end
   end
@@ -71,8 +71,8 @@ describe Agents::ChangeDetectorAgent do
       expect {
       expect {
         @checker.receive([@event])
         @checker.receive([@event])
       }.to change(Event, :count).by(1)
       }.to change(Event, :count).by(1)
-      Event.last.payload[:command].should == @event.payload[:command]
-      Event.last.payload[:output].should == @event.payload[:output]
+      expect(Event.last.payload[:command]).to eq(@event.payload[:command])
+      expect(Event.last.payload[:output]).to eq(@event.payload[:output])
     end
     end
 
 
     it "creates events when new event changed" do
     it "creates events when new event changed" do

+ 27 - 27
spec/models/agents/data_output_agent_spec.rb

@@ -15,51 +15,51 @@ describe Agents::DataOutputAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "checks if events have been received within expected receive period" do
     it "checks if events have been received within expected receive period" do
-      agent.should_not be_working
+      expect(agent).not_to be_working
       Agents::DataOutputAgent.async_receive agent.id, [events(:bob_website_agent_event).id]
       Agents::DataOutputAgent.async_receive agent.id, [events(:bob_website_agent_event).id]
-      agent.reload.should be_working
+      expect(agent.reload).to be_working
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      agent.reload.should_not be_working
+      expect(agent.reload).not_to be_working
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      agent.should be_valid
+      expect(agent).to be_valid
     end
     end
 
 
     it "should validate presence and length of secrets" do
     it "should validate presence and length of secrets" do
       agent.options[:secrets] = ""
       agent.options[:secrets] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:secrets] = "foo"
       agent.options[:secrets] = "foo"
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:secrets] = []
       agent.options[:secrets] = []
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:secrets] = ["hello"]
       agent.options[:secrets] = ["hello"]
-      agent.should be_valid
+      expect(agent).to be_valid
       agent.options[:secrets] = ["hello", "world"]
       agent.options[:secrets] = ["hello", "world"]
-      agent.should be_valid
+      expect(agent).to be_valid
     end
     end
 
 
     it "should validate presence of expected_receive_period_in_days" do
     it "should validate presence of expected_receive_period_in_days" do
       agent.options[:expected_receive_period_in_days] = ""
       agent.options[:expected_receive_period_in_days] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:expected_receive_period_in_days] = 0
       agent.options[:expected_receive_period_in_days] = 0
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:expected_receive_period_in_days] = -1
       agent.options[:expected_receive_period_in_days] = -1
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
 
 
     it "should validate presence of template and template.item" do
     it "should validate presence of template and template.item" do
       agent.options[:template] = ""
       agent.options[:template] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:template] = {}
       agent.options[:template] = {}
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:template] = { 'item' => 'foo' }
       agent.options[:template] = { 'item' => 'foo' }
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
       agent.options[:template] = { 'item' => { 'title' => 'hi' } }
       agent.options[:template] = { 'item' => { 'title' => 'hi' } }
-      agent.should be_valid
+      expect(agent).to be_valid
     end
     end
   end
   end
 
 
@@ -72,15 +72,15 @@ describe Agents::DataOutputAgent do
 
 
     it "requires a valid secret" do
     it "requires a valid secret" do
       content, status, content_type = agent.receive_web_request({ 'secret' => 'fake' }, 'get', 'text/xml')
       content, status, content_type = agent.receive_web_request({ 'secret' => 'fake' }, 'get', 'text/xml')
-      status.should == 401
-      content.should == "Not Authorized"
+      expect(status).to eq(401)
+      expect(content).to eq("Not Authorized")
 
 
       content, status, content_type = agent.receive_web_request({ 'secret' => 'fake' }, 'get', 'application/json')
       content, status, content_type = agent.receive_web_request({ 'secret' => 'fake' }, 'get', 'application/json')
-      status.should == 401
-      content.should == { :error => "Not Authorized" }
+      expect(status).to eq(401)
+      expect(content).to eq({ :error => "Not Authorized" })
 
 
       content, status, content_type = agent.receive_web_request({ 'secret' => 'secret1' }, 'get', 'application/json')
       content, status, content_type = agent.receive_web_request({ 'secret' => 'secret1' }, 'get', 'application/json')
-      status.should == 200
+      expect(status).to eq(200)
     end
     end
 
 
     describe "returning events as RSS and JSON" do
     describe "returning events as RSS and JSON" do
@@ -113,9 +113,9 @@ describe Agents::DataOutputAgent do
       it "can output RSS" do
       it "can output RSS" do
         stub(agent).feed_link { "https://yoursite.com" }
         stub(agent).feed_link { "https://yoursite.com" }
         content, status, content_type = agent.receive_web_request({ 'secret' => 'secret1' }, 'get', 'text/xml')
         content, status, content_type = agent.receive_web_request({ 'secret' => 'secret1' }, 'get', 'text/xml')
-        status.should == 200
-        content_type.should == 'text/xml'
-        content.gsub(/\s+/, '').should == Utils.unindent(<<-XML).gsub(/\s+/, '')
+        expect(status).to eq(200)
+        expect(content_type).to eq('text/xml')
+        expect(content.gsub(/\s+/, '')).to eq Utils.unindent(<<-XML).gsub(/\s+/, '')
           <?xml version="1.0" encoding="UTF-8" ?>
           <?xml version="1.0" encoding="UTF-8" ?>
           <rss version="2.0">
           <rss version="2.0">
           <channel>
           <channel>
@@ -159,9 +159,9 @@ describe Agents::DataOutputAgent do
         agent.options['template']['item']['foo'] = "hi"
         agent.options['template']['item']['foo'] = "hi"
 
 
         content, status, content_type = agent.receive_web_request({ 'secret' => 'secret2' }, 'get', 'application/json')
         content, status, content_type = agent.receive_web_request({ 'secret' => 'secret2' }, 'get', 'application/json')
-        status.should == 200
+        expect(status).to eq(200)
 
 
-        content.should == {
+        expect(content).to eq({
           'title' => 'XKCD comics as a feed',
           'title' => 'XKCD comics as a feed',
           'description' => 'This is a feed of recent XKCD comics, generated by Huginn',
           'description' => 'This is a feed of recent XKCD comics, generated by Huginn',
           'pubDate' => Time.now,
           'pubDate' => Time.now,
@@ -191,7 +191,7 @@ describe Agents::DataOutputAgent do
               'foo' => 'hi'
               'foo' => 'hi'
             }
             }
           ]
           ]
-        }
+        })
       end
       end
     end
     end
   end
   end

+ 9 - 9
spec/models/agents/email_agent_spec.rb

@@ -19,7 +19,7 @@ describe Agents::EmailAgent do
 
 
   describe "#receive" do
   describe "#receive" do
     it "immediately sends any payloads it receives" do
     it "immediately sends any payloads it receives" do
-      ActionMailer::Base.deliveries.should == []
+      expect(ActionMailer::Base.deliveries).to eq([])
 
 
       event1 = Event.new
       event1 = Event.new
       event1.agent = agents(:bob_rain_notifier_agent)
       event1.agent = agents(:bob_rain_notifier_agent)
@@ -34,11 +34,11 @@ describe Agents::EmailAgent do
       Agents::EmailAgent.async_receive(@checker.id, [event1.id])
       Agents::EmailAgent.async_receive(@checker.id, [event1.id])
       Agents::EmailAgent.async_receive(@checker.id, [event2.id])
       Agents::EmailAgent.async_receive(@checker.id, [event2.id])
 
 
-      ActionMailer::Base.deliveries.count.should == 2
-      ActionMailer::Base.deliveries.last.to.should == ["bob@example.com"]
-      ActionMailer::Base.deliveries.last.subject.should == "something interesting"
-      get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip.should == "Event\n  data: Something else you should know about"
-      get_message_part(ActionMailer::Base.deliveries.first, /plain/).strip.should == "Event\n  data: Something you should know about"
+      expect(ActionMailer::Base.deliveries.count).to eq(2)
+      expect(ActionMailer::Base.deliveries.last.to).to eq(["bob@example.com"])
+      expect(ActionMailer::Base.deliveries.last.subject).to eq("something interesting")
+      expect(get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip).to eq("Event\n  data: Something else you should know about")
+      expect(get_message_part(ActionMailer::Base.deliveries.first, /plain/).strip).to eq("Event\n  data: Something you should know about")
     end
     end
 
 
     it "can receive complex events and send them on" do
     it "can receive complex events and send them on" do
@@ -53,8 +53,8 @@ describe Agents::EmailAgent do
       plain_email_text = get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip
       plain_email_text = get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip
       html_email_text = get_message_part(ActionMailer::Base.deliveries.last, /html/).strip
       html_email_text = get_message_part(ActionMailer::Base.deliveries.last, /html/).strip
 
 
-      plain_email_text.should =~ /avehumidity/
-      html_email_text.should =~ /avehumidity/
+      expect(plain_email_text).to match(/avehumidity/)
+      expect(html_email_text).to match(/avehumidity/)
     end
     end
   end
   end
-end
+end

+ 10 - 10
spec/models/agents/email_digest_agent_spec.rb

@@ -30,14 +30,14 @@ describe Agents::EmailDigestAgent do
       event2.save!
       event2.save!
 
 
       Agents::EmailDigestAgent.async_receive(@checker.id, [event1.id, event2.id])
       Agents::EmailDigestAgent.async_receive(@checker.id, [event1.id, event2.id])
-      @checker.reload.memory[:queue].should == [{ 'data' => "Something you should know about" }, { 'data' => "Something else you should know about" }]
+      expect(@checker.reload.memory[:queue]).to eq([{ 'data' => "Something you should know about" }, { 'data' => "Something else you should know about" }])
     end
     end
   end
   end
 
 
   describe "#check" do
   describe "#check" do
     it "should send an email" do
     it "should send an email" do
       Agents::EmailDigestAgent.async_check(@checker.id)
       Agents::EmailDigestAgent.async_check(@checker.id)
-      ActionMailer::Base.deliveries.should == []
+      expect(ActionMailer::Base.deliveries).to eq([])
 
 
       @checker.memory[:queue] = [{ :data => "Something you should know about" },
       @checker.memory[:queue] = [{ :data => "Something you should know about" },
                                  { :title => "Foo", :url => "http://google.com", :bar => 2 },
                                  { :title => "Foo", :url => "http://google.com", :bar => 2 },
@@ -47,10 +47,10 @@ describe Agents::EmailDigestAgent do
       @checker.save!
       @checker.save!
 
 
       Agents::EmailDigestAgent.async_check(@checker.id)
       Agents::EmailDigestAgent.async_check(@checker.id)
-      ActionMailer::Base.deliveries.last.to.should == ["bob@example.com"]
-      ActionMailer::Base.deliveries.last.subject.should == "something interesting"
-      get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip.should == "Event\n  data: Something you should know about\n\nFoo\n  bar: 2\n  url: http://google.com\n\nhi\n  woah: there\n\nEvent\n  test: 2"
-      @checker.reload.memory[:queue].should be_empty
+      expect(ActionMailer::Base.deliveries.last.to).to eq(["bob@example.com"])
+      expect(ActionMailer::Base.deliveries.last.subject).to eq("something interesting")
+      expect(get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip).to eq("Event\n  data: Something you should know about\n\nFoo\n  bar: 2\n  url: http://google.com\n\nhi\n  woah: there\n\nEvent\n  test: 2")
+      expect(@checker.reload.memory[:queue]).to be_empty
     end
     end
 
 
     it "can receive complex events and send them on" do
     it "can receive complex events and send them on" do
@@ -61,17 +61,17 @@ describe Agents::EmailDigestAgent do
       Agent.async_check(agents(:bob_weather_agent).id)
       Agent.async_check(agents(:bob_weather_agent).id)
 
 
       Agent.receive!
       Agent.receive!
-      @checker.reload.memory[:queue].should_not be_empty
+      expect(@checker.reload.memory[:queue]).not_to be_empty
 
 
       Agents::EmailDigestAgent.async_check(@checker.id)
       Agents::EmailDigestAgent.async_check(@checker.id)
 
 
       plain_email_text = get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip
       plain_email_text = get_message_part(ActionMailer::Base.deliveries.last, /plain/).strip
       html_email_text = get_message_part(ActionMailer::Base.deliveries.last, /html/).strip
       html_email_text = get_message_part(ActionMailer::Base.deliveries.last, /html/).strip
 
 
-      plain_email_text.should =~ /avehumidity/
-      html_email_text.should =~ /avehumidity/
+      expect(plain_email_text).to match(/avehumidity/)
+      expect(html_email_text).to match(/avehumidity/)
 
 
-      @checker.reload.memory[:queue].should be_empty
+      expect(@checker.reload.memory[:queue]).to be_empty
     end
     end
   end
   end
 end
 end

+ 18 - 18
spec/models/agents/event_formatting_agent_spec.rb

@@ -45,26 +45,26 @@ describe Agents::EventFormattingAgent do
   describe "#receive" do
   describe "#receive" do
     it "should accept clean mode" do
     it "should accept clean mode" do
       @checker.receive([@event])
       @checker.receive([@event])
-      Event.last.payload[:content].should == nil
+      expect(Event.last.payload[:content]).to eq(nil)
     end
     end
 
 
     it "should accept merge mode" do
     it "should accept merge mode" do
       @checker.options[:mode] = "merge"
       @checker.options[:mode] = "merge"
       @checker.receive([@event])
       @checker.receive([@event])
-      Event.last.payload[:content].should_not == nil
+      expect(Event.last.payload[:content]).not_to eq(nil)
     end
     end
 
 
     it "should handle Liquid templating in instructions" do
     it "should handle Liquid templating in instructions" do
       @checker.receive([@event])
       @checker.receive([@event])
-      Event.last.payload[:message].should == "Received Some Lorem Ipsum from somevalue ."
-      Event.last.payload[:agent].should == "WeatherAgent"
-      Event.last.payload[:created_at].should == @event.created_at.to_s
-      Event.last.payload[:created_at_iso].should == @event.created_at.iso8601
+      expect(Event.last.payload[:message]).to eq("Received Some Lorem Ipsum from somevalue .")
+      expect(Event.last.payload[:agent]).to eq("WeatherAgent")
+      expect(Event.last.payload[:created_at]).to eq(@event.created_at.to_s)
+      expect(Event.last.payload[:created_at_iso]).to eq(@event.created_at.iso8601)
     end
     end
 
 
     it "should handle matchers and Liquid templating in instructions" do
     it "should handle matchers and Liquid templating in instructions" do
       @checker.receive([@event])
       @checker.receive([@event])
-      Event.last.payload[:subject].should == "Weather looks like someothervalue according to the forecast at 10:00 PM EST"
+      expect(Event.last.payload[:subject]).to eq("Weather looks like someothervalue according to the forecast at 10:00 PM EST")
     end
     end
 
 
     it "should allow escaping" do
     it "should allow escaping" do
@@ -73,7 +73,7 @@ describe Agents::EventFormattingAgent do
       @checker.options[:instructions][:message] = "Escaped: {{content.name | uri_escape}}\nNot escaped: {{content.name}}"
       @checker.options[:instructions][:message] = "Escaped: {{content.name | uri_escape}}\nNot escaped: {{content.name}}"
       @checker.save!
       @checker.save!
       @checker.receive([@event])
       @checker.receive([@event])
-      Event.last.payload[:message].should == "Escaped: escape+this%21%3F\nNot escaped: escape this!?"
+      expect(Event.last.payload[:message]).to eq("Escaped: escape+this%21%3F\nNot escaped: escape this!?")
     end
     end
 
 
     it "should handle multiple events" do
     it "should handle multiple events" do
@@ -97,47 +97,47 @@ describe Agents::EventFormattingAgent do
           :conditions => "someothervalue"
           :conditions => "someothervalue"
       }
       }
 
 
-      lambda {
+      expect {
         @checker.receive([event2, event1])
         @checker.receive([event2, event1])
-      }.should change { Event.count }.by(2)
+      }.to change { Event.count }.by(2)
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of instructions" do
     it "should validate presence of instructions" do
       @checker.options[:instructions] = ""
       @checker.options[:instructions] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate type of matchers" do
     it "should validate type of matchers" do
       @checker.options[:matchers] = ""
       @checker.options[:matchers] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options[:matchers] = {}
       @checker.options[:matchers] = {}
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate the contents of matchers" do
     it "should validate the contents of matchers" do
       @checker.options[:matchers] = [
       @checker.options[:matchers] = [
         {}
         {}
       ]
       ]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options[:matchers] = [
       @checker.options[:matchers] = [
         { :regexp => "(not closed", :path => "text" }
         { :regexp => "(not closed", :path => "text" }
       ]
       ]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options[:matchers] = [
       @checker.options[:matchers] = [
         { :regexp => "(closed)", :path => "text", :to => "foo" }
         { :regexp => "(closed)", :path => "text", :to => "foo" }
       ]
       ]
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of mode" do
     it "should validate presence of mode" do
       @checker.options[:mode] = ""
       @checker.options[:mode] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
   end
   end
 end
 end

+ 21 - 21
spec/models/agents/ftpsite_agent_spec.rb

@@ -26,28 +26,28 @@ describe Agents::FtpsiteAgent do
 
 
       it "should validate the integer fields" do
       it "should validate the integer fields" do
         @checker.options['expected_update_period_in_days'] = "nonsense"
         @checker.options['expected_update_period_in_days'] = "nonsense"
-        lambda { @checker.save! }.should raise_error;
+        expect { @checker.save! }.to raise_error;
         @checker.options = @site
         @checker.options = @site
       end
       end
 
 
       it "should check for changes and save known entries in memory" do
       it "should check for changes and save known entries in memory" do
-        lambda { @checker.check }.should change { Event.count }.by(3)
+        expect { @checker.check }.to change { Event.count }.by(3)
         @checker.memory['known_entries'].tap { |known_entries|
         @checker.memory['known_entries'].tap { |known_entries|
-          known_entries.size.should == 3
-          known_entries.sort_by(&:last).should == [
+          expect(known_entries.size).to eq(3)
+          expect(known_entries.sort_by(&:last)).to eq([
             ["example-1.0.tar.gz",    "2013-10-01T10:00:00Z"],
             ["example-1.0.tar.gz",    "2013-10-01T10:00:00Z"],
             ["example-1.1.tar.gz",    "2014-04-01T10:00:00Z"],
             ["example-1.1.tar.gz",    "2014-04-01T10:00:00Z"],
             ["example latest.tar.gz", "2014-04-01T10:00:01Z"],
             ["example latest.tar.gz", "2014-04-01T10:00:01Z"],
-          ]
+          ])
         }
         }
 
 
-        Event.last(2).first.payload.should == {
+        expect(Event.last(2).first.payload).to eq({
           'url' => 'ftp://ftp.example.org/pub/releases/example-1.1.tar.gz',
           'url' => 'ftp://ftp.example.org/pub/releases/example-1.1.tar.gz',
           'filename' => 'example-1.1.tar.gz',
           'filename' => 'example-1.1.tar.gz',
           'timestamp' => '2014-04-01T10:00:00Z',
           'timestamp' => '2014-04-01T10:00:00Z',
-        }
+        })
 
 
-        lambda { @checker.check }.should_not change { Event.count }
+        expect { @checker.check }.not_to change { Event.count }
 
 
         stub(@checker).each_entry.returns { |block|
         stub(@checker).each_entry.returns { |block|
           block.call("example latest.tar.gz", Time.parse("2014-04-02T10:00:01Z"))
           block.call("example latest.tar.gz", Time.parse("2014-04-02T10:00:01Z"))
@@ -59,30 +59,30 @@ describe Agents::FtpsiteAgent do
           block.call("example-1.1.tar.gz",    Time.parse("2014-04-01T10:00:00Z"))
           block.call("example-1.1.tar.gz",    Time.parse("2014-04-01T10:00:00Z"))
           block.call("example-1.2.tar.gz",    Time.parse("2014-04-02T10:00:00Z"))
           block.call("example-1.2.tar.gz",    Time.parse("2014-04-02T10:00:00Z"))
         }
         }
-        lambda { @checker.check }.should change { Event.count }.by(2)
+        expect { @checker.check }.to change { Event.count }.by(2)
         @checker.memory['known_entries'].tap { |known_entries|
         @checker.memory['known_entries'].tap { |known_entries|
-          known_entries.size.should == 4
-          known_entries.sort_by(&:last).should == [
+          expect(known_entries.size).to eq(4)
+          expect(known_entries.sort_by(&:last)).to eq([
             ["example-1.0.tar.gz",    "2013-10-01T00:00:00Z"],
             ["example-1.0.tar.gz",    "2013-10-01T00:00:00Z"],
             ["example-1.1.tar.gz",    "2014-04-01T10:00:00Z"],
             ["example-1.1.tar.gz",    "2014-04-01T10:00:00Z"],
             ["example-1.2.tar.gz",    "2014-04-02T10:00:00Z"],
             ["example-1.2.tar.gz",    "2014-04-02T10:00:00Z"],
             ["example latest.tar.gz", "2014-04-02T10:00:01Z"],
             ["example latest.tar.gz", "2014-04-02T10:00:01Z"],
-          ]
+          ])
         }
         }
 
 
-        Event.last(2).first.payload.should == {
+        expect(Event.last(2).first.payload).to eq({
           'url' => 'ftp://ftp.example.org/pub/releases/example-1.2.tar.gz',
           'url' => 'ftp://ftp.example.org/pub/releases/example-1.2.tar.gz',
           'filename' => 'example-1.2.tar.gz',
           'filename' => 'example-1.2.tar.gz',
           'timestamp' => '2014-04-02T10:00:00Z',
           'timestamp' => '2014-04-02T10:00:00Z',
-        }
+        })
 
 
-        Event.last.payload.should == {
+        expect(Event.last.payload).to eq({
           'url' => 'ftp://ftp.example.org/pub/releases/example%20latest.tar.gz',
           'url' => 'ftp://ftp.example.org/pub/releases/example%20latest.tar.gz',
           'filename' => 'example latest.tar.gz',
           'filename' => 'example latest.tar.gz',
           'timestamp' => '2014-04-02T10:00:01Z',
           'timestamp' => '2014-04-02T10:00:01Z',
-        }
+        })
 
 
-        lambda { @checker.check }.should_not change { Event.count }
+        expect { @checker.check }.not_to change { Event.count }
       end
       end
     end
     end
 
 
@@ -99,17 +99,17 @@ describe Agents::FtpsiteAgent do
         entries = []
         entries = []
         @checker.each_entry { |a, b| entries.push [a, b] }
         @checker.each_entry { |a, b| entries.push [a, b] }
 
 
-        entries.size.should == 1
+        expect(entries.size).to eq(1)
         filename, mtime = entries.first
         filename, mtime = entries.first
-        filename.should == 'example latest.tar.gz'
-        mtime.should == '2014-04-02T10:01:00Z'
+        expect(filename).to eq('example latest.tar.gz')
+        expect(mtime).to eq('2014-04-02T10:01:00Z')
       end
       end
 
 
       it "filters out files that are older than the given date" do
       it "filters out files that are older than the given date" do
         @checker.options['after'] = '2015-10-21'
         @checker.options['after'] = '2015-10-21'
         entries = []
         entries = []
         @checker.each_entry { |a, b| entries.push [a, b] }
         @checker.each_entry { |a, b| entries.push [a, b] }
-        entries.size.should == 0
+        expect(entries.size).to eq(0)
       end
       end
     end
     end
 
 

+ 1 - 1
spec/models/agents/google_calendar_publish_agent_spec.rb

@@ -37,7 +37,7 @@ describe Agents::GoogleCalendarPublishAgent, :vcr do
 
 
       @checker.receive([event1])
       @checker.receive([event1])
 
 
-      @checker.events.count.should eq(1)
+      expect(@checker.events.count).to eq(1)
     end
     end
   end
   end
 end
 end

+ 10 - 10
spec/models/agents/growl_agent_spec.rb

@@ -21,35 +21,35 @@ describe Agents::GrowlAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "checks if events have been received within the expected receive period" do
     it "checks if events have been received within the expected receive period" do
-      @checker.should_not be_working # No events received
+      expect(@checker).not_to be_working # No events received
       Agents::GrowlAgent.async_receive @checker.id, [@event.id]
       Agents::GrowlAgent.async_receive @checker.id, [@event.id]
-      @checker.reload.should be_working # Just received events
+      expect(@checker.reload).to be_working # Just received events
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      @checker.reload.should_not be_working # More time has passed than the expected receive period without any new events
+      expect(@checker.reload).not_to be_working # More time has passed than the expected receive period without any new events
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of of growl_server" do
     it "should validate presence of of growl_server" do
       @checker.options[:growl_server] = ""
       @checker.options[:growl_server] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of expected_receive_period_in_days" do
     it "should validate presence of expected_receive_period_in_days" do
       @checker.options[:expected_receive_period_in_days] = ""
       @checker.options[:expected_receive_period_in_days] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
   end
   end
   
   
   describe "register_growl" do
   describe "register_growl" do
     it "should set the password for the Growl connection from the agent options" do
     it "should set the password for the Growl connection from the agent options" do
       @checker.register_growl
       @checker.register_growl
-      @checker.growler.password.should eql(@checker.options[:growl_password])
+      expect(@checker.growler.password).to eql(@checker.options[:growl_password])
     end
     end
 
 
     it "should add a notification to the Growl connection" do
     it "should add a notification to the Growl connection" do
@@ -60,7 +60,7 @@ describe Agents::GrowlAgent do
       end
       end
       
       
       @checker.register_growl
       @checker.register_growl
-      called.should be_truthy
+      expect(called).to be_truthy
     end
     end
   end
   end
   
   
@@ -78,7 +78,7 @@ describe Agents::GrowlAgent do
         mock(obj).notify(@checker.options[:growl_notification_name],subject,message)
         mock(obj).notify(@checker.options[:growl_notification_name],subject,message)
       end
       end
       @checker.notify_growl(subject,message)
       @checker.notify_growl(subject,message)
-      called.should be_truthy
+      expect(called).to be_truthy
     end
     end
   end
   end
   
   
@@ -119,4 +119,4 @@ describe Agents::GrowlAgent do
       @checker.receive([event_without_a_subject,event_without_a_message])
       @checker.receive([event_without_a_subject,event_without_a_message])
     end
     end
   end
   end
-end
+end

+ 10 - 10
spec/models/agents/hipchat_agent_spec.rb

@@ -23,30 +23,30 @@ describe Agents::HipchatAgent do
 
 
   describe "validating" do
   describe "validating" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should require the basecamp username" do
     it "should require the basecamp username" do
       @checker.options['auth_token'] = nil
       @checker.options['auth_token'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should require the basecamp password" do
     it "should require the basecamp password" do
       @checker.options['room_name'] = nil
       @checker.options['room_name'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should require the basecamp user_id" do
     it "should require the basecamp user_id" do
       @checker.options['room_name'] = nil
       @checker.options['room_name'] = nil
       @checker.options['room_name_path'] = 'jsonpath'
       @checker.options['room_name_path'] = 'jsonpath'
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should also allow a credential" do
     it "should also allow a credential" do
       @checker.options['auth_token'] = nil
       @checker.options['auth_token'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.user.user_credentials.create :credential_name => 'hipchat_auth_token', :credential_value => 'something'
       @checker.user.user_credentials.create :credential_name => 'hipchat_auth_token', :credential_value => 'something'
-      @checker.reload.should be_valid
+      expect(@checker.reload).to be_valid
     end
     end
   end
   end
 
 
@@ -61,21 +61,21 @@ describe Agents::HipchatAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "should not be working until the first event was received" do
     it "should not be working until the first event was received" do
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
       @checker.last_receive_at = Time.now
       @checker.last_receive_at = Time.now
-      @checker.should be_working
+      expect(@checker).to be_working
     end
     end
 
 
     it "should not be working when the last error occured after the last received event" do
     it "should not be working when the last error occured after the last received event" do
       @checker.last_receive_at = Time.now - 1.minute
       @checker.last_receive_at = Time.now - 1.minute
       @checker.last_error_log_at = Time.now
       @checker.last_error_log_at = Time.now
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
     end
     end
 
 
     it "should be working when the last received event occured after the last error" do
     it "should be working when the last received event occured after the last error" do
       @checker.last_receive_at = Time.now
       @checker.last_receive_at = Time.now
       @checker.last_error_log_at = Time.now - 1.minute
       @checker.last_error_log_at = Time.now - 1.minute
-      @checker.should be_working
+      expect(@checker).to be_working
     end
     end
   end
   end
 end
 end

+ 111 - 111
spec/models/agents/human_task_agent_spec.rb

@@ -13,143 +13,143 @@ describe Agents::HumanTaskAgent do
                        'name' => "Joe" }
                        'name' => "Joe" }
     @event.id = 345
     @event.id = 345
 
 
-    @checker.should be_valid
+    expect(@checker).to be_valid
   end
   end
 
 
   describe "validations" do
   describe "validations" do
     it "validates that trigger_on is 'schedule' or 'event'" do
     it "validates that trigger_on is 'schedule' or 'event'" do
       @checker.options['trigger_on'] = "foo"
       @checker.options['trigger_on'] = "foo"
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "requires expected_receive_period_in_days when trigger_on is set to 'event'" do
     it "requires expected_receive_period_in_days when trigger_on is set to 'event'" do
       @checker.options['trigger_on'] = "event"
       @checker.options['trigger_on'] = "event"
       @checker.options['expected_receive_period_in_days'] = nil
       @checker.options['expected_receive_period_in_days'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['expected_receive_period_in_days'] = 2
       @checker.options['expected_receive_period_in_days'] = 2
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "requires a positive submission_period when trigger_on is set to 'schedule'" do
     it "requires a positive submission_period when trigger_on is set to 'schedule'" do
       @checker.options['trigger_on'] = "schedule"
       @checker.options['trigger_on'] = "schedule"
       @checker.options['submission_period'] = nil
       @checker.options['submission_period'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['submission_period'] = 2
       @checker.options['submission_period'] = 2
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "requires a hit.title" do
     it "requires a hit.title" do
       @checker.options['hit']['title'] = ""
       @checker.options['hit']['title'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "requires a hit.description" do
     it "requires a hit.description" do
       @checker.options['hit']['description'] = ""
       @checker.options['hit']['description'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "requires hit.assignments" do
     it "requires hit.assignments" do
       @checker.options['hit']['assignments'] = ""
       @checker.options['hit']['assignments'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['assignments'] = 0
       @checker.options['hit']['assignments'] = 0
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['assignments'] = "moose"
       @checker.options['hit']['assignments'] = "moose"
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['assignments'] = "2"
       @checker.options['hit']['assignments'] = "2"
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "requires hit.questions" do
     it "requires hit.questions" do
       old_questions = @checker.options['hit']['questions']
       old_questions = @checker.options['hit']['questions']
       @checker.options['hit']['questions'] = nil
       @checker.options['hit']['questions'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'] = []
       @checker.options['hit']['questions'] = []
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'] = [old_questions[0]]
       @checker.options['hit']['questions'] = [old_questions[0]]
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "requires that all questions have key, name, required, type, and question" do
     it "requires that all questions have key, name, required, type, and question" do
       old_questions = @checker.options['hit']['questions']
       old_questions = @checker.options['hit']['questions']
       @checker.options['hit']['questions'].first['key'] = ""
       @checker.options['hit']['questions'].first['key'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'].first['name'] = ""
       @checker.options['hit']['questions'].first['name'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'].first['required'] = nil
       @checker.options['hit']['questions'].first['required'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'].first['type'] = ""
       @checker.options['hit']['questions'].first['type'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'] = old_questions
       @checker.options['hit']['questions'].first['question'] = ""
       @checker.options['hit']['questions'].first['question'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "requires that all questions of type 'selection' have a selections array with keys and text" do
     it "requires that all questions of type 'selection' have a selections array with keys and text" do
       @checker.options['hit']['questions'][0]['selections'] = []
       @checker.options['hit']['questions'][0]['selections'] = []
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'][0]['selections'] = [{}]
       @checker.options['hit']['questions'][0]['selections'] = [{}]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "", 'text' => "" }]
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "", 'text' => "" }]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "", 'text' => "hi" }]
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "", 'text' => "hi" }]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "hi", 'text' => "" }]
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "hi", 'text' => "" }]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "hi", 'text' => "hi" }]
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "hi", 'text' => "hi" }]
-      @checker.should be_valid
+      expect(@checker).to be_valid
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "hi", 'text' => "hi" }, {}]
       @checker.options['hit']['questions'][0]['selections'] = [{ 'key' => "hi", 'text' => "hi" }, {}]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "requires that 'poll_options' be present and populated when 'combination_mode' is set to 'poll'" do
     it "requires that 'poll_options' be present and populated when 'combination_mode' is set to 'poll'" do
       @checker.options['combination_mode'] = "poll"
       @checker.options['combination_mode'] = "poll"
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['poll_options'] = {}
       @checker.options['poll_options'] = {}
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
                                            'instructions' => "Rank these by how funny they are",
                                            'instructions' => "Rank these by how funny they are",
                                            'assignments' => 3,
                                            'assignments' => 3,
                                            'row_template' => "{{joke}}" }
                                            'row_template' => "{{joke}}" }
-      @checker.should be_valid
+      expect(@checker).to be_valid
       @checker.options['poll_options'] = { 'instructions' => "Rank these by how funny they are",
       @checker.options['poll_options'] = { 'instructions' => "Rank these by how funny they are",
                                            'assignments' => 3,
                                            'assignments' => 3,
                                            'row_template' => "{{joke}}" }
                                            'row_template' => "{{joke}}" }
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
                                            'assignments' => 3,
                                            'assignments' => 3,
                                            'row_template' => "{{joke}}" }
                                            'row_template' => "{{joke}}" }
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
                                            'instructions' => "Rank these by how funny they are",
                                            'instructions' => "Rank these by how funny they are",
                                            'row_template' => "{{joke}}" }
                                            'row_template' => "{{joke}}" }
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
       @checker.options['poll_options'] = { 'title' => "Take a poll about jokes",
                                            'instructions' => "Rank these by how funny they are",
                                            'instructions' => "Rank these by how funny they are",
                                            'assignments' => 3}
                                            'assignments' => 3}
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "requires that all questions be of type 'selection' when 'combination_mode' is 'take_majority'" do
     it "requires that all questions be of type 'selection' when 'combination_mode' is 'take_majority'" do
       @checker.options['combination_mode'] = "take_majority"
       @checker.options['combination_mode'] = "take_majority"
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'][1]['type'] = "selection"
       @checker.options['hit']['questions'][1]['type'] = "selection"
       @checker.options['hit']['questions'][1]['selections'] = @checker.options['hit']['questions'][0]['selections']
       @checker.options['hit']['questions'][1]['selections'] = @checker.options['hit']['questions'][0]['selections']
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "accepts 'take_majority': 'true' for legacy support" do
     it "accepts 'take_majority': 'true' for legacy support" do
       @checker.options['take_majority'] = "true"
       @checker.options['take_majority'] = "true"
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['hit']['questions'][1]['type'] = "selection"
       @checker.options['hit']['questions'][1]['type'] = "selection"
       @checker.options['hit']['questions'][1]['selections'] = @checker.options['hit']['questions'][0]['selections']
       @checker.options['hit']['questions'][1]['selections'] = @checker.options['hit']['questions'][0]['selections']
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
   end
   end
 
 
@@ -219,16 +219,16 @@ describe Agents::HumanTaskAgent do
 
 
       @checker.send :create_basic_hit, @event
       @checker.send :create_basic_hit, @event
 
 
-      hitInterface.max_assignments.should == @checker.options['hit']['assignments']
-      hitInterface.reward.should == @checker.options['hit']['reward']
-      hitInterface.description.should == "Make something for Joe"
+      expect(hitInterface.max_assignments).to eq(@checker.options['hit']['assignments'])
+      expect(hitInterface.reward).to eq(@checker.options['hit']['reward'])
+      expect(hitInterface.description).to eq("Make something for Joe")
 
 
       xml = question_form.to_xml
       xml = question_form.to_xml
-      xml.should include("<Title>Hi Joe</Title>")
-      xml.should include("<Text>Make something for Joe</Text>")
-      xml.should include("<DisplayName>Joe Question 1</DisplayName>")
+      expect(xml).to include("<Title>Hi Joe</Title>")
+      expect(xml).to include("<Text>Make something for Joe</Text>")
+      expect(xml).to include("<DisplayName>Joe Question 1</DisplayName>")
 
 
-      @checker.memory['hits'][123]['event_id'].should == @event.id
+      expect(@checker.memory['hits'][123]['event_id']).to eq(@event.id)
     end
     end
 
 
     it "works without an event too" do
     it "works without an event too" do
@@ -238,8 +238,8 @@ describe Agents::HumanTaskAgent do
       mock(hitInterface).question_form(instance_of Agents::HumanTaskAgent::AgentQuestionForm)
       mock(hitInterface).question_form(instance_of Agents::HumanTaskAgent::AgentQuestionForm)
       mock(RTurk::Hit).create(:title => "Hi").yields(hitInterface) { hitInterface }
       mock(RTurk::Hit).create(:title => "Hi").yields(hitInterface) { hitInterface }
       @checker.send :create_basic_hit
       @checker.send :create_basic_hit
-      hitInterface.max_assignments.should == @checker.options['hit']['assignments']
-      hitInterface.reward.should == @checker.options['hit']['reward']
+      expect(hitInterface.max_assignments).to eq(@checker.options['hit']['assignments'])
+      expect(hitInterface.reward).to eq(@checker.options['hit']['reward'])
     end
     end
   end
   end
 
 
@@ -323,8 +323,8 @@ describe Agents::HumanTaskAgent do
 
 
       @checker.send :review_hits
       @checker.send :review_hits
 
 
-      assignments.all? {|a| a.approved == true }.should be_falsey
-      @checker.memory['hits'].should == { "JH3132836336DHG" => { 'event_id' => @event.id } }
+      expect(assignments.all? {|a| a.approved == true }).to be_falsey
+      expect(@checker.memory['hits']).to eq({ "JH3132836336DHG" => { 'event_id' => @event.id } })
     end
     end
 
 
     it "shouldn't do anything if an assignment is missing" do
     it "shouldn't do anything if an assignment is missing" do
@@ -341,8 +341,8 @@ describe Agents::HumanTaskAgent do
 
 
       @checker.send :review_hits
       @checker.send :review_hits
 
 
-      assignments.all? {|a| a.approved == true }.should be_falsey
-      @checker.memory['hits'].should == { "JH3132836336DHG" => { 'event_id' => @event.id } }
+      expect(assignments.all? {|a| a.approved == true }).to be_falsey
+      expect(@checker.memory['hits']).to eq({ "JH3132836336DHG" => { 'event_id' => @event.id } })
     end
     end
 
 
     context "emitting events" do
     context "emitting events" do
@@ -354,43 +354,43 @@ describe Agents::HumanTaskAgent do
           FakeAssignment.new(:status => "Submitted", :answers => {"sentiment"=>"happy", "feedback"=>"Take 2"})
           FakeAssignment.new(:status => "Submitted", :answers => {"sentiment"=>"happy", "feedback"=>"Take 2"})
         ]
         ]
         @hit = FakeHit.new(:max_assignments => 2, :assignments => @assignments)
         @hit = FakeHit.new(:max_assignments => 2, :assignments => @assignments)
-        @hit.should_not be_disposed
+        expect(@hit).not_to be_disposed
         mock(RTurk::Hit).new("JH3132836336DHG") { @hit }
         mock(RTurk::Hit).new("JH3132836336DHG") { @hit }
       end
       end
 
 
       it "should create events when all assignments are ready" do
       it "should create events when all assignments are ready" do
-        lambda {
+        expect {
           @checker.send :review_hits
           @checker.send :review_hits
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
 
 
-        @assignments.all? {|a| a.approved == true }.should be_truthy
-        @hit.should be_disposed
+        expect(@assignments.all? {|a| a.approved == true }).to be_truthy
+        expect(@hit).to be_disposed
 
 
-        @checker.events.last.payload['answers'].should == [
+        expect(@checker.events.last.payload['answers']).to eq([
           {'sentiment' => "neutral", 'feedback' => ""},
           {'sentiment' => "neutral", 'feedback' => ""},
           {'sentiment' => "happy", 'feedback' => "Take 2"}
           {'sentiment' => "happy", 'feedback' => "Take 2"}
-        ]
+        ])
 
 
-        @checker.memory['hits'].should == {}
+        expect(@checker.memory['hits']).to eq({})
       end
       end
 
 
       it "should emit separate answers when options[:separate_answers] is true" do
       it "should emit separate answers when options[:separate_answers] is true" do
         @checker.options[:separate_answers] = true
         @checker.options[:separate_answers] = true
 
 
-        lambda {
+        expect {
           @checker.send :review_hits
           @checker.send :review_hits
-        }.should change { Event.count }.by(2)
+        }.to change { Event.count }.by(2)
 
 
-        @assignments.all? {|a| a.approved == true }.should be_truthy
-        @hit.should be_disposed
+        expect(@assignments.all? {|a| a.approved == true }).to be_truthy
+        expect(@hit).to be_disposed
 
 
         event1, event2 = @checker.events.last(2)
         event1, event2 = @checker.events.last(2)
-        event1.payload.should_not have_key('answers')
-        event2.payload.should_not have_key('answers')
-        event1.payload['answer'].should == { 'sentiment' => "happy", 'feedback' => "Take 2" }
-        event2.payload['answer'].should == { 'sentiment' => "neutral", 'feedback' => "" }
+        expect(event1.payload).not_to have_key('answers')
+        expect(event2.payload).not_to have_key('answers')
+        expect(event1.payload['answer']).to eq({ 'sentiment' => "happy", 'feedback' => "Take 2" })
+        expect(event2.payload['answer']).to eq({ 'sentiment' => "neutral", 'feedback' => "" })
 
 
-        @checker.memory['hits'].should == {}
+        expect(@checker.memory['hits']).to eq({})
       end
       end
     end
     end
 
 
@@ -424,24 +424,24 @@ describe Agents::HumanTaskAgent do
         hit = FakeHit.new(:max_assignments => 4, :assignments => assignments)
         hit = FakeHit.new(:max_assignments => 4, :assignments => assignments)
         mock(RTurk::Hit).new("JH3132836336DHG") { hit }
         mock(RTurk::Hit).new("JH3132836336DHG") { hit }
 
 
-        lambda {
+        expect {
           @checker.send :review_hits
           @checker.send :review_hits
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
 
 
-        assignments.all? {|a| a.approved == true }.should be_truthy
+        expect(assignments.all? {|a| a.approved == true }).to be_truthy
 
 
-        @checker.events.last.payload['answers'].should == [
+        expect(@checker.events.last.payload['answers']).to eq([
           { 'sentiment' => "sad", 'age_range' => "<50" },
           { 'sentiment' => "sad", 'age_range' => "<50" },
           { 'sentiment' => "neutral", 'age_range' => ">50" },
           { 'sentiment' => "neutral", 'age_range' => ">50" },
           { 'sentiment' => "happy", 'age_range' => ">50" },
           { 'sentiment' => "happy", 'age_range' => ">50" },
           { 'sentiment' => "happy", 'age_range' => ">50" }
           { 'sentiment' => "happy", 'age_range' => ">50" }
-        ]
+        ])
 
 
-        @checker.events.last.payload['counts'].should == { 'sentiment' => { 'happy' => 2, 'sad' => 1, 'neutral' => 1 }, 'age_range' => { ">50" => 3, "<50" => 1 } }
-        @checker.events.last.payload['majority_answer'].should == { 'sentiment' => "happy", 'age_range' => ">50" }
-        @checker.events.last.payload.should_not have_key('average_answer')
+        expect(@checker.events.last.payload['counts']).to eq({ 'sentiment' => { 'happy' => 2, 'sad' => 1, 'neutral' => 1 }, 'age_range' => { ">50" => 3, "<50" => 1 } })
+        expect(@checker.events.last.payload['majority_answer']).to eq({ 'sentiment' => "happy", 'age_range' => ">50" })
+        expect(@checker.events.last.payload).not_to have_key('average_answer')
 
 
-        @checker.memory['hits'].should == {}
+        expect(@checker.memory['hits']).to eq({})
       end
       end
 
 
       it "should also provide an average answer when all questions are numeric" do
       it "should also provide an average answer when all questions are numeric" do
@@ -477,25 +477,25 @@ describe Agents::HumanTaskAgent do
         hit = FakeHit.new(:max_assignments => 5, :assignments => assignments)
         hit = FakeHit.new(:max_assignments => 5, :assignments => assignments)
         mock(RTurk::Hit).new("JH3132836336DHG") { hit }
         mock(RTurk::Hit).new("JH3132836336DHG") { hit }
 
 
-        lambda {
+        expect {
           @checker.send :review_hits
           @checker.send :review_hits
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
 
 
-        assignments.all? {|a| a.approved == true }.should be_truthy
+        expect(assignments.all? {|a| a.approved == true }).to be_truthy
 
 
-        @checker.events.last.payload['answers'].should == [
+        expect(@checker.events.last.payload['answers']).to eq([
           { 'rating' => "1" },
           { 'rating' => "1" },
           { 'rating' => "3" },
           { 'rating' => "3" },
           { 'rating' => "5.1" },
           { 'rating' => "5.1" },
           { 'rating' => "2" },
           { 'rating' => "2" },
           { 'rating' => "2" }
           { 'rating' => "2" }
-        ]
+        ])
 
 
-        @checker.events.last.payload['counts'].should == { 'rating' => { "1" => 1, "2" => 2, "3" => 1, "4" => 0, "5.1" => 1 } }
-        @checker.events.last.payload['majority_answer'].should == { 'rating' => "2" }
-        @checker.events.last.payload['average_answer'].should == { 'rating' => (1 + 2 + 2 + 3 + 5.1) / 5.0 }
+        expect(@checker.events.last.payload['counts']).to eq({ 'rating' => { "1" => 1, "2" => 2, "3" => 1, "4" => 0, "5.1" => 1 } })
+        expect(@checker.events.last.payload['majority_answer']).to eq({ 'rating' => "2" })
+        expect(@checker.events.last.payload['average_answer']).to eq({ 'rating' => (1 + 2 + 2 + 3 + 5.1) / 5.0 })
 
 
-        @checker.memory['hits'].should == {}
+        expect(@checker.memory['hits']).to eq({})
       end
       end
     end
     end
 
 
@@ -525,7 +525,7 @@ describe Agents::HumanTaskAgent do
         hit = FakeHit.new(:max_assignments => 4, :assignments => assignments)
         hit = FakeHit.new(:max_assignments => 4, :assignments => assignments)
         mock(RTurk::Hit).new("JH3132836336DHG") { hit }
         mock(RTurk::Hit).new("JH3132836336DHG") { hit }
 
 
-        @checker.memory['hits']["JH3132836336DHG"].should be_present
+        expect(@checker.memory['hits']["JH3132836336DHG"]).to be_present
 
 
         # Setup mocks for HIT creation
         # Setup mocks for HIT creation
 
 
@@ -537,33 +537,33 @@ describe Agents::HumanTaskAgent do
 
 
         # And finally, the test.
         # And finally, the test.
 
 
-        lambda {
+        expect {
           @checker.send :review_hits
           @checker.send :review_hits
-        }.should change { Event.count }.by(0) # it does not emit an event until all poll results are in
+        }.to change { Event.count }.by(0) # it does not emit an event until all poll results are in
 
 
         # it approves the existing assignments
         # it approves the existing assignments
 
 
-        assignments.all? {|a| a.approved == true }.should be_truthy
-        hit.should be_disposed
+        expect(assignments.all? {|a| a.approved == true }).to be_truthy
+        expect(hit).to be_disposed
 
 
         # it creates a new HIT for the poll
         # it creates a new HIT for the poll
 
 
-        hitInterface.max_assignments.should == @checker.options['poll_options']['assignments']
-        hitInterface.description.should == @checker.options['poll_options']['instructions']
+        expect(hitInterface.max_assignments).to eq(@checker.options['poll_options']['assignments'])
+        expect(hitInterface.description).to eq(@checker.options['poll_options']['instructions'])
 
 
         xml = question_form.to_xml
         xml = question_form.to_xml
-        xml.should include("<Text>This is happy</Text>")
-        xml.should include("<Text>This is neutral</Text>")
-        xml.should include("<Text>This is sad</Text>")
+        expect(xml).to include("<Text>This is happy</Text>")
+        expect(xml).to include("<Text>This is neutral</Text>")
+        expect(xml).to include("<Text>This is sad</Text>")
 
 
         @checker.save
         @checker.save
         @checker.reload
         @checker.reload
-        @checker.memory['hits']["JH3132836336DHG"].should_not be_present
-        @checker.memory['hits']["JH39AA63836DH12345"].should be_present
-        @checker.memory['hits']["JH39AA63836DH12345"]['event_id'].should == @event.id
-        @checker.memory['hits']["JH39AA63836DH12345"]['type'].should == "poll"
-        @checker.memory['hits']["JH39AA63836DH12345"]['original_hit'].should == "JH3132836336DHG"
-        @checker.memory['hits']["JH39AA63836DH12345"]['answers'].length.should == 4
+        expect(@checker.memory['hits']["JH3132836336DHG"]).not_to be_present
+        expect(@checker.memory['hits']["JH39AA63836DH12345"]).to be_present
+        expect(@checker.memory['hits']["JH39AA63836DH12345"]['event_id']).to eq(@event.id)
+        expect(@checker.memory['hits']["JH39AA63836DH12345"]['type']).to eq("poll")
+        expect(@checker.memory['hits']["JH39AA63836DH12345"]['original_hit']).to eq("JH3132836336DHG")
+        expect(@checker.memory['hits']["JH39AA63836DH12345"]['answers'].length).to eq(4)
       end
       end
 
 
       it "emits an event when all poll results are in, containing the data from the best answer, plus all others" do
       it "emits an event when all poll results are in, containing the data from the best answer, plus all others" do
@@ -591,24 +591,24 @@ describe Agents::HumanTaskAgent do
         hit = FakeHit.new(:max_assignments => 2, :assignments => assignments)
         hit = FakeHit.new(:max_assignments => 2, :assignments => assignments)
         mock(RTurk::Hit).new("JH39AA63836DH12345") { hit }
         mock(RTurk::Hit).new("JH39AA63836DH12345") { hit }
 
 
-        @checker.memory['hits']["JH39AA63836DH12345"].should be_present
+        expect(@checker.memory['hits']["JH39AA63836DH12345"]).to be_present
 
 
-        lambda {
+        expect {
           @checker.send :review_hits
           @checker.send :review_hits
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
 
 
         # It emits an event
         # It emits an event
 
 
-        @checker.events.last.payload['answers'].should == original_answers
-        @checker.events.last.payload['poll'].should == [{"1" => "2", "2" => "5", "3" => "3", "4" => "2"}, {"1" => "3", "2" => "4", "3" => "1", "4" => "4"}]
-        @checker.events.last.payload['best_answer'].should == {'sentiment' => "neutral", 'feedback' => "This is my feedback 2"}
+        expect(@checker.events.last.payload['answers']).to eq(original_answers)
+        expect(@checker.events.last.payload['poll']).to eq([{"1" => "2", "2" => "5", "3" => "3", "4" => "2"}, {"1" => "3", "2" => "4", "3" => "1", "4" => "4"}])
+        expect(@checker.events.last.payload['best_answer']).to eq({'sentiment' => "neutral", 'feedback' => "This is my feedback 2"})
 
 
         # it approves the existing assignments
         # it approves the existing assignments
 
 
-        assignments.all? {|a| a.approved == true }.should be_truthy
-        hit.should be_disposed
+        expect(assignments.all? {|a| a.approved == true }).to be_truthy
+        expect(hit).to be_disposed
 
 
-        @checker.memory['hits'].should be_empty
+        expect(@checker.memory['hits']).to be_empty
       end
       end
     end
     end
   end
   end

+ 43 - 43
spec/models/agents/imap_folder_agent_spec.rb

@@ -94,42 +94,42 @@ describe Agents::ImapFolderAgent do
 
 
     describe 'validations' do
     describe 'validations' do
       before do
       before do
-        @checker.should be_valid
+        expect(@checker).to be_valid
       end
       end
 
 
       it 'should validate the integer fields' do
       it 'should validate the integer fields' do
         @checker.options['expected_update_period_in_days'] = 'nonsense'
         @checker.options['expected_update_period_in_days'] = 'nonsense'
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['expected_update_period_in_days'] = '2'
         @checker.options['expected_update_period_in_days'] = '2'
-        @checker.should be_valid
+        expect(@checker).to be_valid
 
 
         @checker.options['port'] = -1
         @checker.options['port'] = -1
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['port'] = 'imap'
         @checker.options['port'] = 'imap'
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['port'] = '143'
         @checker.options['port'] = '143'
-        @checker.should be_valid
+        expect(@checker).to be_valid
 
 
         @checker.options['port'] = 993
         @checker.options['port'] = 993
-        @checker.should be_valid
+        expect(@checker).to be_valid
       end
       end
 
 
       it 'should validate the boolean fields' do
       it 'should validate the boolean fields' do
         %w[ssl mark_as_read].each do |key|
         %w[ssl mark_as_read].each do |key|
           @checker.options[key] = 1
           @checker.options[key] = 1
-          @checker.should_not be_valid
+          expect(@checker).not_to be_valid
 
 
           @checker.options[key] = false
           @checker.options[key] = false
-          @checker.should be_valid
+          expect(@checker).to be_valid
 
 
           @checker.options[key] = 'true'
           @checker.options[key] = 'true'
-          @checker.should be_valid
+          expect(@checker).to be_valid
 
 
           @checker.options[key] = ''
           @checker.options[key] = ''
-          @checker.should be_valid
+          expect(@checker).to be_valid
         end
         end
       end
       end
 
 
@@ -137,46 +137,46 @@ describe Agents::ImapFolderAgent do
         @checker.options['conditions'] = {
         @checker.options['conditions'] = {
           'subject' => '(foo'
           'subject' => '(foo'
         }
         }
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['conditions'] = {
         @checker.options['conditions'] = {
           'body' => '***'
           'body' => '***'
         }
         }
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['conditions'] = {
         @checker.options['conditions'] = {
           'subject' => '\ARe:',
           'subject' => '\ARe:',
           'body' => '(?<foo>http://\S+)'
           'body' => '(?<foo>http://\S+)'
         }
         }
-        @checker.should be_valid
+        expect(@checker).to be_valid
       end
       end
     end
     end
 
 
     describe '#check' do
     describe '#check' do
       it 'should check for mails and save memory' do
       it 'should check for mails and save memory' do
-        lambda { @checker.check }.should change { Event.count }.by(2)
-        @checker.notified.sort.should == @mails.map(&:message_id).sort
-        @checker.lastseen.should == @mails.each_with_object(@checker.make_seen) { |mail, seen|
+        expect { @checker.check }.to change { Event.count }.by(2)
+        expect(@checker.notified.sort).to eq(@mails.map(&:message_id).sort)
+        expect(@checker.lastseen).to eq(@mails.each_with_object(@checker.make_seen) { |mail, seen|
           seen[mail.uidvalidity] = mail.uid
           seen[mail.uidvalidity] = mail.uid
-        }
+        })
 
 
         Event.last(2).map(&:payload) == @payloads
         Event.last(2).map(&:payload) == @payloads
 
 
-        lambda { @checker.check }.should_not change { Event.count }
+        expect { @checker.check }.not_to change { Event.count }
       end
       end
 
 
       it 'should narrow mails by To' do
       it 'should narrow mails by To' do
         @checker.options['conditions']['to'] = 'John.Doe@*'
         @checker.options['conditions']['to'] = 'John.Doe@*'
 
 
-        lambda { @checker.check }.should change { Event.count }.by(1)
-        @checker.notified.sort.should == [@mails.first.message_id]
-        @checker.lastseen.should == @mails.each_with_object(@checker.make_seen) { |mail, seen|
+        expect { @checker.check }.to change { Event.count }.by(1)
+        expect(@checker.notified.sort).to eq([@mails.first.message_id])
+        expect(@checker.lastseen).to eq(@mails.each_with_object(@checker.make_seen) { |mail, seen|
           seen[mail.uidvalidity] = mail.uid
           seen[mail.uidvalidity] = mail.uid
-        }
+        })
 
 
-        Event.last.payload.should == @payloads.first
+        expect(Event.last.payload).to eq(@payloads.first)
 
 
-        lambda { @checker.check }.should_not change { Event.count }
+        expect { @checker.check }.not_to change { Event.count }
       end
       end
 
 
       it 'should perform regexp matching and save named captures' do
       it 'should perform regexp matching and save named captures' do
@@ -185,35 +185,35 @@ describe Agents::ImapFolderAgent do
           'body'    => 'Some (?<b>.+) reply',
           'body'    => 'Some (?<b>.+) reply',
         )
         )
 
 
-        lambda { @checker.check }.should change { Event.count }.by(1)
-        @checker.notified.sort.should == [@mails.last.message_id]
-        @checker.lastseen.should == @mails.each_with_object(@checker.make_seen) { |mail, seen|
+        expect { @checker.check }.to change { Event.count }.by(1)
+        expect(@checker.notified.sort).to eq([@mails.last.message_id])
+        expect(@checker.lastseen).to eq(@mails.each_with_object(@checker.make_seen) { |mail, seen|
           seen[mail.uidvalidity] = mail.uid
           seen[mail.uidvalidity] = mail.uid
-        }
+        })
 
 
-        Event.last.payload.should == @payloads.last.update(
+        expect(Event.last.payload).to eq(@payloads.last.update(
           'body' => "<div dir=\"ltr\">Some HTML reply<br></div>\n",
           'body' => "<div dir=\"ltr\">Some HTML reply<br></div>\n",
           'matches' => { 'a' => 'some subject', 'b' => 'HTML' },
           'matches' => { 'a' => 'some subject', 'b' => 'HTML' },
           'mime_type' => 'text/html',
           'mime_type' => 'text/html',
-        )
+        ))
 
 
-        lambda { @checker.check }.should_not change { Event.count }
+        expect { @checker.check }.not_to change { Event.count }
       end
       end
 
 
       it 'should narrow mails by has_attachment (true)' do
       it 'should narrow mails by has_attachment (true)' do
         @checker.options['conditions']['has_attachment'] = true
         @checker.options['conditions']['has_attachment'] = true
 
 
-        lambda { @checker.check }.should change { Event.count }.by(1)
+        expect { @checker.check }.to change { Event.count }.by(1)
 
 
-        Event.last.payload['subject'].should == 'Re: some subject'
+        expect(Event.last.payload['subject']).to eq('Re: some subject')
       end
       end
 
 
       it 'should narrow mails by has_attachment (false)' do
       it 'should narrow mails by has_attachment (false)' do
         @checker.options['conditions']['has_attachment'] = false
         @checker.options['conditions']['has_attachment'] = false
 
 
-        lambda { @checker.check }.should change { Event.count }.by(1)
+        expect { @checker.check }.to change { Event.count }.by(1)
 
 
-        Event.last.payload['subject'].should == 'some subject'
+        expect(Event.last.payload['subject']).to eq('some subject')
       end
       end
 
 
       it 'should narrow mail parts by MIME types' do
       it 'should narrow mail parts by MIME types' do
@@ -223,18 +223,18 @@ describe Agents::ImapFolderAgent do
           'body'    => 'Some (?<b>.+) reply',
           'body'    => 'Some (?<b>.+) reply',
         )
         )
 
 
-        lambda { @checker.check }.should_not change { Event.count }
-        @checker.notified.sort.should == []
-        @checker.lastseen.should == @mails.each_with_object(@checker.make_seen) { |mail, seen|
+        expect { @checker.check }.not_to change { Event.count }
+        expect(@checker.notified.sort).to eq([])
+        expect(@checker.lastseen).to eq(@mails.each_with_object(@checker.make_seen) { |mail, seen|
           seen[mail.uidvalidity] = mail.uid
           seen[mail.uidvalidity] = mail.uid
-        }
+        })
       end
       end
 
 
       it 'should never mark mails as read unless mark_as_read is true' do
       it 'should never mark mails as read unless mark_as_read is true' do
         @mails.each { |mail|
         @mails.each { |mail|
           stub(mail).mark_as_read.never
           stub(mail).mark_as_read.never
         }
         }
-        lambda { @checker.check }.should change { Event.count }.by(2)
+        expect { @checker.check }.to change { Event.count }.by(2)
       end
       end
 
 
       it 'should mark mails as read if mark_as_read is true' do
       it 'should mark mails as read if mark_as_read is true' do
@@ -242,7 +242,7 @@ describe Agents::ImapFolderAgent do
         @mails.each { |mail|
         @mails.each { |mail|
           stub(mail).mark_as_read.once
           stub(mail).mark_as_read.once
         }
         }
-        lambda { @checker.check }.should change { Event.count }.by(2)
+        expect { @checker.check }.to change { Event.count }.by(2)
       end
       end
 
 
       it 'should create just one event for multiple mails with the same Message-Id' do
       it 'should create just one event for multiple mails with the same Message-Id' do
@@ -251,7 +251,7 @@ describe Agents::ImapFolderAgent do
         @mails.each { |mail|
         @mails.each { |mail|
           stub(mail).mark_as_read.once
           stub(mail).mark_as_read.once
         }
         }
-        lambda { @checker.check }.should change { Event.count }.by(1)
+        expect { @checker.check }.to change { Event.count }.by(1)
       end
       end
     end
     end
   end
   end

+ 9 - 9
spec/models/agents/jabber_agent_spec.rb

@@ -35,33 +35,33 @@ describe Agents::JabberAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "checks if events have been received within the expected receive period" do
     it "checks if events have been received within the expected receive period" do
-      agent.should_not be_working # No events received
+      expect(agent).not_to be_working # No events received
       Agents::JabberAgent.async_receive agent.id, [event.id]
       Agents::JabberAgent.async_receive agent.id, [event.id]
-      agent.reload.should be_working # Just received events
+      expect(agent.reload).to be_working # Just received events
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      agent.reload.should_not be_working # More time has passed than the expected receive period without any new events
+      expect(agent.reload).not_to be_working # More time has passed than the expected receive period without any new events
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      agent.should be_valid
+      expect(agent).to be_valid
     end
     end
 
 
     it "should validate presence of of jabber_server" do
     it "should validate presence of of jabber_server" do
       agent.options[:jabber_server] = ""
       agent.options[:jabber_server] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
 
 
     it "should validate presence of jabber_sender" do
     it "should validate presence of jabber_sender" do
       agent.options[:jabber_sender] = ""
       agent.options[:jabber_sender] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
 
 
     it "should validate presence of jabber_receiver" do
     it "should validate presence of jabber_receiver" do
       agent.options[:jabber_receiver] = ""
       agent.options[:jabber_receiver] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
   end
   end
 
 
@@ -74,8 +74,8 @@ describe Agents::JabberAgent do
       end
       end
 
 
       agent.receive([event, event2])
       agent.receive([event, event2])
-      sent.should == [ 'Warning! Weather Alert! - http://www.weather.com/',
-                       'Warning! Another Weather Alert! - http://www.weather.com/we-are-screwed']
+      expect(sent).to eq([ 'Warning! Weather Alert! - http://www.weather.com/',
+                       'Warning! Another Weather Alert! - http://www.weather.com/we-are-screwed'])
     end
     end
   end
   end
 end
 end

+ 59 - 59
spec/models/agents/java_script_agent_spec.rb

@@ -16,19 +16,19 @@ describe Agents::JavaScriptAgent do
 
 
   describe "validations" do
   describe "validations" do
     it "requires 'code'" do
     it "requires 'code'" do
-      @agent.should be_valid
+      expect(@agent).to be_valid
       @agent.options['code'] = ''
       @agent.options['code'] = ''
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
       @agent.options.delete('code')
       @agent.options.delete('code')
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
 
 
     it "accepts a credential, but it must exist" do
     it "accepts a credential, but it must exist" do
-      @agent.should be_valid
+      expect(@agent).to be_valid
       @agent.options['code'] = 'credential:foo'
       @agent.options['code'] = 'credential:foo'
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
       users(:jane).user_credentials.create! :credential_name => "foo", :credential_value => "bar"
       users(:jane).user_credentials.create! :credential_name => "foo", :credential_value => "bar"
-      @agent.reload.should be_valid
+      expect(@agent.reload).to be_valid
     end
     end
   end
   end
 
 
@@ -37,12 +37,12 @@ describe Agents::JavaScriptAgent do
       it "returns false when more than expected_update_period_in_days have passed since the last event creation" do
       it "returns false when more than expected_update_period_in_days have passed since the last event creation" do
         @agent.options['expected_update_period_in_days'] = 1
         @agent.options['expected_update_period_in_days'] = 1
         @agent.save!
         @agent.save!
-        @agent.should_not be_working
+        expect(@agent).not_to be_working
         @agent.check
         @agent.check
-        @agent.reload.should be_working
+        expect(@agent.reload).to be_working
         three_days_from_now = 3.days.from_now
         three_days_from_now = 3.days.from_now
         stub(Time).now { three_days_from_now }
         stub(Time).now { three_days_from_now }
-        @agent.should_not be_working
+        expect(@agent).not_to be_working
       end
       end
     end
     end
 
 
@@ -50,12 +50,12 @@ describe Agents::JavaScriptAgent do
       it "returns false when more than expected_receive_period_in_days have passed since the last event was received" do
       it "returns false when more than expected_receive_period_in_days have passed since the last event was received" do
         @agent.options['expected_receive_period_in_days'] = 1
         @agent.options['expected_receive_period_in_days'] = 1
         @agent.save!
         @agent.save!
-        @agent.should_not be_working
+        expect(@agent).not_to be_working
         Agents::JavaScriptAgent.async_receive @agent.id, [events(:bob_website_agent_event).id]
         Agents::JavaScriptAgent.async_receive @agent.id, [events(:bob_website_agent_event).id]
-        @agent.reload.should be_working
+        expect(@agent.reload).to be_working
         two_days_from_now = 2.days.from_now
         two_days_from_now = 2.days.from_now
         stub(Time).now { two_days_from_now }
         stub(Time).now { two_days_from_now }
-        @agent.reload.should_not be_working
+        expect(@agent.reload).not_to be_working
       end
       end
     end
     end
   end
   end
@@ -66,12 +66,12 @@ describe Agents::JavaScriptAgent do
       @agent.options['make_event'] = true
       @agent.options['make_event'] = true
       @agent.save!
       @agent.save!
 
 
-      lambda {
-        lambda {
+      expect {
+        expect {
           @agent.receive([events(:bob_website_agent_event)])
           @agent.receive([events(:bob_website_agent_event)])
           @agent.check
           @agent.check
-        }.should_not change { AgentLog.count }
-      }.should change { Event.count }.by(2)
+        }.not_to change { AgentLog.count }
+      }.to change { Event.count }.by(2)
     end
     end
 
 
 
 
@@ -84,13 +84,13 @@ describe Agents::JavaScriptAgent do
 
 
       it "accepts credentials" do
       it "accepts credentials" do
         @agent.check
         @agent.check
-        AgentLog.last.message.should == "ran it"
+        expect(AgentLog.last.message).to eq("ran it")
       end
       end
 
 
       it "logs an error when the credential goes away" do
       it "logs an error when the credential goes away" do
         @agent.user.user_credentials.delete_all
         @agent.user.user_credentials.delete_all
         @agent.reload.check
         @agent.reload.check
-        AgentLog.last.message.should == "Unable to find credential"
+        expect(AgentLog.last.message).to eq("Unable to find credential")
       end
       end
     end
     end
 
 
@@ -98,34 +98,34 @@ describe Agents::JavaScriptAgent do
       it "should log an error when V8 has issues" do
       it "should log an error when V8 has issues" do
         @agent.options['code'] = 'syntax error!'
         @agent.options['code'] = 'syntax error!'
         @agent.save!
         @agent.save!
-        lambda {
-          lambda {
+        expect {
+          expect {
             @agent.check
             @agent.check
-          }.should_not raise_error
-        }.should change { AgentLog.count }.by(1)
-        AgentLog.last.message.should =~ /Unexpected identifier/
-        AgentLog.last.level.should == 4
+          }.not_to raise_error
+        }.to change { AgentLog.count }.by(1)
+        expect(AgentLog.last.message).to match(/Unexpected identifier/)
+        expect(AgentLog.last.level).to eq(4)
       end
       end
 
 
       it "should log an error when JavaScript throws" do
       it "should log an error when JavaScript throws" do
         @agent.options['code'] = 'Agent.check = function() { throw "oh no"; };'
         @agent.options['code'] = 'Agent.check = function() { throw "oh no"; };'
         @agent.save!
         @agent.save!
-        lambda {
-          lambda {
+        expect {
+          expect {
             @agent.check
             @agent.check
-          }.should_not raise_error
-        }.should change { AgentLog.count }.by(1)
-        AgentLog.last.message.should =~ /oh no/
-        AgentLog.last.level.should == 4
+          }.not_to raise_error
+        }.to change { AgentLog.count }.by(1)
+        expect(AgentLog.last.message).to match(/oh no/)
+        expect(AgentLog.last.level).to eq(4)
       end
       end
 
 
       it "won't store NaNs" do
       it "won't store NaNs" do
         @agent.options['code'] = 'Agent.check = function() { this.memory("foo", NaN); };'
         @agent.options['code'] = 'Agent.check = function() { this.memory("foo", NaN); };'
         @agent.save!
         @agent.save!
         @agent.check
         @agent.check
-        @agent.memory['foo'].should == 'NaN' # string
+        expect(@agent.memory['foo']).to eq('NaN') # string
         @agent.save!
         @agent.save!
-        lambda { @agent.reload.memory }.should_not raise_error
+        expect { @agent.reload.memory }.not_to raise_error
       end
       end
     end
     end
 
 
@@ -133,13 +133,13 @@ describe Agents::JavaScriptAgent do
       it "creates events with this.createEvent in the JavaScript environment" do
       it "creates events with this.createEvent in the JavaScript environment" do
         @agent.options['code'] = 'Agent.check = function() { this.createEvent({ message: "This is an event!", stuff: { foo: 5 } }); };'
         @agent.options['code'] = 'Agent.check = function() { this.createEvent({ message: "This is an event!", stuff: { foo: 5 } }); };'
         @agent.save!
         @agent.save!
-        lambda {
-          lambda {
+        expect {
+          expect {
             @agent.check
             @agent.check
-          }.should_not change { AgentLog.count }
-        }.should change { Event.count }.by(1)
+          }.not_to change { AgentLog.count }
+        }.to change { Event.count }.by(1)
         created_event = @agent.events.last
         created_event = @agent.events.last
-        created_event.payload.should == { 'message' => "This is an event!", 'stuff' => { 'foo' => 5 } }
+        expect(created_event.payload).to eq({ 'message' => "This is an event!", 'stuff' => { 'foo' => 5 } })
       end
       end
     end
     end
 
 
@@ -147,18 +147,18 @@ describe Agents::JavaScriptAgent do
       it "can output AgentLogs with this.log and this.error in the JavaScript environment" do
       it "can output AgentLogs with this.log and this.error in the JavaScript environment" do
         @agent.options['code'] = 'Agent.check = function() { this.log("woah"); this.error("WOAH!"); };'
         @agent.options['code'] = 'Agent.check = function() { this.log("woah"); this.error("WOAH!"); };'
         @agent.save!
         @agent.save!
-        lambda {
-          lambda {
+        expect {
+          expect {
             @agent.check
             @agent.check
-          }.should_not raise_error
-        }.should change { AgentLog.count }.by(2)
+          }.not_to raise_error
+        }.to change { AgentLog.count }.by(2)
 
 
         log1, log2 = AgentLog.last(2)
         log1, log2 = AgentLog.last(2)
 
 
-        log1.message.should == "woah"
-        log1.level.should == 3
-        log2.message.should == "WOAH!"
-        log2.level.should == 4
+        expect(log1.message).to eq("woah")
+        expect(log1.level).to eq(3)
+        expect(log2.message).to eq("WOAH!")
+        expect(log2.level).to eq(4)
       end
       end
     end
     end
 
 
@@ -180,13 +180,13 @@ describe Agents::JavaScriptAgent do
         JS
         JS
 
 
         @agent.save!
         @agent.save!
-        lambda {
-          lambda {
+        expect {
+          expect {
             @agent.receive([events(:bob_website_agent_event), event])
             @agent.receive([events(:bob_website_agent_event), event])
-          }.should_not change { AgentLog.count }
-        }.should change { Event.count }.by(2)
+          }.not_to change { AgentLog.count }
+        }.to change { Event.count }.by(2)
         created_event = @agent.events.first
         created_event = @agent.events.first
-        created_event.payload.should == { 'message' => "I got an event!", 'event_was' => { 'data' => "Something you should know about" } }
+        expect(created_event.payload).to eq({ 'message' => "I got an event!", 'event_was' => { 'data' => "Something you should know about" } })
       end
       end
     end
     end
 
 
@@ -203,26 +203,26 @@ describe Agents::JavaScriptAgent do
 
 
         @agent.save!
         @agent.save!
 
 
-        lambda {
-          lambda {
+        expect {
+          expect {
 
 
             @agent.check
             @agent.check
-            @agent.memory['callCount'].should_not be_present
+            expect(@agent.memory['callCount']).not_to be_present
 
 
             @agent.options['make_event'] = true
             @agent.options['make_event'] = true
             @agent.check
             @agent.check
-            @agent.memory['callCount'].should == 1
+            expect(@agent.memory['callCount']).to eq(1)
 
 
             @agent.check
             @agent.check
-            @agent.memory['callCount'].should == 2
+            expect(@agent.memory['callCount']).to eq(2)
 
 
             @agent.memory['callCount'] = 20
             @agent.memory['callCount'] = 20
             @agent.check
             @agent.check
-            @agent.memory['callCount'].should == 21
+            expect(@agent.memory['callCount']).to eq(21)
 
 
-          }.should_not change { AgentLog.count }
-        }.should_not change { Event.count }
+          }.not_to change { AgentLog.count }
+        }.not_to change { Event.count }
       end
       end
     end
     end
   end
   end
-end
+end

+ 11 - 11
spec/models/agents/jira_agent_spec.rb

@@ -20,48 +20,48 @@ describe Agents::JiraAgent do
 
 
   describe "validating" do
   describe "validating" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should work without username" do
     it "should work without username" do
       @checker.options['username'] = nil
       @checker.options['username'] = nil
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should require the jira password if username is specified" do
     it "should require the jira password if username is specified" do
       @checker.options['username'] = 'user'
       @checker.options['username'] = 'user'
       @checker.options['password'] = nil
       @checker.options['password'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should require the jira url" do
     it "should require the jira url" do
       @checker.options['jira_url'] = nil
       @checker.options['jira_url'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should work without jql" do
     it "should work without jql" do
       @checker.options['jql'] = nil
       @checker.options['jql'] = nil
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should require the expected_update_period_in_days" do
     it "should require the expected_update_period_in_days" do
       @checker.options['expected_update_period_in_days'] = nil
       @checker.options['expected_update_period_in_days'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should require timeout" do
     it "should require timeout" do
       @checker.options['timeout'] = nil
       @checker.options['timeout'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
   end
   end
 
 
   describe "helpers" do
   describe "helpers" do
     it "should generate a correct request options hash" do
     it "should generate a correct request options hash" do
-      @checker.send(:request_options).should == {:basic_auth=>{:username=>"user", :password=>"pass"}, :headers => {"User-Agent" => "Huginn (https://github.com/cantino/huginn)"}}
+      expect(@checker.send(:request_options)).to eq({:basic_auth=>{:username=>"user", :password=>"pass"}, :headers => {"User-Agent" => "Huginn (https://github.com/cantino/huginn)"}})
     end
     end
 
 
     it "should generate a correct request url" do
     it "should generate a correct request url" do
-      @checker.send(:request_url, 'foo=bar', 10).should == "https://jira.atlassian.com/rest/api/2/search?jql=foo%3Dbar&fields=*all&startAt=10"
+      expect(@checker.send(:request_url, 'foo=bar', 10)).to eq("https://jira.atlassian.com/rest/api/2/search?jql=foo%3Dbar&fields=*all&startAt=10")
     end
     end
 
 
 
 
@@ -102,9 +102,9 @@ describe Agents::JiraAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "it is working when at least one event was emited" do
     it "it is working when at least one event was emited" do
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
       @checker.check
       @checker.check
-      @checker.reload.should be_working
+      expect(@checker.reload).to be_working
     end
     end
   end
   end
 end
 end

+ 3 - 3
spec/models/agents/mqtt_agent_spec.rb

@@ -41,12 +41,12 @@ describe Agents::MqttAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "checks if its generating events as scheduled" do
     it "checks if its generating events as scheduled" do
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
       @checker.check
       @checker.check
-      @checker.reload.should be_working
+      expect(@checker.reload).to be_working
       three_days_from_now = 3.days.from_now
       three_days_from_now = 3.days.from_now
       stub(Time).now { three_days_from_now }
       stub(Time).now { three_days_from_now }
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
     end
     end
   end
   end
 end
 end

+ 15 - 15
spec/models/agents/peak_detector_agent_spec.rb

@@ -22,17 +22,17 @@ describe Agents::PeakDetectorAgent do
       events = build_events(:keys => ['count', 'filter'],
       events = build_events(:keys => ['count', 'filter'],
                             :values => [[1, "something"], [2, "something"], [3, "else"]])
                             :values => [[1, "something"], [2, "something"], [3, "else"]])
       @agent.receive events
       @agent.receive events
-      @agent.memory['data']['something'].map(&:first).should == [1, 2]
-      @agent.memory['data']['something'].last.last.should be_within(10).of((100 - 1).hours.ago.to_i)
-      @agent.memory['data']['else'].first.first.should == 3
-      @agent.memory['data']['else'].first.last.should be_within(10).of((100 - 2).hours.ago.to_i)
+      expect(@agent.memory['data']['something'].map(&:first)).to eq([1, 2])
+      expect(@agent.memory['data']['something'].last.last).to be_within(10).of((100 - 1).hours.ago.to_i)
+      expect(@agent.memory['data']['else'].first.first).to eq(3)
+      expect(@agent.memory['data']['else'].first.last).to be_within(10).of((100 - 2).hours.ago.to_i)
     end
     end
 
 
     it "works without a group_by_path as well" do
     it "works without a group_by_path as well" do
       @agent.options['group_by_path'] = ""
       @agent.options['group_by_path'] = ""
       events = build_events(:keys => ['count'], :values => [[1], [2]])
       events = build_events(:keys => ['count'], :values => [[1], [2]])
       @agent.receive events
       @agent.receive events
-      @agent.memory['data']['no_group'].map(&:first).should == [1, 2]
+      expect(@agent.memory['data']['no_group'].map(&:first)).to eq([1, 2])
     end
     end
 
 
     it "keeps a rolling window of data" do
     it "keeps a rolling window of data" do
@@ -40,7 +40,7 @@ describe Agents::PeakDetectorAgent do
       @agent.receive build_events(:keys => ['count'],
       @agent.receive build_events(:keys => ['count'],
                                   :values => [1, 2, 3, 4, 5, 6, 7, 8].map {|i| [i]},
                                   :values => [1, 2, 3, 4, 5, 6, 7, 8].map {|i| [i]},
                                   :pattern => { 'filter' => "something" })
                                   :pattern => { 'filter' => "something" })
-      @agent.memory['data']['something'].map(&:first).should == [4, 5, 6, 7, 8]
+      expect(@agent.memory['data']['something'].map(&:first)).to eq([4, 5, 6, 7, 8])
     end
     end
 
 
     it "finds peaks" do
     it "finds peaks" do
@@ -52,13 +52,13 @@ describe Agents::PeakDetectorAgent do
                                8, 50, # ignored because it's too close to the first peak
                                8, 50, # ignored because it's too close to the first peak
                                4, 5].map {|i| [i]},
                                4, 5].map {|i| [i]},
                    :pattern => { 'filter' => "something" }).each.with_index do |event, index|
                    :pattern => { 'filter' => "something" }).each.with_index do |event, index|
-        lambda {
+        expect {
           @agent.receive([event])
           @agent.receive([event])
-        }.should change { @agent.events.count }.by( index == 6 ? 1 : 0 )
+        }.to change { @agent.events.count }.by( index == 6 ? 1 : 0 )
       end
       end
 
 
-      @agent.events.last.payload['peak'].should == 15.0
-      @agent.memory['peaks']['something'].length.should == 1
+      expect(@agent.events.last.payload['peak']).to eq(15.0)
+      expect(@agent.memory['peaks']['something'].length).to eq(1)
     end
     end
 
 
     it "keeps a rolling window of peaks" do
     it "keeps a rolling window of peaks" do
@@ -66,28 +66,28 @@ describe Agents::PeakDetectorAgent do
       @agent.receive build_events(:keys => ['count'],
       @agent.receive build_events(:keys => ['count'],
                                   :values => [1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1].map {|i| [i]},
                                   :values => [1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1].map {|i| [i]},
                                   :pattern => { 'filter' => "something" })
                                   :pattern => { 'filter' => "something" })
-      @agent.memory['peaks']['something'].length.should == 2
+      expect(@agent.memory['peaks']['something'].length).to eq(2)
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @agent.should be_valid
+      expect(@agent).to be_valid
     end
     end
 
 
     it "should validate presence of message" do
     it "should validate presence of message" do
       @agent.options['message'] = nil
       @agent.options['message'] = nil
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
 
 
     it "should validate presence of expected_receive_period_in_days" do
     it "should validate presence of expected_receive_period_in_days" do
       @agent.options['expected_receive_period_in_days'] = ""
       @agent.options['expected_receive_period_in_days'] = ""
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
 
 
     it "should validate presence of value_path" do
     it "should validate presence of value_path" do
       @agent.options['value_path'] = ""
       @agent.options['value_path'] = ""
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
   end
   end
 end
 end

+ 62 - 62
spec/models/agents/post_agent_spec.rb

@@ -57,10 +57,10 @@ describe Agents::PostAgent do
     it "can make requests of each type" do
     it "can make requests of each type" do
       %w[get put post patch delete].each.with_index(1) do |verb, index|
       %w[get put post patch delete].each.with_index(1) do |verb, index|
         @checker.options['method'] = verb
         @checker.options['method'] = verb
-        @checker.should be_valid
+        expect(@checker).to be_valid
         @checker.check
         @checker.check
-        @requests.should == index
-        @sent_requests[verb.to_sym].length.should == 1
+        expect(@requests).to eq(index)
+        expect(@sent_requests[verb.to_sym].length).to eq(1)
       end
       end
     end
     end
   end
   end
@@ -75,26 +75,26 @@ describe Agents::PostAgent do
         'default' => 'value2'
         'default' => 'value2'
       }
       }
 
 
-      lambda {
-        lambda {
+      expect {
+        expect {
           @checker.receive([@event, event1])
           @checker.receive([@event, event1])
-        }.should change { @sent_requests[:post].length }.by(2)
-      }.should_not change { @sent_requests[:get].length }
+        }.to change { @sent_requests[:post].length }.by(2)
+      }.not_to change { @sent_requests[:get].length }
 
 
-      @sent_requests[:post][0].data.should == @event.payload.merge('default' => 'value').to_query
-      @sent_requests[:post][1].data.should == event1.payload.to_query
+      expect(@sent_requests[:post][0].data).to eq(@event.payload.merge('default' => 'value').to_query)
+      expect(@sent_requests[:post][1].data).to eq(event1.payload.to_query)
     end
     end
 
 
     it "can make GET requests" do
     it "can make GET requests" do
       @checker.options['method'] = 'get'
       @checker.options['method'] = 'get'
 
 
-      lambda {
-        lambda {
+      expect {
+        expect {
           @checker.receive([@event])
           @checker.receive([@event])
-        }.should change { @sent_requests[:get].length }.by(1)
-      }.should_not change { @sent_requests[:post].length }
+        }.to change { @sent_requests[:get].length }.by(1)
+      }.not_to change { @sent_requests[:post].length }
 
 
-      @sent_requests[:get][0].data.should == @event.payload.merge('default' => 'value').to_query
+      expect(@sent_requests[:get][0].data).to eq(@event.payload.merge('default' => 'value').to_query)
     end
     end
 
 
     it "can make a GET request merging params in post_url, payload and event" do
     it "can make a GET request merging params in post_url, payload and event" do
@@ -107,7 +107,7 @@ describe Agents::PostAgent do
       @checker.receive([@event])
       @checker.receive([@event])
       uri = @sent_requests[:get].first.uri
       uri = @sent_requests[:get].first.uri
       # parameters are alphabetically sorted by Faraday
       # parameters are alphabetically sorted by Faraday
-      uri.request_uri.should == "/a/path?another_param=another_value&default=value&existing_param=existing_value&some_param=some_value"
+      expect(uri.request_uri).to eq("/a/path?another_param=another_value&default=value&existing_param=existing_value&some_param=some_value")
     end
     end
 
 
     it "can skip merging the incoming event when no_merge is set, but it still interpolates" do
     it "can skip merging the incoming event when no_merge is set, but it still interpolates" do
@@ -116,7 +116,7 @@ describe Agents::PostAgent do
         'key' => 'it said: {{ someotherkey.somekey }}'
         'key' => 'it said: {{ someotherkey.somekey }}'
       }
       }
       @checker.receive([@event])
       @checker.receive([@event])
-      @sent_requests[:post].first.data.should == { 'key' => 'it said: value' }.to_query
+      expect(@sent_requests[:post].first.data).to eq({ 'key' => 'it said: value' }.to_query)
     end
     end
 
 
     it "interpolates when receiving a payload" do
     it "interpolates when receiving a payload" do
@@ -127,140 +127,140 @@ describe Agents::PostAgent do
       }
       }
       @checker.receive([@event])
       @checker.receive([@event])
       uri = @sent_requests[:post].first.uri
       uri = @sent_requests[:post].first.uri
-      uri.scheme.should == 'https'
-      uri.host.should == 'google.com'
-      uri.path.should == '/a_variable'
-      uri.query.should == "existing_param=existing_value"
+      expect(uri.scheme).to eq('https')
+      expect(uri.host).to eq('google.com')
+      expect(uri.path).to eq('/a_variable')
+      expect(uri.query).to eq("existing_param=existing_value")
     end
     end
   end
   end
 
 
   describe "#check" do
   describe "#check" do
     it "sends options['payload'] as a POST request" do
     it "sends options['payload'] as a POST request" do
-      lambda {
+      expect {
         @checker.check
         @checker.check
-      }.should change { @sent_requests[:post].length }.by(1)
+      }.to change { @sent_requests[:post].length }.by(1)
 
 
-      @sent_requests[:post][0].data.should == @checker.options['payload'].to_query
+      expect(@sent_requests[:post][0].data).to eq(@checker.options['payload'].to_query)
     end
     end
 
 
     it "sends options['payload'] as JSON as a POST request" do
     it "sends options['payload'] as JSON as a POST request" do
       @checker.options['content_type'] = 'json'
       @checker.options['content_type'] = 'json'
-      lambda {
+      expect {
         @checker.check
         @checker.check
-      }.should change { @sent_requests[:post].length }.by(1)
+      }.to change { @sent_requests[:post].length }.by(1)
 
 
-      @sent_requests[:post][0].data.should == @checker.options['payload']
+      expect(@sent_requests[:post][0].data).to eq(@checker.options['payload'])
     end
     end
 
 
     it "sends options['payload'] as a GET request" do
     it "sends options['payload'] as a GET request" do
       @checker.options['method'] = 'get'
       @checker.options['method'] = 'get'
-      lambda {
-        lambda {
+      expect {
+        expect {
           @checker.check
           @checker.check
-        }.should change { @sent_requests[:get].length }.by(1)
-      }.should_not change { @sent_requests[:post].length }
+        }.to change { @sent_requests[:get].length }.by(1)
+      }.not_to change { @sent_requests[:post].length }
 
 
-      @sent_requests[:get][0].data.should == @checker.options['payload'].to_query
+      expect(@sent_requests[:get][0].data).to eq(@checker.options['payload'].to_query)
     end
     end
   end
   end
 
 
   describe "#working?" do
   describe "#working?" do
     it "checks if events have been received within expected receive period" do
     it "checks if events have been received within expected receive period" do
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
       Agents::PostAgent.async_receive @checker.id, [@event.id]
       Agents::PostAgent.async_receive @checker.id, [@event.id]
-      @checker.reload.should be_working
+      expect(@checker.reload).to be_working
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      @checker.reload.should_not be_working
+      expect(@checker.reload).not_to be_working
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of post_url" do
     it "should validate presence of post_url" do
       @checker.options['post_url'] = ""
       @checker.options['post_url'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of expected_receive_period_in_days" do
     it "should validate presence of expected_receive_period_in_days" do
       @checker.options['expected_receive_period_in_days'] = ""
       @checker.options['expected_receive_period_in_days'] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate method as post, get, put, patch, or delete, defaulting to post" do
     it "should validate method as post, get, put, patch, or delete, defaulting to post" do
       @checker.options['method'] = ""
       @checker.options['method'] = ""
-      @checker.method.should == "post"
-      @checker.should be_valid
+      expect(@checker.method).to eq("post")
+      expect(@checker).to be_valid
 
 
       @checker.options['method'] = "POST"
       @checker.options['method'] = "POST"
-      @checker.method.should == "post"
-      @checker.should be_valid
+      expect(@checker.method).to eq("post")
+      expect(@checker).to be_valid
 
 
       @checker.options['method'] = "get"
       @checker.options['method'] = "get"
-      @checker.method.should == "get"
-      @checker.should be_valid
+      expect(@checker.method).to eq("get")
+      expect(@checker).to be_valid
 
 
       @checker.options['method'] = "patch"
       @checker.options['method'] = "patch"
-      @checker.method.should == "patch"
-      @checker.should be_valid
+      expect(@checker.method).to eq("patch")
+      expect(@checker).to be_valid
 
 
       @checker.options['method'] = "wut"
       @checker.options['method'] = "wut"
-      @checker.method.should == "wut"
-      @checker.should_not be_valid
+      expect(@checker.method).to eq("wut")
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate that no_merge is 'true' or 'false', if present" do
     it "should validate that no_merge is 'true' or 'false', if present" do
       @checker.options['no_merge'] = ""
       @checker.options['no_merge'] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['no_merge'] = "true"
       @checker.options['no_merge'] = "true"
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['no_merge'] = "false"
       @checker.options['no_merge'] = "false"
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['no_merge'] = false
       @checker.options['no_merge'] = false
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['no_merge'] = true
       @checker.options['no_merge'] = true
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['no_merge'] = 'blarg'
       @checker.options['no_merge'] = 'blarg'
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate payload as a hash, if present" do
     it "should validate payload as a hash, if present" do
       @checker.options['payload'] = ""
       @checker.options['payload'] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['payload'] = "hello"
       @checker.options['payload'] = "hello"
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['payload'] = ["foo", "bar"]
       @checker.options['payload'] = ["foo", "bar"]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['payload'] = { 'this' => 'that' }
       @checker.options['payload'] = { 'this' => 'that' }
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "requires headers to be a hash, if present" do
     it "requires headers to be a hash, if present" do
       @checker.options['headers'] = [1,2,3]
       @checker.options['headers'] = [1,2,3]
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['headers'] = "hello world"
       @checker.options['headers'] = "hello world"
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['headers'] = ""
       @checker.options['headers'] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['headers'] = {}
       @checker.options['headers'] = {}
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['headers'] = { "Authorization" => "foo bar" }
       @checker.options['headers'] = { "Authorization" => "foo bar" }
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
   end
   end
 end
 end

+ 11 - 11
spec/models/agents/public_transport_agent_spec.rb

@@ -22,36 +22,36 @@ describe Agents::PublicTransportAgent do
     end
     end
 
 
     it "should create 4 events" do
     it "should create 4 events" do
-      lambda { @agent.check }.should change {@agent.events.count}.by(4)
+      expect { @agent.check }.to change {@agent.events.count}.by(4)
     end
     end
 
 
     it "should add 4 items to memory" do
     it "should add 4 items to memory" do
       time_travel_to Time.parse("2014-01-14 20:21:30 +0500") do
       time_travel_to Time.parse("2014-01-14 20:21:30 +0500") do
-        @agent.memory.should == {}
+        expect(@agent.memory).to eq({})
         @agent.check
         @agent.check
         @agent.save
         @agent.save
-        @agent.reload.memory.should == {"existing_routes" => [
+        expect(@agent.reload.memory).to eq({"existing_routes" => [
             {"stopTag"=>"5221", "tripTag"=>"5840324", "epochTime"=>"1389706393991", "currentTime"=>Time.now.to_s},
             {"stopTag"=>"5221", "tripTag"=>"5840324", "epochTime"=>"1389706393991", "currentTime"=>Time.now.to_s},
             {"stopTag"=>"5221", "tripTag"=>"5840083", "epochTime"=>"1389706512784", "currentTime"=>Time.now.to_s},
             {"stopTag"=>"5221", "tripTag"=>"5840083", "epochTime"=>"1389706512784", "currentTime"=>Time.now.to_s},
             {"stopTag"=>"5215", "tripTag"=>"5840324", "epochTime"=>"1389706282012", "currentTime"=>Time.now.to_s},
             {"stopTag"=>"5215", "tripTag"=>"5840324", "epochTime"=>"1389706282012", "currentTime"=>Time.now.to_s},
             {"stopTag"=>"5215", "tripTag"=>"5840083", "epochTime"=>"1389706400805", "currentTime"=>Time.now.to_s}
             {"stopTag"=>"5215", "tripTag"=>"5840083", "epochTime"=>"1389706400805", "currentTime"=>Time.now.to_s}
           ]
           ]
-        }
+        })
       end
       end
     end
     end
 
 
     it "should not create events twice" do
     it "should not create events twice" do
-      lambda { @agent.check }.should change {@agent.events.count}.by(4)
-      lambda { @agent.check }.should_not change {@agent.events.count}
+      expect { @agent.check }.to change {@agent.events.count}.by(4)
+      expect { @agent.check }.not_to change {@agent.events.count}
     end
     end
 
 
     it "should reset memory after 2 hours" do
     it "should reset memory after 2 hours" do
       time_travel_to Time.parse("2014-01-14 20:21:30 +0500") do
       time_travel_to Time.parse("2014-01-14 20:21:30 +0500") do
-        lambda { @agent.check }.should change {@agent.events.count}.by(4)
+        expect { @agent.check }.to change {@agent.events.count}.by(4)
       end
       end
       time_travel_to "2014-01-14 23:21:30 +0500".to_time do
       time_travel_to "2014-01-14 23:21:30 +0500".to_time do
         @agent.cleanup_old_memory
         @agent.cleanup_old_memory
-        lambda { @agent.check }.should change {@agent.events.count}.by(4)
+        expect { @agent.check }.to change {@agent.events.count}.by(4)
       end
       end
     end
     end
   end
   end
@@ -59,17 +59,17 @@ describe Agents::PublicTransportAgent do
   describe "validation" do
   describe "validation" do
     it "should validate presence of stops" do
     it "should validate presence of stops" do
       @agent.options['stops'] = nil
       @agent.options['stops'] = nil
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
 
 
     it "should validate presence of agency" do
     it "should validate presence of agency" do
       @agent.options['agency'] = ""
       @agent.options['agency'] = ""
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
 
 
     it "should validate presence of alert_window_in_minutes" do
     it "should validate presence of alert_window_in_minutes" do
       @agent.options['alert_window_in_minutes'] = ""
       @agent.options['alert_window_in_minutes'] = ""
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
   end
   end
 end
 end

+ 7 - 7
spec/models/agents/pushbullet_agent_spec.rb

@@ -21,26 +21,26 @@ describe Agents::PushbulletAgent do
 
 
   describe "validating" do
   describe "validating" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should require the api_key" do
     it "should require the api_key" do
       @checker.options['api_key'] = nil
       @checker.options['api_key'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should require the device_id" do
     it "should require the device_id" do
       @checker.options['device_id'] = nil
       @checker.options['device_id'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
   end
   end
 
 
   describe "helpers" do
   describe "helpers" do
     it "should return the query_options" do
     it "should return the query_options" do
-      @checker.send(:query_options, @event).should == {
+      expect(@checker.send(:query_options, @event)).to eq({
         :body => {:title => 'hello from huginn', :body => 'One two test', :device_iden => @checker.options[:device_id], :type => 'note'},
         :body => {:title => 'hello from huginn', :body => 'One two test', :device_iden => @checker.options[:device_id], :type => 'note'},
         :basic_auth => {:username =>@checker.options[:api_key], :password=>''}
         :basic_auth => {:username =>@checker.options[:api_key], :password=>''}
-      }
+      })
     end
     end
   end
   end
 
 
@@ -64,9 +64,9 @@ describe Agents::PushbulletAgent do
 
 
   describe "#working?" do
   describe "#working?" do
     it "should not be working until the first event was received" do
     it "should not be working until the first event was received" do
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
       @checker.last_receive_at = Time.now
       @checker.last_receive_at = Time.now
-      @checker.should be_working
+      expect(@checker).to be_working
     end
     end
   end
   end
 end
 end

+ 27 - 27
spec/models/agents/pushover_agent_spec.rb

@@ -42,9 +42,9 @@ describe Agents::PushoverAgent do
       event2.save!
       event2.save!
 
 
       @checker.receive([@event,event1,event2])
       @checker.receive([@event,event1,event2])
-      @sent_notifications[0]['message'].should == 'Looks like its going to rain'
-      @sent_notifications[1]['message'].should == 'Some message'
-      @sent_notifications[2]['message'].should == 'Some other message'
+      expect(@sent_notifications[0]['message']).to eq('Looks like its going to rain')
+      expect(@sent_notifications[1]['message']).to eq('Some message')
+      expect(@sent_notifications[2]['message']).to eq('Some other message')
     end
     end
 
 
     it 'should make sure event message overrides default message' do
     it 'should make sure event message overrides default message' do
@@ -54,7 +54,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['message'].should == 'Some new message'
+      expect(@sent_notifications[0]['message']).to eq('Some new message')
     end
     end
 
 
     it 'should make sure event text overrides default message' do
     it 'should make sure event text overrides default message' do
@@ -64,7 +64,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['message'].should == 'Some new text'
+      expect(@sent_notifications[0]['message']).to eq('Some new text')
     end
     end
 
 
     it 'should make sure event title overrides default title' do
     it 'should make sure event title overrides default title' do
@@ -74,7 +74,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['title'].should == 'Some new title'
+      expect(@sent_notifications[0]['title']).to eq('Some new title')
     end
     end
 
 
     it 'should make sure event url overrides default url' do
     it 'should make sure event url overrides default url' do
@@ -84,7 +84,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['url'].should == 'Some new url'
+      expect(@sent_notifications[0]['url']).to eq('Some new url')
     end
     end
 
 
     it 'should make sure event url_title overrides default url_title' do
     it 'should make sure event url_title overrides default url_title' do
@@ -94,7 +94,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['url_title'].should == 'Some new url_title'
+      expect(@sent_notifications[0]['url_title']).to eq('Some new url_title')
     end
     end
 
 
     it 'should make sure event priority overrides default priority' do
     it 'should make sure event priority overrides default priority' do
@@ -104,7 +104,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['priority'].should == 1
+      expect(@sent_notifications[0]['priority']).to eq(1)
     end
     end
 
 
     it 'should make sure event timestamp overrides default timestamp' do
     it 'should make sure event timestamp overrides default timestamp' do
@@ -114,7 +114,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['timestamp'].should == 'false'
+      expect(@sent_notifications[0]['timestamp']).to eq('false')
     end
     end
 
 
     it 'should make sure event sound overrides default sound' do
     it 'should make sure event sound overrides default sound' do
@@ -124,7 +124,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['sound'].should == 'Some new sound'
+      expect(@sent_notifications[0]['sound']).to eq('Some new sound')
     end
     end
 
 
     it 'should make sure event retry overrides default retry' do
     it 'should make sure event retry overrides default retry' do
@@ -134,7 +134,7 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['retry'].should == 1
+      expect(@sent_notifications[0]['retry']).to eq(1)
     end
     end
 
 
     it 'should make sure event expire overrides default expire' do
     it 'should make sure event expire overrides default expire' do
@@ -144,79 +144,79 @@ describe Agents::PushoverAgent do
       event.save!
       event.save!
 
 
       @checker.receive([event])
       @checker.receive([event])
-      @sent_notifications[0]['expire'].should == 60
+      expect(@sent_notifications[0]['expire']).to eq(60)
     end
     end
   end
   end
 
 
   describe '#working?' do
   describe '#working?' do
     it 'checks if events have been received within the expected receive period' do
     it 'checks if events have been received within the expected receive period' do
       # No events received
       # No events received
-      @checker.should_not be_working 
+      expect(@checker).not_to be_working
       Agents::PushoverAgent.async_receive @checker.id, [@event.id]
       Agents::PushoverAgent.async_receive @checker.id, [@event.id]
 
 
       # Just received events
       # Just received events
-      @checker.reload.should be_working 
+      expect(@checker.reload).to be_working
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
       
       
       # More time has passed than the expected receive period without any new events
       # More time has passed than the expected receive period without any new events
-      @checker.reload.should_not be_working 
+      expect(@checker.reload).not_to be_working
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of token" do
     it "should validate presence of token" do
       @checker.options[:token] = ""
       @checker.options[:token] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of user" do
     it "should validate presence of user" do
       @checker.options[:user] = ""
       @checker.options[:user] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of expected_receive_period_in_days" do
     it "should validate presence of expected_receive_period_in_days" do
       @checker.options[:expected_receive_period_in_days] = ""
       @checker.options[:expected_receive_period_in_days] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should make sure device is optional" do
     it "should make sure device is optional" do
       @checker.options[:device] = ""
       @checker.options[:device] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should make sure title is optional" do
     it "should make sure title is optional" do
       @checker.options[:title] = ""
       @checker.options[:title] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should make sure url is optional" do
     it "should make sure url is optional" do
       @checker.options[:url] = ""
       @checker.options[:url] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should make sure url_title is optional" do
     it "should make sure url_title is optional" do
       @checker.options[:url_title] = ""
       @checker.options[:url_title] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should make sure priority is optional" do
     it "should make sure priority is optional" do
       @checker.options[:priority] = ""
       @checker.options[:priority] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should make sure timestamp is optional" do
     it "should make sure timestamp is optional" do
       @checker.options[:timestamp] = ""
       @checker.options[:timestamp] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should make sure sound is optional" do
     it "should make sure sound is optional" do
       @checker.options[:sound] = ""
       @checker.options[:sound] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
   end
   end
 end
 end

+ 20 - 20
spec/models/agents/rss_agent_spec.rb

@@ -23,60 +23,60 @@ describe Agents::RssAgent do
   describe "validations" do
   describe "validations" do
     it "should validate the presence of url" do
     it "should validate the presence of url" do
       agent.options['url'] = "http://google.com"
       agent.options['url'] = "http://google.com"
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['url'] = ""
       agent.options['url'] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['url'] = nil
       agent.options['url'] = nil
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
 
 
     it "should validate the presence and numericality of expected_update_period_in_days" do
     it "should validate the presence and numericality of expected_update_period_in_days" do
       agent.options['expected_update_period_in_days'] = "5"
       agent.options['expected_update_period_in_days'] = "5"
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['expected_update_period_in_days'] = "wut?"
       agent.options['expected_update_period_in_days'] = "wut?"
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['expected_update_period_in_days'] = 0
       agent.options['expected_update_period_in_days'] = 0
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['expected_update_period_in_days'] = nil
       agent.options['expected_update_period_in_days'] = nil
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['expected_update_period_in_days'] = ""
       agent.options['expected_update_period_in_days'] = ""
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
   end
   end
 
 
   describe "emitting RSS events" do
   describe "emitting RSS events" do
     it "should emit items as events" do
     it "should emit items as events" do
-      lambda {
+      expect {
         agent.check
         agent.check
-      }.should change { agent.events.count }.by(20)
+      }.to change { agent.events.count }.by(20)
     end
     end
 
 
     it "should track ids and not re-emit the same item when seen again" do
     it "should track ids and not re-emit the same item when seen again" do
       agent.check
       agent.check
-      agent.memory['seen_ids'].should == agent.events.map {|e| e.payload['id'] }
+      expect(agent.memory['seen_ids']).to eq(agent.events.map {|e| e.payload['id'] })
 
 
       newest_id = agent.memory['seen_ids'][0]
       newest_id = agent.memory['seen_ids'][0]
-      agent.events.first.payload['id'].should == newest_id
+      expect(agent.events.first.payload['id']).to eq(newest_id)
       agent.memory['seen_ids'] = agent.memory['seen_ids'][1..-1] # forget the newest id
       agent.memory['seen_ids'] = agent.memory['seen_ids'][1..-1] # forget the newest id
 
 
-      lambda {
+      expect {
         agent.check
         agent.check
-      }.should change { agent.events.count }.by(1)
+      }.to change { agent.events.count }.by(1)
 
 
-      agent.events.first.payload['id'].should == newest_id
-      agent.memory['seen_ids'][0].should == newest_id
+      expect(agent.events.first.payload['id']).to eq(newest_id)
+      expect(agent.memory['seen_ids'][0]).to eq(newest_id)
     end
     end
 
 
     it "should truncate the seen_ids in memory at 500 items" do
     it "should truncate the seen_ids in memory at 500 items" do
       agent.memory['seen_ids'] = ['x'] * 490
       agent.memory['seen_ids'] = ['x'] * 490
       agent.check
       agent.check
-      agent.memory['seen_ids'].length.should == 500
+      expect(agent.memory['seen_ids'].length).to eq(500)
     end
     end
   end
   end
 
 
@@ -86,10 +86,10 @@ describe Agents::RssAgent do
     end
     end
 
 
     it "calculates content MD5 sums" do
     it "calculates content MD5 sums" do
-      lambda {
+      expect {
         agent.check
         agent.check
-      }.should change { agent.events.count }.by(79)
-      agent.memory['seen_ids'].should == agent.events.map {|e| Digest::MD5.hexdigest(e.payload['content']) }
+      }.to change { agent.events.count }.by(79)
+      expect(agent.memory['seen_ids']).to eq(agent.events.map {|e| Digest::MD5.hexdigest(e.payload['content']) })
     end
     end
   end
   end
 end
 end

+ 24 - 24
spec/models/agents/scheduler_agent_spec.rb

@@ -11,58 +11,58 @@ describe Agents::SchedulerAgent do
     it "should validate action" do
     it "should validate action" do
       ['run', 'enable', 'disable', '', nil].each { |action|
       ['run', 'enable', 'disable', '', nil].each { |action|
         @agent.options['action'] = action
         @agent.options['action'] = action
-        @agent.should be_valid
+        expect(@agent).to be_valid
       }
       }
 
 
       ['delete', 1, true].each { |action|
       ['delete', 1, true].each { |action|
         @agent.options['action'] = action
         @agent.options['action'] = action
-        @agent.should_not be_valid
+        expect(@agent).not_to be_valid
       }
       }
     end
     end
 
 
     it "should validate schedule" do
     it "should validate schedule" do
-      @agent.should be_valid
+      expect(@agent).to be_valid
 
 
       @agent.options.delete('schedule')
       @agent.options.delete('schedule')
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       @agent.options['schedule'] = nil
       @agent.options['schedule'] = nil
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       @agent.options['schedule'] = ''
       @agent.options['schedule'] = ''
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       @agent.options['schedule'] = '0'
       @agent.options['schedule'] = '0'
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       @agent.options['schedule'] = '*/15 * * * * * *'
       @agent.options['schedule'] = '*/15 * * * * * *'
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       @agent.options['schedule'] = '*/1 * * * *'
       @agent.options['schedule'] = '*/1 * * * *'
-      @agent.should be_valid
+      expect(@agent).to be_valid
 
 
       @agent.options['schedule'] = '*/1 * * *'
       @agent.options['schedule'] = '*/1 * * *'
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       stub(@agent).second_precision_enabled { true }
       stub(@agent).second_precision_enabled { true }
       @agent.options['schedule'] = '*/15 * * * * *'
       @agent.options['schedule'] = '*/15 * * * * *'
-      @agent.should be_valid
+      expect(@agent).to be_valid
 
 
       stub(@agent).second_precision_enabled { false }
       stub(@agent).second_precision_enabled { false }
       @agent.options['schedule'] = '*/10 * * * * *'
       @agent.options['schedule'] = '*/10 * * * * *'
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       @agent.options['schedule'] = '5/30 * * * * *'
       @agent.options['schedule'] = '5/30 * * * * *'
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
 
 
       @agent.options['schedule'] = '*/15 * * * * *'
       @agent.options['schedule'] = '*/15 * * * * *'
-      @agent.should be_valid
+      expect(@agent).to be_valid
 
 
       @agent.options['schedule'] = '15,45 * * * * *'
       @agent.options['schedule'] = '15,45 * * * * *'
-      @agent.should be_valid
+      expect(@agent).to be_valid
 
 
       @agent.options['schedule'] = '0 * * * * *'
       @agent.options['schedule'] = '0 * * * * *'
-      @agent.should be_valid
+      expect(@agent).to be_valid
     end
     end
   end
   end
 
 
@@ -70,26 +70,26 @@ describe Agents::SchedulerAgent do
     it "should be one of the supported values" do
     it "should be one of the supported values" do
       ['run', '', nil].each { |action|
       ['run', '', nil].each { |action|
         @agent.options['action'] = action
         @agent.options['action'] = action
-        @agent.control_action.should == 'run'
+        expect(@agent.control_action).to eq('run')
       }
       }
 
 
       ['enable', 'disable'].each { |action|
       ['enable', 'disable'].each { |action|
         @agent.options['action'] = action
         @agent.options['action'] = action
-        @agent.control_action.should == action
+        expect(@agent.control_action).to eq(action)
       }
       }
     end
     end
 
 
     it "cannot be 'run' if any of the control targets cannot be scheduled" do
     it "cannot be 'run' if any of the control targets cannot be scheduled" do
-      @agent.control_action.should == 'run'
+      expect(@agent.control_action).to eq('run')
       @agent.control_targets = [agents(:bob_rain_notifier_agent)]
       @agent.control_targets = [agents(:bob_rain_notifier_agent)]
-      @agent.should_not be_valid
+      expect(@agent).not_to be_valid
     end
     end
 
 
     it "can be 'enable' or 'disable' no matter if control targets can be scheduled or not" do
     it "can be 'enable' or 'disable' no matter if control targets can be scheduled or not" do
       ['enable', 'disable'].each { |action|
       ['enable', 'disable'].each { |action|
         @agent.options['action'] = action
         @agent.options['action'] = action
         @agent.control_targets = [agents(:bob_rain_notifier_agent)]
         @agent.control_targets = [agents(:bob_rain_notifier_agent)]
-        @agent.should be_valid
+        expect(@agent).to be_valid
       }
       }
     end
     end
   end
   end
@@ -100,13 +100,13 @@ describe Agents::SchedulerAgent do
 
 
       @agent.memory['scheduled_at'] = time
       @agent.memory['scheduled_at'] = time
       @agent.save
       @agent.save
-      @agent.memory['scheduled_at'].should == time
+      expect(@agent.memory['scheduled_at']).to eq(time)
 
 
       @agent.memory['scheduled_at'] = time
       @agent.memory['scheduled_at'] = time
       # Currently @agent.options[]= is not detected
       # Currently @agent.options[]= is not detected
       @agent.options = { 'schedule' => '*/5 * * * *' }
       @agent.options = { 'schedule' => '*/5 * * * *' }
       @agent.save
       @agent.save
-      @agent.memory['scheduled_at'].should be_nil
+      expect(@agent.memory['scheduled_at']).to be_nil
     end
     end
   end
   end
 
 
@@ -122,7 +122,7 @@ describe Agents::SchedulerAgent do
       }
       }
 
 
       @agent.check!
       @agent.check!
-      control_target_ids.should be_empty
+      expect(control_target_ids).to be_empty
 
 
       @agent.options['action'] = 'disable'
       @agent.options['action'] = 'disable'
       @agent.save!
       @agent.save!

+ 11 - 11
spec/models/agents/sentiment_agent_spec.rb

@@ -24,36 +24,36 @@ describe Agents::SentimentAgent do
 
 
     describe "#working?" do
     describe "#working?" do
         it "checks if events have been received within expected receive period" do
         it "checks if events have been received within expected receive period" do
-            @checker.should_not be_working
+            expect(@checker).not_to be_working
             Agents::SentimentAgent.async_receive @checker.id, [@event.id]
             Agents::SentimentAgent.async_receive @checker.id, [@event.id]
-            @checker.reload.should be_working
+            expect(@checker.reload).to be_working
             two_days_from_now = 2.days.from_now
             two_days_from_now = 2.days.from_now
             stub(Time).now { two_days_from_now }  
             stub(Time).now { two_days_from_now }  
-            @checker.reload.should_not be_working
+            expect(@checker.reload).not_to be_working
         end
         end
     end
     end
 
 
     describe "validation" do
     describe "validation" do
         before do
         before do
-            @checker.should be_valid
+            expect(@checker).to be_valid
         end
         end
 
 
         it "should validate presence of content key" do
         it "should validate presence of content key" do
             @checker.options[:content] = nil
             @checker.options[:content] = nil
-            @checker.should_not be_valid
+            expect(@checker).not_to be_valid
         end
         end
 
 
         it "should validate presence of expected_receive_period_in_days key" do
         it "should validate presence of expected_receive_period_in_days key" do
             @checker.options[:expected_receive_period_in_days] = nil
             @checker.options[:expected_receive_period_in_days] = nil
-            @checker.should_not be_valid
+            expect(@checker).not_to be_valid
         end
         end
     end
     end
 
 
     describe "#receive" do
     describe "#receive" do
         it "checks if content key is working fine" do
         it "checks if content key is working fine" do
             @checker.receive([@event])
             @checker.receive([@event])
-            Event.last.payload[:content].should == "value1"
-            Event.last.payload[:original_event].should == { 'message' => "value1" }
+            expect(Event.last.payload[:content]).to eq("value1")
+            expect(Event.last.payload[:original_event]).to eq({ 'message' => "value1" })
         end
         end
         it "should handle multiple events" do
         it "should handle multiple events" do
             event1 = Event.new
             event1 = Event.new
@@ -68,9 +68,9 @@ describe Agents::SentimentAgent do
                 :message => "The quick brown fox jumps over the lazy dog"
                 :message => "The quick brown fox jumps over the lazy dog"
             }
             }
 
 
-            lambda {
+            expect {
                 @checker.receive([@event,event1,event2])
                 @checker.receive([@event,event1,event2])
-            }.should change { Event.count }.by(3)
+            }.to change { Event.count }.by(3)
         end
         end
     end
     end
-end
+end

+ 13 - 13
spec/models/agents/shell_command_agent_spec.rb

@@ -26,22 +26,22 @@ describe Agents::ShellCommandAgent do
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of necessary fields" do
     it "should validate presence of necessary fields" do
       @checker.options[:command] = nil
       @checker.options[:command] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate path" do
     it "should validate path" do
       @checker.options[:path] = 'notarealpath/itreallyisnt'
       @checker.options[:path] = 'notarealpath/itreallyisnt'
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate path" do
     it "should validate path" do
       @checker.options[:path] = '/'
       @checker.options[:path] = '/'
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
   end
   end
 
 
@@ -49,12 +49,12 @@ describe Agents::ShellCommandAgent do
     it "generating events as scheduled" do
     it "generating events as scheduled" do
       stub(@checker).run_command(@valid_path, 'pwd') { ["fake pwd output", "", 0] }
       stub(@checker).run_command(@valid_path, 'pwd') { ["fake pwd output", "", 0] }
 
 
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
       @checker.check
       @checker.check
-      @checker.reload.should be_working
+      expect(@checker.reload).to be_working
       three_days_from_now = 3.days.from_now
       three_days_from_now = 3.days.from_now
       stub(Time).now { three_days_from_now }
       stub(Time).now { three_days_from_now }
-      @checker.should_not be_working
+      expect(@checker).not_to be_working
     end
     end
   end
   end
 
 
@@ -65,9 +65,9 @@ describe Agents::ShellCommandAgent do
 
 
     it "should create an event when checking" do
     it "should create an event when checking" do
       expect { @checker.check }.to change { Event.count }.by(1)
       expect { @checker.check }.to change { Event.count }.by(1)
-      Event.last.payload[:path].should == @valid_path
-      Event.last.payload[:command].should == 'pwd'
-      Event.last.payload[:output].should == "fake pwd output"
+      expect(Event.last.payload[:path]).to eq(@valid_path)
+      expect(Event.last.payload[:command]).to eq('pwd')
+      expect(Event.last.payload[:output]).to eq("fake pwd output")
     end
     end
 
 
     it "does not run when should_run? is false" do
     it "does not run when should_run? is false" do
@@ -84,9 +84,9 @@ describe Agents::ShellCommandAgent do
     it "creates events" do
     it "creates events" do
       @checker.options[:command] = "{{cmd}}"
       @checker.options[:command] = "{{cmd}}"
       @checker.receive([@event])
       @checker.receive([@event])
-      Event.last.payload[:path].should == @valid_path
-      Event.last.payload[:command].should == @event.payload[:cmd]
-      Event.last.payload[:output].should == "fake ls output"
+      expect(Event.last.payload[:path]).to eq(@valid_path)
+      expect(Event.last.payload[:command]).to eq(@event.payload[:cmd])
+      expect(Event.last.payload[:output]).to eq("fake ls output")
     end
     end
 
 
     it "does not run when should_run? is false" do
     it "does not run when should_run? is false" do

+ 1 - 1
spec/models/agents/slack_agent_spec.rb

@@ -49,7 +49,7 @@ describe Agents::SlackAgent do
                       )
                       )
       end
       end
 
 
-      lambda { @checker.receive([@event]) }.should_not raise_error
+      expect { @checker.receive([@event]) }.not_to raise_error
     end
     end
   end
   end
 
 

+ 6 - 6
spec/models/agents/stubhub_agent_spec.rb

@@ -37,31 +37,31 @@ describe Agents::StubhubAgent do
 
 
     it 'should properly parse the response' do
     it 'should properly parse the response' do
       event = @stubhub_agent.check
       event = @stubhub_agent.check
-      event.payload.should == response_payload
+      expect(event.payload).to eq(response_payload)
     end
     end
   end
   end
 
 
   describe "validations" do
   describe "validations" do
     before do
     before do
-      @stubhub_agent.should be_valid
+      expect(@stubhub_agent).to be_valid
     end
     end
 
 
     it "should require a url" do
     it "should require a url" do
       @stubhub_agent.options['url'] = nil
       @stubhub_agent.options['url'] = nil
-      @stubhub_agent.should_not be_valid
+      expect(@stubhub_agent).not_to be_valid
     end
     end
 
 
   end
   end
 
 
   describe "#working?" do
   describe "#working?" do
     it "checks if events have been received within the expected receive period" do
     it "checks if events have been received within the expected receive period" do
-      @stubhub_agent.should_not be_working
+      expect(@stubhub_agent).not_to be_working
 
 
       Agents::StubhubAgent.async_check @stubhub_agent.id
       Agents::StubhubAgent.async_check @stubhub_agent.id
-      @stubhub_agent.reload.should be_working
+      expect(@stubhub_agent.reload).to be_working
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      @stubhub_agent.reload.should_not be_working
+      expect(@stubhub_agent.reload).not_to be_working
     end
     end
   end
   end
 end
 end

+ 12 - 12
spec/models/agents/translation_agent_spec.rb

@@ -42,51 +42,51 @@ describe Agents::TranslationAgent do
                 :message => "value2"
                 :message => "value2"
             }
             }
 
 
-            lambda {
+            expect {
                 @checker.receive([@event,event1])
                 @checker.receive([@event,event1])
-            }.should change { Event.count }.by(2)
+            }.to change { Event.count }.by(2)
         end
         end
     end
     end
 
 
     describe "#working?" do
     describe "#working?" do
         it "checks if events have been received within expected receive period" do
         it "checks if events have been received within expected receive period" do
-            @checker.should_not be_working
+            expect(@checker).not_to be_working
             Agents::TranslationAgent.async_receive @checker.id, [@event.id]
             Agents::TranslationAgent.async_receive @checker.id, [@event.id]
-            @checker.reload.should be_working
+            expect(@checker.reload).to be_working
             two_days_from_now = 2.days.from_now
             two_days_from_now = 2.days.from_now
             stub(Time).now { two_days_from_now }  
             stub(Time).now { two_days_from_now }  
-            @checker.reload.should_not be_working
+            expect(@checker.reload).not_to be_working
         end
         end
     end
     end
 
 
     describe "validation" do
     describe "validation" do
         before do
         before do
-            @checker.should be_valid
+            expect(@checker).to be_valid
         end
         end
 
 
         it "should validate presence of content key" do
         it "should validate presence of content key" do
             @checker.options[:content] = nil
             @checker.options[:content] = nil
-            @checker.should_not be_valid
+            expect(@checker).not_to be_valid
         end
         end
 
 
         it "should validate presence of expected_receive_period_in_days key" do
         it "should validate presence of expected_receive_period_in_days key" do
             @checker.options[:expected_receive_period_in_days] = nil
             @checker.options[:expected_receive_period_in_days] = nil
-            @checker.should_not be_valid
+            expect(@checker).not_to be_valid
         end
         end
 
 
         it "should validate presence of client_id key" do
         it "should validate presence of client_id key" do
             @checker.options[:client_id] = ""
             @checker.options[:client_id] = ""
-            @checker.should_not be_valid
+            expect(@checker).not_to be_valid
         end
         end
 
 
         it "should validate presence of client_secret key" do
         it "should validate presence of client_secret key" do
             @checker.options[:client_secret] = ""
             @checker.options[:client_secret] = ""
-            @checker.should_not be_valid
+            expect(@checker).not_to be_valid
         end
         end
 
 
         it "should validate presence of 'to' key" do
         it "should validate presence of 'to' key" do
             @checker.options[:to] = ""
             @checker.options[:to] = ""
-            @checker.should_not be_valid
+            expect(@checker).not_to be_valid
         end
         end
     end
     end
-end
+end

+ 76 - 76
spec/models/agents/trigger_agent_spec.rb

@@ -27,44 +27,44 @@ describe Agents::TriggerAgent do
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of message" do
     it "should validate presence of message" do
       @checker.options['message'] = nil
       @checker.options['message'] = nil
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
 
 
       @checker.options['message'] = ''
       @checker.options['message'] = ''
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should be valid without a message when 'keep_event' is set" do
     it "should be valid without a message when 'keep_event' is set" do
       @checker.options['keep_event'] = 'true'
       @checker.options['keep_event'] = 'true'
       @checker.options['message'] = ''
       @checker.options['message'] = ''
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "if present, 'keep_event' must equal true or false" do
     it "if present, 'keep_event' must equal true or false" do
       @checker.options['keep_event'] = 'true'
       @checker.options['keep_event'] = 'true'
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['keep_event'] = 'false'
       @checker.options['keep_event'] = 'false'
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['keep_event'] = ''
       @checker.options['keep_event'] = ''
-      @checker.should be_valid
+      expect(@checker).to be_valid
 
 
       @checker.options['keep_event'] = 'tralse'
       @checker.options['keep_event'] = 'tralse'
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate the three fields in each rule" do
     it "should validate the three fields in each rule" do
       @checker.options['rules'] << { 'path' => "foo", 'type' => "fake", 'value' => "6" }
       @checker.options['rules'] << { 'path' => "foo", 'type' => "fake", 'value' => "6" }
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
       @checker.options['rules'].last['type'] = "field>=value"
       @checker.options['rules'].last['type'] = "field>=value"
-      @checker.should be_valid
+      expect(@checker).to be_valid
       @checker.options['rules'].last.delete('value')
       @checker.options['rules'].last.delete('value')
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
   end
   end
 
 
@@ -72,26 +72,26 @@ describe Agents::TriggerAgent do
     it "checks to see if the Agent has received any events in the last 'expected_receive_period_in_days' days" do
     it "checks to see if the Agent has received any events in the last 'expected_receive_period_in_days' days" do
       @event.save!
       @event.save!
 
 
-      @checker.should_not be_working # no events have ever been received
+      expect(@checker).not_to be_working # no events have ever been received
       Agents::TriggerAgent.async_receive(@checker.id, [@event.id])
       Agents::TriggerAgent.async_receive(@checker.id, [@event.id])
-      @checker.reload.should be_working # Events received
+      expect(@checker.reload).to be_working # Events received
       three_days_from_now = 3.days.from_now
       three_days_from_now = 3.days.from_now
       stub(Time).now { three_days_from_now }
       stub(Time).now { three_days_from_now }
-      @checker.reload.should_not be_working # too much time has passed
+      expect(@checker.reload).not_to be_working # too much time has passed
     end
     end
   end
   end
 
 
   describe "#receive" do
   describe "#receive" do
     it "handles regex" do
     it "handles regex" do
       @event.payload['foo']['bar']['baz'] = "a222b"
       @event.payload['foo']['bar']['baz'] = "a222b"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @event.payload['foo']['bar']['baz'] = "a2b"
       @event.payload['foo']['bar']['baz'] = "a2b"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "handles array of regex" do
     it "handles array of regex" do
@@ -101,19 +101,19 @@ describe Agents::TriggerAgent do
         'value' => ["a\\db", "a\\Wb"],
         'value' => ["a\\db", "a\\Wb"],
         'path' => "foo.bar.baz",
         'path' => "foo.bar.baz",
       }
       }
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @event.payload['foo']['bar']['baz'] = "a2b"
       @event.payload['foo']['bar']['baz'] = "a2b"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
 
 
       @event.payload['foo']['bar']['baz'] = "a b"
       @event.payload['foo']['bar']['baz'] = "a b"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "handles negated regex" do
     it "handles negated regex" do
@@ -124,14 +124,14 @@ describe Agents::TriggerAgent do
         'path' => "foo.bar.baz",
         'path' => "foo.bar.baz",
       }
       }
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @event.payload['foo']['bar']['baz'] = "a22b"
       @event.payload['foo']['bar']['baz'] = "a22b"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "handles array of negated regex" do
     it "handles array of negated regex" do
@@ -142,19 +142,19 @@ describe Agents::TriggerAgent do
         'path' => "foo.bar.baz",
         'path' => "foo.bar.baz",
       }
       }
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @event.payload['foo']['bar']['baz'] = "a3b"
       @event.payload['foo']['bar']['baz'] = "a3b"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "puts can extract values into the message based on paths" do
     it "puts can extract values into the message based on paths" do
       @checker.receive([@event])
       @checker.receive([@event])
-      Event.last.payload['message'].should == "I saw 'a2b' from Joe"
+      expect(Event.last.payload['message']).to eq("I saw 'a2b' from Joe")
     end
     end
 
 
     it "handles numerical comparisons" do
     it "handles numerical comparisons" do
@@ -162,14 +162,14 @@ describe Agents::TriggerAgent do
       @checker.options['rules'].first['value'] = 6
       @checker.options['rules'].first['value'] = 6
       @checker.options['rules'].first['type'] = "field<value"
       @checker.options['rules'].first['type'] = "field<value"
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
 
 
       @checker.options['rules'].first['value'] = 3
       @checker.options['rules'].first['value'] = 3
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
     end
     end
 
 
     it "handles array of numerical comparisons" do
     it "handles array of numerical comparisons" do
@@ -177,14 +177,14 @@ describe Agents::TriggerAgent do
       @checker.options['rules'].first['value'] = [6, 3]
       @checker.options['rules'].first['value'] = [6, 3]
       @checker.options['rules'].first['type'] = "field<value"
       @checker.options['rules'].first['type'] = "field<value"
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
 
 
       @checker.options['rules'].first['value'] = [4, 3]
       @checker.options['rules'].first['value'] = [4, 3]
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
     end
     end
 
 
     it "handles exact comparisons" do
     it "handles exact comparisons" do
@@ -192,14 +192,14 @@ describe Agents::TriggerAgent do
       @checker.options['rules'].first['type'] = "field==value"
       @checker.options['rules'].first['type'] = "field==value"
 
 
       @checker.options['rules'].first['value'] = "hello there"
       @checker.options['rules'].first['value'] = "hello there"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @checker.options['rules'].first['value'] = "hello world"
       @checker.options['rules'].first['value'] = "hello world"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "handles array of exact comparisons" do
     it "handles array of exact comparisons" do
@@ -207,14 +207,14 @@ describe Agents::TriggerAgent do
       @checker.options['rules'].first['type'] = "field==value"
       @checker.options['rules'].first['type'] = "field==value"
 
 
       @checker.options['rules'].first['value'] = ["hello there", "hello universe"]
       @checker.options['rules'].first['value'] = ["hello there", "hello universe"]
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @checker.options['rules'].first['value'] = ["hello world", "hello universe"]
       @checker.options['rules'].first['value'] = ["hello world", "hello universe"]
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "handles negated comparisons" do
     it "handles negated comparisons" do
@@ -222,15 +222,15 @@ describe Agents::TriggerAgent do
       @checker.options['rules'].first['type'] = "field!=value"
       @checker.options['rules'].first['type'] = "field!=value"
       @checker.options['rules'].first['value'] = "hello world"
       @checker.options['rules'].first['value'] = "hello world"
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @checker.options['rules'].first['value'] = "hello there"
       @checker.options['rules'].first['value'] = "hello there"
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "handles array of negated comparisons" do
     it "handles array of negated comparisons" do
@@ -238,15 +238,15 @@ describe Agents::TriggerAgent do
       @checker.options['rules'].first['type'] = "field!=value"
       @checker.options['rules'].first['type'] = "field!=value"
       @checker.options['rules'].first['value'] = ["hello world", "hello world"]
       @checker.options['rules'].first['value'] = ["hello world", "hello world"]
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @checker.options['rules'].first['value'] = ["hello there", "hello world"]
       @checker.options['rules'].first['value'] = ["hello there", "hello world"]
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
     end
     end
 
 
     it "does fine without dots in the path" do
     it "does fine without dots in the path" do
@@ -254,19 +254,19 @@ describe Agents::TriggerAgent do
       @checker.options['rules'].first['type'] = "field==value"
       @checker.options['rules'].first['type'] = "field==value"
       @checker.options['rules'].first['path'] = "hello"
       @checker.options['rules'].first['path'] = "hello"
       @checker.options['rules'].first['value'] = "world"
       @checker.options['rules'].first['value'] = "world"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
 
 
       @checker.options['rules'].first['path'] = "foo"
       @checker.options['rules'].first['path'] = "foo"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
 
 
       @checker.options['rules'].first['value'] = "hi"
       @checker.options['rules'].first['value'] = "hi"
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
     end
     end
 
 
     it "handles multiple events" do
     it "handles multiple events" do
@@ -278,9 +278,9 @@ describe Agents::TriggerAgent do
       event3.agent = agents(:bob_weather_agent)
       event3.agent = agents(:bob_weather_agent)
       event3.payload = { 'foo' => { 'bar' => { 'baz' => "a222b" }}}
       event3.payload = { 'foo' => { 'bar' => { 'baz' => "a222b" }}}
 
 
-      lambda {
+      expect {
         @checker.receive([@event, event2, event3])
         @checker.receive([@event, event2, event3])
-      }.should change { Event.count }.by(2)
+      }.to change { Event.count }.by(2)
     end
     end
 
 
     it "handles ANDing rules together" do
     it "handles ANDing rules together" do
@@ -292,14 +292,14 @@ describe Agents::TriggerAgent do
 
 
       @event.payload['foo']["bing"] = "5"
       @event.payload['foo']["bing"] = "5"
 
 
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should change { Event.count }.by(1)
+      }.to change { Event.count }.by(1)
 
 
       @checker.options['rules'].last['value'] = 6
       @checker.options['rules'].last['value'] = 6
-      lambda {
+      expect {
         @checker.receive([@event])
         @checker.receive([@event])
-      }.should_not change { Event.count }
+      }.not_to change { Event.count }
     end
     end
 
 
     describe "when 'keep_event' is true" do
     describe "when 'keep_event' is true" do
@@ -314,16 +314,16 @@ describe Agents::TriggerAgent do
         @checker.options['message'] = ''
         @checker.options['message'] = ''
         @event.payload['message'] = 'hi there'
         @event.payload['message'] = 'hi there'
 
 
-        lambda {
+        expect {
           @checker.receive([@event])
           @checker.receive([@event])
-        }.should_not change { Event.count }
+        }.not_to change { Event.count }
 
 
         @checker.options['rules'].first['value'] = 6
         @checker.options['rules'].first['value'] = 6
-        lambda {
+        expect {
           @checker.receive([@event])
           @checker.receive([@event])
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
 
 
-        @checker.most_recent_event.payload.should == @event.payload
+        expect(@checker.most_recent_event.payload).to eq(@event.payload)
       end
       end
 
 
       it "merges 'message' into the original event when present" do
       it "merges 'message' into the original event when present" do
@@ -331,8 +331,8 @@ describe Agents::TriggerAgent do
 
 
         @checker.receive([@event])
         @checker.receive([@event])
 
 
-        @checker.most_recent_event.payload.should == @event.payload.merge(:message => "I saw '5' from Joe")
+        expect(@checker.most_recent_event.payload).to eq(@event.payload.merge(:message => "I saw '5' from Joe"))
       end
       end
     end
     end
   end
   end
-end
+end

+ 3 - 3
spec/models/agents/tumblr_publish_agent_spec.rb

@@ -30,9 +30,9 @@ describe Agents::TumblrPublishAgent do
   describe '#receive' do
   describe '#receive' do
     it 'should publish any payload it receives' do
     it 'should publish any payload it receives' do
       Agents::TumblrPublishAgent.async_receive(@checker.id, [@event.id])
       Agents::TumblrPublishAgent.async_receive(@checker.id, [@event.id])
-      @checker.events.count.should eq(1)
-      @checker.events.first.payload['post_id'].should eq('5')
-      @checker.events.first.payload['published_post'].should eq('[huginnbot.tumblr.com] text')
+      expect(@checker.events.count).to eq(1)
+      expect(@checker.events.first.payload['post_id']).to eq('5')
+      expect(@checker.events.first.payload['published_post']).to eq('[huginnbot.tumblr.com] text')
     end
     end
   end
   end
 end
 end

+ 13 - 13
spec/models/agents/twilio_agent_spec.rb

@@ -37,62 +37,62 @@ describe Agents::TwilioAgent do
       event2.save!
       event2.save!
 
 
       @checker.receive([@event,event1,event2])
       @checker.receive([@event,event1,event2])
-      @sent_messages.should == ['Looks like its going to rain','Some message','Some other message']
+      expect(@sent_messages).to eq(['Looks like its going to rain','Some message','Some other message'])
     end
     end
 
 
     it 'should check if receive_text is working fine' do
     it 'should check if receive_text is working fine' do
       @checker.options[:receive_text] = 'false'
       @checker.options[:receive_text] = 'false'
       @checker.receive([@event])
       @checker.receive([@event])
-      @sent_messages.should be_empty
+      expect(@sent_messages).to be_empty
     end
     end
 
 
     it 'should check if receive_call is working fine' do
     it 'should check if receive_call is working fine' do
       @checker.options[:receive_call] = 'true'
       @checker.options[:receive_call] = 'true'
       @checker.receive([@event])
       @checker.receive([@event])
-      @checker.memory[:pending_calls].should_not == {}
+      expect(@checker.memory[:pending_calls]).not_to eq({})
     end
     end
 
 
   end
   end
 
 
   describe '#working?' do
   describe '#working?' do
     it 'checks if events have been received within the expected receive period' do
     it 'checks if events have been received within the expected receive period' do
-      @checker.should_not be_working # No events received
+      expect(@checker).not_to be_working # No events received
       Agents::TwilioAgent.async_receive @checker.id, [@event.id]
       Agents::TwilioAgent.async_receive @checker.id, [@event.id]
-      @checker.reload.should be_working # Just received events
+      expect(@checker.reload).to be_working # Just received events
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      @checker.reload.should_not be_working # More time has passed than the expected receive period without any new events
+      expect(@checker.reload).not_to be_working # More time has passed than the expected receive period without any new events
     end
     end
   end
   end
 
 
   describe "validation" do
   describe "validation" do
     before do
     before do
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
 
 
     it "should validate presence of of account_sid" do
     it "should validate presence of of account_sid" do
       @checker.options[:account_sid] = ""
       @checker.options[:account_sid] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of auth_token" do
     it "should validate presence of auth_token" do
       @checker.options[:auth_token] = ""
       @checker.options[:auth_token] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of receiver_cell" do
     it "should validate presence of receiver_cell" do
       @checker.options[:receiver_cell] = ""
       @checker.options[:receiver_cell] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should validate presence of sender_cell" do
     it "should validate presence of sender_cell" do
       @checker.options[:sender_cell] = ""
       @checker.options[:sender_cell] = ""
-      @checker.should_not be_valid
+      expect(@checker).not_to be_valid
     end
     end
 
 
     it "should make sure filling sure filling server_url is not necessary" do
     it "should make sure filling sure filling server_url is not necessary" do
       @checker.options[:server_url] = ""
       @checker.options[:server_url] = ""
-      @checker.should be_valid
+      expect(@checker).to be_valid
     end
     end
   end
   end
-end
+end

+ 5 - 5
spec/models/agents/twitter_publish_agent_spec.rb

@@ -42,19 +42,19 @@ describe Agents::TwitterPublishAgent do
       event2.save!
       event2.save!
 
 
       Agents::TwitterPublishAgent.async_receive(@checker.id, [event1.id, event2.id])
       Agents::TwitterPublishAgent.async_receive(@checker.id, [event1.id, event2.id])
-      @sent_messages.count.should eq(2)
-      @checker.events.count.should eq(2)
+      expect(@sent_messages.count).to eq(2)
+      expect(@checker.events.count).to eq(2)
     end
     end
   end
   end
 
 
   describe '#working?' do
   describe '#working?' do
     it 'checks if events have been received within the expected receive period' do
     it 'checks if events have been received within the expected receive period' do
-      @checker.should_not be_working # No events received
+      expect(@checker).not_to be_working # No events received
       Agents::TwitterPublishAgent.async_receive(@checker.id, [@event.id])
       Agents::TwitterPublishAgent.async_receive(@checker.id, [@event.id])
-      @checker.reload.should be_working # Just received events
+      expect(@checker.reload).to be_working # Just received events
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      @checker.reload.should_not be_working # More time has passed than the expected receive period without any new events
+      expect(@checker.reload).not_to be_working # More time has passed than the expected receive period without any new events
     end
     end
   end
   end
 end
 end

+ 24 - 24
spec/models/agents/twitter_stream_agent_spec.rb

@@ -30,8 +30,8 @@ describe Agents::TwitterStreamAgent do
         @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
         @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
 
 
         @agent.reload
         @agent.reload
-        @agent.memory[:filter_counts][:keyword1].should == 2
-        @agent.memory[:filter_counts][:keyword2].should == 1
+        expect(@agent.memory[:filter_counts][:keyword1]).to eq(2)
+        expect(@agent.memory[:filter_counts][:keyword2]).to eq(1)
       end
       end
 
 
       it 'records counts for keyword sets as well' do
       it 'records counts for keyword sets as well' do
@@ -46,44 +46,44 @@ describe Agents::TwitterStreamAgent do
         @agent.process_tweet('keyword1-1', {:text => "something", :user => {:name => "Mr. Someone"}})
         @agent.process_tweet('keyword1-1', {:text => "something", :user => {:name => "Mr. Someone"}})
 
 
         @agent.reload
         @agent.reload
-        @agent.memory[:filter_counts][:'keyword1-1'].should == 4 # it stores on the first keyword
-        @agent.memory[:filter_counts][:keyword2].should == 2
+        expect(@agent.memory[:filter_counts][:'keyword1-1']).to eq(4) # it stores on the first keyword
+        expect(@agent.memory[:filter_counts][:keyword2]).to eq(2)
       end
       end
 
 
       it 'removes unused keys' do
       it 'removes unused keys' do
         @agent.memory[:filter_counts] = {:keyword1 => 2, :keyword2 => 3, :keyword3 => 4}
         @agent.memory[:filter_counts] = {:keyword1 => 2, :keyword2 => 3, :keyword3 => 4}
         @agent.save!
         @agent.save!
         @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
         @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
-        @agent.reload.memory[:filter_counts].should == { 'keyword1' => 3, 'keyword2' => 3 }
+        expect(@agent.reload.memory[:filter_counts]).to eq({ 'keyword1' => 3, 'keyword2' => 3 })
       end
       end
     end
     end
 
 
     context "when generate is set to 'events'" do
     context "when generate is set to 'events'" do
       it 'emits events immediately' do
       it 'emits events immediately' do
-        lambda {
+        expect {
           @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
           @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
-        }.should change { @agent.events.count }.by(1)
+        }.to change { @agent.events.count }.by(1)
 
 
-        @agent.events.last.payload.should == {
+        expect(@agent.events.last.payload).to eq({
           'filter' => 'keyword1',
           'filter' => 'keyword1',
           'text' => "something",
           'text' => "something",
           'user' => { 'name' => "Mr. Someone" }
           'user' => { 'name' => "Mr. Someone" }
-        }
+        })
       end
       end
 
 
       it 'handles keyword sets too' do
       it 'handles keyword sets too' do
         @agent.options[:filters][0] = %w[keyword1-1 keyword1-2 keyword1-3]
         @agent.options[:filters][0] = %w[keyword1-1 keyword1-2 keyword1-3]
         @agent.save!
         @agent.save!
 
 
-        lambda {
+        expect {
           @agent.process_tweet('keyword1-2', {:text => "something", :user => {:name => "Mr. Someone"}})
           @agent.process_tweet('keyword1-2', {:text => "something", :user => {:name => "Mr. Someone"}})
-        }.should change { @agent.events.count }.by(1)
+        }.to change { @agent.events.count }.by(1)
 
 
-        @agent.events.last.payload.should == {
+        expect(@agent.events.last.payload).to eq({
           'filter' => 'keyword1-1',
           'filter' => 'keyword1-1',
           'text' => "something",
           'text' => "something",
           'user' => { 'name' => "Mr. Someone" }
           'user' => { 'name' => "Mr. Someone" }
-        }
+        })
       end
       end
     end
     end
   end
   end
@@ -100,17 +100,17 @@ describe Agents::TwitterStreamAgent do
         @agent.process_tweet('keyword2', {:text => "something", :user => {:name => "Mr. Someone"}})
         @agent.process_tweet('keyword2', {:text => "something", :user => {:name => "Mr. Someone"}})
         @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
         @agent.process_tweet('keyword1', {:text => "something", :user => {:name => "Mr. Someone"}})
 
 
-        lambda {
+        expect {
           @agent.reload.check
           @agent.reload.check
-        }.should change { @agent.events.count }.by(2)
+        }.to change { @agent.events.count }.by(2)
 
 
-        @agent.events[-1].payload[:filter].should == 'keyword1'
-        @agent.events[-1].payload[:count].should == 2
+        expect(@agent.events[-1].payload[:filter]).to eq('keyword1')
+        expect(@agent.events[-1].payload[:count]).to eq(2)
 
 
-        @agent.events[-2].payload[:filter].should == 'keyword2'
-        @agent.events[-2].payload[:count].should == 1
+        expect(@agent.events[-2].payload[:filter]).to eq('keyword2')
+        expect(@agent.events[-2].payload[:count]).to eq(1)
 
 
-        @agent.memory[:filter_counts].should == {}
+        expect(@agent.memory[:filter_counts]).to eq({})
       end
       end
     end
     end
 
 
@@ -118,11 +118,11 @@ describe Agents::TwitterStreamAgent do
       it 'does nothing' do
       it 'does nothing' do
         @agent.memory[:filter_counts] = { :keyword1 => 2 }
         @agent.memory[:filter_counts] = { :keyword1 => 2 }
         @agent.save!
         @agent.save!
-        lambda {
+        expect {
           @agent.reload.check
           @agent.reload.check
-        }.should_not change { Event.count }
-        @agent.memory[:filter_counts].should == {}
+        }.not_to change { Event.count }
+        expect(@agent.memory[:filter_counts]).to eq({})
       end
       end
     end
     end
   end
   end
-end
+end

+ 2 - 2
spec/models/agents/twitter_user_agent_spec.rb

@@ -23,7 +23,7 @@ describe Agents::TwitterUserAgent do
 
 
   describe "#check" do
   describe "#check" do
     it "should check for changes" do
     it "should check for changes" do
-      lambda { @checker.check }.should change { Event.count }.by(5)
+      expect { @checker.check }.to change { Event.count }.by(5)
     end
     end
   end
   end
 
 
@@ -36,7 +36,7 @@ describe Agents::TwitterUserAgent do
       checker.user = users(:bob)
       checker.user = users(:bob)
       checker.save!
       checker.save!
 
 
-      lambda { checker.check }.should change { Event.count }.by(0)
+      expect { checker.check }.to change { Event.count }.by(0)
     end
     end
   end
   end
 
 

+ 13 - 13
spec/models/agents/user_location_agent_spec.rb

@@ -12,37 +12,37 @@ describe Agents::UserLocationAgent do
     event.created_at = Time.now
     event.created_at = Time.now
     event.payload = { 'longitude' => 123, 'latitude' => 45, 'something' => 'else' }
     event.payload = { 'longitude' => 123, 'latitude' => 45, 'something' => 'else' }
 
 
-    lambda {
+    expect {
       @agent.receive([event])
       @agent.receive([event])
-    }.should change { @agent.events.count }.by(1)
+    }.to change { @agent.events.count }.by(1)
 
 
-    @agent.events.last.payload.should == { 'longitude' => 123, 'latitude' => 45, 'something' => 'else' }
-    @agent.events.last.lat.should == 45
-    @agent.events.last.lng.should == 123
+    expect(@agent.events.last.payload).to eq({ 'longitude' => 123, 'latitude' => 45, 'something' => 'else' })
+    expect(@agent.events.last.lat).to eq(45)
+    expect(@agent.events.last.lng).to eq(123)
   end
   end
 
 
   it 'does not accept a web request that is not POST' do
   it 'does not accept a web request that is not POST' do
     %w[get put delete patch].each { |method|
     %w[get put delete patch].each { |method|
       content, status, content_type = @agent.receive_web_request({ 'secret' => 'my_secret' }, method, 'application/json')
       content, status, content_type = @agent.receive_web_request({ 'secret' => 'my_secret' }, method, 'application/json')
-      status.should == 404
+      expect(status).to eq(404)
     }
     }
   end
   end
 
 
   it 'requires a valid secret for a web request' do
   it 'requires a valid secret for a web request' do
     content, status, content_type = @agent.receive_web_request({ 'secret' => 'fake' }, 'post', 'application/json')
     content, status, content_type = @agent.receive_web_request({ 'secret' => 'fake' }, 'post', 'application/json')
-    status.should == 401
+    expect(status).to eq(401)
 
 
     content, status, content_type = @agent.receive_web_request({ 'secret' => 'my_secret' }, 'post', 'application/json')
     content, status, content_type = @agent.receive_web_request({ 'secret' => 'my_secret' }, 'post', 'application/json')
-    status.should == 200
+    expect(status).to eq(200)
   end
   end
 
 
   it 'creates an event on a web request' do
   it 'creates an event on a web request' do
-    lambda {
+    expect {
       @agent.receive_web_request({ 'secret' => 'my_secret', 'longitude' => 123, 'latitude' => 45, 'something' => 'else' }, 'post', 'application/json')
       @agent.receive_web_request({ 'secret' => 'my_secret', 'longitude' => 123, 'latitude' => 45, 'something' => 'else' }, 'post', 'application/json')
-    }.should change { @agent.events.count }.by(1)
+    }.to change { @agent.events.count }.by(1)
 
 
-    @agent.events.last.payload.should == { 'longitude' => 123, 'latitude' => 45, 'something' => 'else' }
-    @agent.events.last.lat.should == 45
-    @agent.events.last.lng.should == 123
+    expect(@agent.events.last.payload).to eq({ 'longitude' => 123, 'latitude' => 45, 'something' => 'else' })
+    expect(@agent.events.last.lat).to eq(45)
+    expect(@agent.events.last.lng).to eq(123)
   end
   end
 end
 end

+ 10 - 10
spec/models/agents/webhook_agent_spec.rb

@@ -13,27 +13,27 @@ describe Agents::WebhookAgent do
   describe 'receive_web_request' do
   describe 'receive_web_request' do
     it 'should create event if secret matches' do
     it 'should create event if secret matches' do
       out = nil
       out = nil
-      lambda {
+      expect {
         out = agent.receive_web_request({ 'secret' => 'foobar', 'payload' => payload }, "post", "text/html")
         out = agent.receive_web_request({ 'secret' => 'foobar', 'payload' => payload }, "post", "text/html")
-      }.should change { Event.count }.by(1)
-      out.should eq(['Event Created', 201])
-      Event.last.payload.should eq(payload)
+      }.to change { Event.count }.by(1)
+      expect(out).to eq(['Event Created', 201])
+      expect(Event.last.payload).to eq(payload)
     end
     end
 
 
     it 'should not create event if secrets dont match' do
     it 'should not create event if secrets dont match' do
       out = nil
       out = nil
-      lambda {
+      expect {
         out = agent.receive_web_request({ 'secret' => 'bazbat', 'payload' => payload }, "post", "text/html")
         out = agent.receive_web_request({ 'secret' => 'bazbat', 'payload' => payload }, "post", "text/html")
-      }.should change { Event.count }.by(0)
-      out.should eq(['Not Authorized', 401])
+      }.to change { Event.count }.by(0)
+      expect(out).to eq(['Not Authorized', 401])
     end
     end
 
 
     it "should only accept POSTs" do
     it "should only accept POSTs" do
       out = nil
       out = nil
-      lambda {
+      expect {
         out = agent.receive_web_request({ 'secret' => 'foobar', 'payload' => payload }, "get", "text/html")
         out = agent.receive_web_request({ 'secret' => 'foobar', 'payload' => payload }, "get", "text/html")
-      }.should change { Event.count }.by(0)
-      out.should eq(['Please use POST requests only', 401])
+      }.to change { Event.count }.by(0)
+      expect(out).to eq(['Please use POST requests only', 401])
     end
     end
   end
   end
 end
 end

+ 80 - 80
spec/models/agents/website_agent_spec.rb

@@ -29,71 +29,71 @@ describe Agents::WebsiteAgent do
 
 
     describe "validations" do
     describe "validations" do
       before do
       before do
-        @checker.should be_valid
+        expect(@checker).to be_valid
       end
       end
 
 
       it "should validate the integer fields" do
       it "should validate the integer fields" do
         @checker.options['expected_update_period_in_days'] = "2"
         @checker.options['expected_update_period_in_days'] = "2"
-        @checker.should be_valid
+        expect(@checker).to be_valid
 
 
         @checker.options['expected_update_period_in_days'] = "nonsense"
         @checker.options['expected_update_period_in_days'] = "nonsense"
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
       end
       end
 
 
       it "should validate uniqueness_look_back" do
       it "should validate uniqueness_look_back" do
         @checker.options['uniqueness_look_back'] = "nonsense"
         @checker.options['uniqueness_look_back'] = "nonsense"
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['uniqueness_look_back'] = "2"
         @checker.options['uniqueness_look_back'] = "2"
-        @checker.should be_valid
+        expect(@checker).to be_valid
       end
       end
 
 
       it "should validate mode" do
       it "should validate mode" do
         @checker.options['mode'] = "nonsense"
         @checker.options['mode'] = "nonsense"
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['mode'] = "on_change"
         @checker.options['mode'] = "on_change"
-        @checker.should be_valid
+        expect(@checker).to be_valid
 
 
         @checker.options['mode'] = "all"
         @checker.options['mode'] = "all"
-        @checker.should be_valid
+        expect(@checker).to be_valid
 
 
         @checker.options['mode'] = ""
         @checker.options['mode'] = ""
-        @checker.should be_valid
+        expect(@checker).to be_valid
       end
       end
 
 
       it "should validate the force_encoding option" do
       it "should validate the force_encoding option" do
         @checker.options['force_encoding'] = ''
         @checker.options['force_encoding'] = ''
-        @checker.should be_valid
+        expect(@checker).to be_valid
 
 
         @checker.options['force_encoding'] = 'UTF-8'
         @checker.options['force_encoding'] = 'UTF-8'
-        @checker.should be_valid
+        expect(@checker).to be_valid
 
 
         @checker.options['force_encoding'] = ['UTF-8']
         @checker.options['force_encoding'] = ['UTF-8']
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
 
 
         @checker.options['force_encoding'] = 'UTF-42'
         @checker.options['force_encoding'] = 'UTF-42'
-        @checker.should_not be_valid
+        expect(@checker).not_to be_valid
       end
       end
     end
     end
 
 
     describe "#check" do
     describe "#check" do
       it "should check for changes (and update Event.expires_at)" do
       it "should check for changes (and update Event.expires_at)" do
-        lambda { @checker.check }.should change { Event.count }.by(1)
+        expect { @checker.check }.to change { Event.count }.by(1)
         event = Event.last
         event = Event.last
         sleep 2
         sleep 2
-        lambda { @checker.check }.should_not change { Event.count }
+        expect { @checker.check }.not_to change { Event.count }
         update_event = Event.last
         update_event = Event.last
-        update_event.expires_at.should_not == event.expires_at
+        expect(update_event.expires_at).not_to eq(event.expires_at)
       end
       end
 
 
       it "should always save events when in :all mode" do
       it "should always save events when in :all mode" do
-        lambda {
+        expect {
           @valid_options['mode'] = 'all'
           @valid_options['mode'] = 'all'
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.check
           @checker.check
           @checker.check
           @checker.check
-        }.should change { Event.count }.by(2)
+        }.to change { Event.count }.by(2)
       end
       end
 
 
       it "should take uniqueness_look_back into account during deduplication" do
       it "should take uniqueness_look_back into account during deduplication" do
@@ -105,50 +105,50 @@ describe Agents::WebsiteAgent do
         event.payload = "{}"
         event.payload = "{}"
         event.save
         event.save
 
 
-        lambda {
+        expect {
           @valid_options['mode'] = 'on_change'
           @valid_options['mode'] = 'on_change'
           @valid_options['uniqueness_look_back'] = 2
           @valid_options['uniqueness_look_back'] = 2
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.check
           @checker.check
-        }.should_not change { Event.count }
+        }.not_to change { Event.count }
 
 
-        lambda {
+        expect {
           @valid_options['mode'] = 'on_change'
           @valid_options['mode'] = 'on_change'
           @valid_options['uniqueness_look_back'] = 1
           @valid_options['uniqueness_look_back'] = 1
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.check
           @checker.check
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
       end
       end
 
 
       it "should log an error if the number of results for a set of extraction patterns differs" do
       it "should log an error if the number of results for a set of extraction patterns differs" do
         @valid_options['extract']['url']['css'] = "div"
         @valid_options['extract']['url']['css'] = "div"
         @checker.options = @valid_options
         @checker.options = @valid_options
         @checker.check
         @checker.check
-        @checker.logs.first.message.should =~ /Got an uneven number of matches/
+        expect(@checker.logs.first.message).to match(/Got an uneven number of matches/)
       end
       end
 
 
       it "should accept an array for url" do
       it "should accept an array for url" do
         @valid_options['url'] = ["http://xkcd.com/1/", "http://xkcd.com/2/"]
         @valid_options['url'] = ["http://xkcd.com/1/", "http://xkcd.com/2/"]
         @checker.options = @valid_options
         @checker.options = @valid_options
-        lambda { @checker.save! }.should_not raise_error;
-        lambda { @checker.check }.should_not raise_error;
+        expect { @checker.save! }.not_to raise_error;
+        expect { @checker.check }.not_to raise_error;
       end
       end
 
 
       it "should parse events from all urls in array" do
       it "should parse events from all urls in array" do
-        lambda {
+        expect {
           @valid_options['url'] = ["http://xkcd.com/", "http://xkcd.com/"]
           @valid_options['url'] = ["http://xkcd.com/", "http://xkcd.com/"]
           @valid_options['mode'] = 'all'
           @valid_options['mode'] = 'all'
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.check
           @checker.check
-        }.should change { Event.count }.by(2)
+        }.to change { Event.count }.by(2)
       end
       end
 
 
       it "should follow unique rules when parsing array of urls" do
       it "should follow unique rules when parsing array of urls" do
-        lambda {
+        expect {
           @valid_options['url'] = ["http://xkcd.com/", "http://xkcd.com/"]
           @valid_options['url'] = ["http://xkcd.com/", "http://xkcd.com/"]
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.check
           @checker.check
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
       end
       end
     end
     end
 
 
@@ -177,7 +177,7 @@ describe Agents::WebsiteAgent do
 
 
         checker.check
         checker.check
         event = Event.last
         event = Event.last
-        event.payload['value'].should == huginn
+        expect(event.payload['value']).to eq(huginn)
       end
       end
 
 
       it 'should be overridden with force_encoding option' do
       it 'should be overridden with force_encoding option' do
@@ -204,7 +204,7 @@ describe Agents::WebsiteAgent do
 
 
         checker.check
         checker.check
         event = Event.last
         event = Event.last
-        event.payload['value'].should == huginn
+        expect(event.payload['value']).to eq(huginn)
       end
       end
     end
     end
 
 
@@ -213,20 +213,20 @@ describe Agents::WebsiteAgent do
         stubbed_time = Time.now
         stubbed_time = Time.now
         stub(Time).now { stubbed_time }
         stub(Time).now { stubbed_time }
 
 
-        @checker.should_not be_working # No events created
+        expect(@checker).not_to be_working # No events created
         @checker.check
         @checker.check
-        @checker.reload.should be_working # Just created events
+        expect(@checker.reload).to be_working # Just created events
 
 
         @checker.error "oh no!"
         @checker.error "oh no!"
-        @checker.reload.should_not be_working # There is a recent error
+        expect(@checker.reload).not_to be_working # There is a recent error
 
 
         stubbed_time = 20.minutes.from_now
         stubbed_time = 20.minutes.from_now
         @checker.events.delete_all
         @checker.events.delete_all
         @checker.check
         @checker.check
-        @checker.reload.should be_working # There is a newer event now
+        expect(@checker.reload).to be_working # There is a newer event now
 
 
         stubbed_time = 2.days.from_now
         stubbed_time = 2.days.from_now
-        @checker.reload.should_not be_working # Two days have passed without a new event having been created
+        expect(@checker.reload).not_to be_working # Two days have passed without a new event having been created
       end
       end
     end
     end
 
 
@@ -234,9 +234,9 @@ describe Agents::WebsiteAgent do
       it "parses CSS" do
       it "parses CSS" do
         @checker.check
         @checker.check
         event = Event.last
         event = Event.last
-        event.payload['url'].should == "http://imgs.xkcd.com/comics/evolving.png"
-        event.payload['title'].should == "Evolving"
-        event.payload['hovertext'].should =~ /^Biologists play reverse/
+        expect(event.payload['url']).to eq("http://imgs.xkcd.com/comics/evolving.png")
+        expect(event.payload['title']).to eq("Evolving")
+        expect(event.payload['hovertext']).to match(/^Biologists play reverse/)
       end
       end
 
 
       it "parses XPath" do
       it "parses XPath" do
@@ -247,9 +247,9 @@ describe Agents::WebsiteAgent do
         @checker.options = @valid_options
         @checker.options = @valid_options
         @checker.check
         @checker.check
         event = Event.last
         event = Event.last
-        event.payload['url'].should == "http://imgs.xkcd.com/comics/evolving.png"
-        event.payload['title'].should == "Evolving"
-        event.payload['hovertext'].should =~ /^Biologists play reverse/
+        expect(event.payload['url']).to eq("http://imgs.xkcd.com/comics/evolving.png")
+        expect(event.payload['title']).to eq("Evolving")
+        expect(event.payload['hovertext']).to match(/^Biologists play reverse/)
       end
       end
 
 
       it "should turn relative urls to absolute" do
       it "should turn relative urls to absolute" do
@@ -268,7 +268,7 @@ describe Agents::WebsiteAgent do
         rel.save!
         rel.save!
         rel.check
         rel.check
         event = Event.last
         event = Event.last
-        event.payload['url'].should == "http://xkcd.com/about"
+        expect(event.payload['url']).to eq("http://xkcd.com/about")
       end
       end
 
 
       it "should return an integer value if XPath evaluates to one" do
       it "should return an integer value if XPath evaluates to one" do
@@ -287,7 +287,7 @@ describe Agents::WebsiteAgent do
         rel.save!
         rel.save!
         rel.check
         rel.check
         event = Event.last
         event = Event.last
-        event.payload['num_links'].should == "9"
+        expect(event.payload['num_links']).to eq("9")
       end
       end
 
 
       it "should return all texts concatenated if XPath returns many text nodes" do
       it "should return all texts concatenated if XPath returns many text nodes" do
@@ -306,7 +306,7 @@ describe Agents::WebsiteAgent do
         rel.save!
         rel.save!
         rel.check
         rel.check
         event = Event.last
         event = Event.last
-        event.payload['slogan'].should == "A webcomic of romance, sarcasm, math, and language."
+        expect(event.payload['slogan']).to eq("A webcomic of romance, sarcasm, math, and language.")
       end
       end
 
 
       it "should interpolate _response_" do
       it "should interpolate _response_" do
@@ -317,7 +317,7 @@ describe Agents::WebsiteAgent do
         @checker.options = @valid_options
         @checker.options = @valid_options
         @checker.check
         @checker.check
         event = Event.last
         event = Event.last
-        event.payload['response_info'].should == 'The reponse was 200 OK.'
+        expect(event.payload['response_info']).to eq('The reponse was 200 OK.')
       end
       end
 
 
       describe "JSON" do
       describe "JSON" do
@@ -346,8 +346,8 @@ describe Agents::WebsiteAgent do
 
 
           checker.check
           checker.check
           event = Event.last
           event = Event.last
-          event.payload['version'].should == 2
-          event.payload['title'].should == "hello!"
+          expect(event.payload['version']).to eq(2)
+          expect(event.payload['title']).to eq("hello!")
         end
         end
 
 
         it "can handle arrays" do
         it "can handle arrays" do
@@ -375,17 +375,17 @@ describe Agents::WebsiteAgent do
           checker.user = users(:bob)
           checker.user = users(:bob)
           checker.save!
           checker.save!
 
 
-          lambda {
+          expect {
             checker.check
             checker.check
-          }.should change { Event.count }.by(2)
+          }.to change { Event.count }.by(2)
 
 
           event = Event.all[-1]
           event = Event.all[-1]
-          event.payload['version'].should == 2.5
-          event.payload['title'].should == "second"
+          expect(event.payload['version']).to eq(2.5)
+          expect(event.payload['title']).to eq("second")
 
 
           event = Event.all[-2]
           event = Event.all[-2]
-          event.payload['version'].should == 2
-          event.payload['title'].should == "first"
+          expect(event.payload['version']).to eq(2)
+          expect(event.payload['title']).to eq("first")
         end
         end
 
 
         it "stores the whole object if :extract is not specified" do
         it "stores the whole object if :extract is not specified" do
@@ -409,8 +409,8 @@ describe Agents::WebsiteAgent do
 
 
           checker.check
           checker.check
           event = Event.last
           event = Event.last
-          event.payload['response']['version'].should == 2
-          event.payload['response']['title'].should == "hello!"
+          expect(event.payload['response']['version']).to eq(2)
+          expect(event.payload['response']['title']).to eq("hello!")
         end
         end
       end
       end
 
 
@@ -442,27 +442,27 @@ fire: hot
             'property' => { 'regexp' => '^(?<word>.+?): (?<property>.+)$', index: 'property' },
             'property' => { 'regexp' => '^(?<word>.+?): (?<property>.+)$', index: 'property' },
           })
           })
 
 
-          lambda {
+          expect {
             @checker.check
             @checker.check
-          }.should change { Event.count }.by(2)
+          }.to change { Event.count }.by(2)
 
 
           event1, event2 = Event.last(2)
           event1, event2 = Event.last(2)
-          event1.payload['word'].should == 'water'
-          event1.payload['property'].should == 'wet'
-          event2.payload['word'].should == 'fire'
-          event2.payload['property'].should == 'hot'
+          expect(event1.payload['word']).to eq('water')
+          expect(event1.payload['property']).to eq('wet')
+          expect(event2.payload['word']).to eq('fire')
+          expect(event2.payload['property']).to eq('hot')
         end
         end
 
 
         it "works with regexp with named capture" do
         it "works with regexp with named capture" do
-          lambda {
+          expect {
             @checker.check
             @checker.check
-          }.should change { Event.count }.by(2)
+          }.to change { Event.count }.by(2)
 
 
           event1, event2 = Event.last(2)
           event1, event2 = Event.last(2)
-          event1.payload['word'].should == 'water'
-          event1.payload['property'].should == 'wet'
-          event2.payload['word'].should == 'fire'
-          event2.payload['property'].should == 'hot'
+          expect(event1.payload['word']).to eq('water')
+          expect(event1.payload['property']).to eq('wet')
+          expect(event2.payload['word']).to eq('fire')
+          expect(event2.payload['property']).to eq('hot')
         end
         end
       end
       end
     end
     end
@@ -478,14 +478,14 @@ fire: hot
       end
       end
 
 
       it "should scrape from the url element in incoming event payload" do
       it "should scrape from the url element in incoming event payload" do
-        lambda {
+        expect {
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.receive([@event])
           @checker.receive([@event])
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
       end
       end
 
 
       it "should interpolate values from incoming event payload" do
       it "should interpolate values from incoming event payload" do
-        lambda {
+        expect {
           @valid_options['extract'] = {
           @valid_options['extract'] = {
             'from' => {
             'from' => {
               'xpath' => '*[1]',
               'xpath' => '*[1]',
@@ -498,18 +498,18 @@ fire: hot
           }
           }
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.receive([@event])
           @checker.receive([@event])
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
 
 
-        Event.last.payload.should == {
+        expect(Event.last.payload).to eq({
           'from' => 'http://xkcd.com',
           'from' => 'http://xkcd.com',
           'to' => 'http://dynamic.xkcd.com/random/comic/',
           'to' => 'http://dynamic.xkcd.com/random/comic/',
-        }
+        })
       end
       end
 
 
       it "should interpolate values from incoming event payload and _response_" do
       it "should interpolate values from incoming event payload and _response_" do
         @event.payload['title'] = 'XKCD'
         @event.payload['title'] = 'XKCD'
 
 
-        lambda {
+        expect {
           @valid_options['extract'] = {
           @valid_options['extract'] = {
             'response_info' => @valid_options['extract']['url'].merge(
             'response_info' => @valid_options['extract']['url'].merge(
               'value' => '{% capture sentence %}The reponse from {{title}} was {{_response_.status}} {{_response_.headers.X-Status-Message}}.{% endcapture %}{{sentence | to_xpath}}'
               'value' => '{% capture sentence %}The reponse from {{title}} was {{_response_.status}} {{_response_.headers.X-Status-Message}}.{% endcapture %}{{sentence | to_xpath}}'
@@ -517,9 +517,9 @@ fire: hot
           }
           }
           @checker.options = @valid_options
           @checker.options = @valid_options
           @checker.receive([@event])
           @checker.receive([@event])
-        }.should change { Event.count }.by(1)
+        }.to change { Event.count }.by(1)
 
 
-        Event.last.payload['response_info'].should == 'The reponse from XKCD was 200 OK.'
+        expect(Event.last.payload['response_info']).to eq('The reponse from XKCD was 200 OK.')
       end
       end
     end
     end
   end
   end
@@ -549,8 +549,8 @@ fire: hot
 
 
     describe "#check" do
     describe "#check" do
       it "should check for changes" do
       it "should check for changes" do
-        lambda { @checker.check }.should change { Event.count }.by(1)
-        lambda { @checker.check }.should_not change { Event.count }
+        expect { @checker.check }.to change { Event.count }.by(1)
+        expect { @checker.check }.not_to change { Event.count }
       end
       end
     end
     end
   end
   end
@@ -578,7 +578,7 @@ fire: hot
 
 
     describe "#check" do
     describe "#check" do
       it "should check for changes" do
       it "should check for changes" do
-        lambda { @checker.check }.should change { Event.count }.by(1)
+        expect { @checker.check }.to change { Event.count }.by(1)
       end
       end
     end
     end
   end
   end

+ 9 - 9
spec/models/agents/weibo_publish_agent_spec.rb

@@ -38,8 +38,8 @@ describe Agents::WeiboPublishAgent do
       event2.save!
       event2.save!
 
 
       Agents::WeiboPublishAgent.async_receive(@checker.id, [event1.id, event2.id])
       Agents::WeiboPublishAgent.async_receive(@checker.id, [event1.id, event2.id])
-      @sent_messages.count.should eq(2)
-      @checker.events.count.should eq(2)
+      expect(@sent_messages.count).to eq(2)
+      expect(@checker.events.count).to eq(2)
     end
     end
   end
   end
 
 
@@ -51,20 +51,20 @@ describe Agents::WeiboPublishAgent do
       event.save!
       event.save!
 
 
       Agents::WeiboPublishAgent.async_receive(@checker.id, [event.id])
       Agents::WeiboPublishAgent.async_receive(@checker.id, [event.id])
-      @sent_messages.count.should eq(1)
-      @checker.events.count.should eq(1)
-      @sent_messages.first.include?("t.co").should_not be_truthy
+      expect(@sent_messages.count).to eq(1)
+      expect(@checker.events.count).to eq(1)
+      expect(@sent_messages.first.include?("t.co")).not_to be_truthy
     end
     end
   end
   end
 
 
   describe '#working?' do
   describe '#working?' do
     it 'checks if events have been received within the expected receive period' do
     it 'checks if events have been received within the expected receive period' do
-      @checker.should_not be_working # No events received
+      expect(@checker).not_to be_working # No events received
       Agents::WeiboPublishAgent.async_receive(@checker.id, [@event.id])
       Agents::WeiboPublishAgent.async_receive(@checker.id, [@event.id])
-      @checker.reload.should be_working # Just received events
+      expect(@checker.reload).to be_working # Just received events
       two_days_from_now = 2.days.from_now
       two_days_from_now = 2.days.from_now
       stub(Time).now { two_days_from_now }
       stub(Time).now { two_days_from_now }
-      @checker.reload.should_not be_working # More time has passed than the expected receive period without any new events
+      expect(@checker.reload).not_to be_working # More time has passed than the expected receive period without any new events
     end
     end
   end
   end
-end
+end

+ 2 - 2
spec/models/agents/weibo_user_agent_spec.rb

@@ -21,8 +21,8 @@ describe Agents::WeiboUserAgent do
 
 
   describe "#check" do
   describe "#check" do
     it "should check for changes" do
     it "should check for changes" do
-      lambda { @checker.check }.should change { Event.count }.by(1)
+      expect { @checker.check }.to change { Event.count }.by(1)
     end
     end
   end
   end
 
 
-end
+end

+ 3 - 3
spec/models/concerns/oauthable.rb

@@ -13,17 +13,17 @@ shared_examples_for Oauthable do
   end
   end
 
 
   it "should be oauthable" do
   it "should be oauthable" do
-    @agent.oauthable?.should == true
+    expect(@agent.oauthable?).to eq(true)
   end
   end
 
 
   describe "valid_services_for" do
   describe "valid_services_for" do
     it "should return all available services without specifying valid_oauth_providers" do
     it "should return all available services without specifying valid_oauth_providers" do
       @agent = Agents::OauthableTestAgent.new
       @agent = Agents::OauthableTestAgent.new
-      @agent.valid_services_for(users(:bob)).collect(&:id).sort.should == [services(:generic), services(:global)].collect(&:id).sort
+      expect(@agent.valid_services_for(users(:bob)).collect(&:id).sort).to eq([services(:generic), services(:global)].collect(&:id).sort)
     end
     end
 
 
     it "should filter the services based on the agent defaults" do
     it "should filter the services based on the agent defaults" do
-      @agent.valid_services_for(users(:bob)).to_a.should == Service.where(provider: @agent.valid_oauth_providers)
+      expect(@agent.valid_services_for(users(:bob)).to_a).to eq(Service.where(provider: @agent.valid_oauth_providers))
     end
     end
   end
   end
 end
 end

+ 51 - 51
spec/models/event_spec.rb

@@ -7,23 +7,23 @@ describe Event do
       event.lat = 2
       event.lat = 2
       event.lng = 3
       event.lng = 3
       event.save!
       event.save!
-      Event.with_location.pluck(:id).should == [event.id]
+      expect(Event.with_location.pluck(:id)).to eq([event.id])
 
 
       event.lat = nil
       event.lat = nil
       event.save!
       event.save!
-      Event.with_location.should be_empty
+      expect(Event.with_location).to be_empty
     end
     end
   end
   end
 
 
   describe "#location" do
   describe "#location" do
     it "returns a default hash when an event does not have a location" do
     it "returns a default hash when an event does not have a location" do
       event = events(:bob_website_agent_event)
       event = events(:bob_website_agent_event)
-      event.location.should == Location.new(
+      expect(event.location).to eq(Location.new(
         lat: nil,
         lat: nil,
         lng: nil,
         lng: nil,
         radius: 0.0,
         radius: 0.0,
         speed: nil,
         speed: nil,
-        course: nil)
+        course: nil))
     end
     end
 
 
     it "returns a hash containing location information" do
     it "returns a hash containing location information" do
@@ -36,12 +36,12 @@ describe Event do
         course: 90.0,
         course: 90.0,
       }
       }
       event.save!
       event.save!
-      event.location.should == Location.new(
+      expect(event.location).to eq(Location.new(
         lat: 2.0,
         lat: 2.0,
         lng: 3.0,
         lng: 3.0,
         radius: 0.0,
         radius: 0.0,
         speed: 0.5,
         speed: 0.5,
-        course: 90.0)
+        course: 90.0))
     end
     end
   end
   end
 
 
@@ -50,14 +50,14 @@ describe Event do
       events(:bob_website_agent_event).lat = 2
       events(:bob_website_agent_event).lat = 2
       events(:bob_website_agent_event).lng = 3
       events(:bob_website_agent_event).lng = 3
       events(:bob_website_agent_event).created_at = 2.weeks.ago
       events(:bob_website_agent_event).created_at = 2.weeks.ago
-      lambda {
+      expect {
         events(:bob_website_agent_event).reemit!
         events(:bob_website_agent_event).reemit!
-      }.should change { Event.count }.by(1)
-      Event.last.payload.should == events(:bob_website_agent_event).payload
-      Event.last.agent.should == events(:bob_website_agent_event).agent
-      Event.last.lat.should == 2
-      Event.last.lng.should == 3
-      Event.last.created_at.to_i.should be_within(2).of(Time.now.to_i)
+      }.to change { Event.count }.by(1)
+      expect(Event.last.payload).to eq(events(:bob_website_agent_event).payload)
+      expect(Event.last.agent).to eq(events(:bob_website_agent_event).agent)
+      expect(Event.last.lat).to eq(2)
+      expect(Event.last.lng).to eq(3)
+      expect(Event.last.created_at.to_i).to be_within(2).of(Time.now.to_i)
     end
     end
   end
   end
 
 
@@ -76,31 +76,31 @@ describe Event do
       stub(Time).now { current_time }
       stub(Time).now { current_time }
 
 
       Event.cleanup_expired!
       Event.cleanup_expired!
-      Event.find_by_id(half_hour_event.id).should_not be_nil
-      Event.find_by_id(one_hour_event.id).should_not be_nil
-      Event.find_by_id(two_hour_event.id).should_not be_nil
-      Event.find_by_id(three_hour_event.id).should_not be_nil
-      Event.find_by_id(non_expiring_event.id).should_not be_nil
-      agents(:bob_weather_agent).reload.events_count.should == initial_bob_count
-      agents(:jane_weather_agent).reload.events_count.should == initial_jane_count
+      expect(Event.find_by_id(half_hour_event.id)).not_to be_nil
+      expect(Event.find_by_id(one_hour_event.id)).not_to be_nil
+      expect(Event.find_by_id(two_hour_event.id)).not_to be_nil
+      expect(Event.find_by_id(three_hour_event.id)).not_to be_nil
+      expect(Event.find_by_id(non_expiring_event.id)).not_to be_nil
+      expect(agents(:bob_weather_agent).reload.events_count).to eq(initial_bob_count)
+      expect(agents(:jane_weather_agent).reload.events_count).to eq(initial_jane_count)
 
 
       current_time = 119.minutes.from_now # move almost 2 hours into the future
       current_time = 119.minutes.from_now # move almost 2 hours into the future
       Event.cleanup_expired!
       Event.cleanup_expired!
-      Event.find_by_id(half_hour_event.id).should be_nil
-      Event.find_by_id(one_hour_event.id).should be_nil
-      Event.find_by_id(two_hour_event.id).should_not be_nil
-      Event.find_by_id(three_hour_event.id).should_not be_nil
-      Event.find_by_id(non_expiring_event.id).should_not be_nil
-      agents(:bob_weather_agent).reload.events_count.should == initial_bob_count - 1
-      agents(:jane_weather_agent).reload.events_count.should == initial_jane_count - 1
+      expect(Event.find_by_id(half_hour_event.id)).to be_nil
+      expect(Event.find_by_id(one_hour_event.id)).to be_nil
+      expect(Event.find_by_id(two_hour_event.id)).not_to be_nil
+      expect(Event.find_by_id(three_hour_event.id)).not_to be_nil
+      expect(Event.find_by_id(non_expiring_event.id)).not_to be_nil
+      expect(agents(:bob_weather_agent).reload.events_count).to eq(initial_bob_count - 1)
+      expect(agents(:jane_weather_agent).reload.events_count).to eq(initial_jane_count - 1)
 
 
       current_time = 2.minutes.from_now # move 2 minutes further into the future
       current_time = 2.minutes.from_now # move 2 minutes further into the future
       Event.cleanup_expired!
       Event.cleanup_expired!
-      Event.find_by_id(two_hour_event.id).should be_nil
-      Event.find_by_id(three_hour_event.id).should_not be_nil
-      Event.find_by_id(non_expiring_event.id).should_not be_nil
-      agents(:bob_weather_agent).reload.events_count.should == initial_bob_count - 1
-      agents(:jane_weather_agent).reload.events_count.should == initial_jane_count - 2
+      expect(Event.find_by_id(two_hour_event.id)).to be_nil
+      expect(Event.find_by_id(three_hour_event.id)).not_to be_nil
+      expect(Event.find_by_id(non_expiring_event.id)).not_to be_nil
+      expect(agents(:bob_weather_agent).reload.events_count).to eq(initial_bob_count - 1)
+      expect(agents(:jane_weather_agent).reload.events_count).to eq(initial_jane_count - 2)
     end
     end
 
 
     it "doesn't touch Events with no expired_at" do
     it "doesn't touch Events with no expired_at" do
@@ -113,37 +113,37 @@ describe Event do
       stub(Time).now { current_time }
       stub(Time).now { current_time }
 
 
       Event.cleanup_expired!
       Event.cleanup_expired!
-      Event.find_by_id(event.id).should_not be_nil
+      expect(Event.find_by_id(event.id)).not_to be_nil
       current_time = 2.days.from_now
       current_time = 2.days.from_now
       Event.cleanup_expired!
       Event.cleanup_expired!
-      Event.find_by_id(event.id).should_not be_nil
+      expect(Event.find_by_id(event.id)).not_to be_nil
     end
     end
   end
   end
 
 
   describe "after destroy" do
   describe "after destroy" do
     it "nullifies any dependent AgentLogs" do
     it "nullifies any dependent AgentLogs" do
-      agent_logs(:log_for_jane_website_agent).outbound_event_id.should be_present
-      agent_logs(:log_for_bob_website_agent).outbound_event_id.should be_present
+      expect(agent_logs(:log_for_jane_website_agent).outbound_event_id).to be_present
+      expect(agent_logs(:log_for_bob_website_agent).outbound_event_id).to be_present
 
 
       agent_logs(:log_for_bob_website_agent).outbound_event.destroy
       agent_logs(:log_for_bob_website_agent).outbound_event.destroy
 
 
-      agent_logs(:log_for_jane_website_agent).reload.outbound_event_id.should be_present
-      agent_logs(:log_for_bob_website_agent).reload.outbound_event_id.should be_nil
+      expect(agent_logs(:log_for_jane_website_agent).reload.outbound_event_id).to be_present
+      expect(agent_logs(:log_for_bob_website_agent).reload.outbound_event_id).to be_nil
     end
     end
   end
   end
 
 
   describe "caches" do
   describe "caches" do
     describe "when an event is created" do
     describe "when an event is created" do
       it "updates a counter cache on agent" do
       it "updates a counter cache on agent" do
-        lambda {
+        expect {
           agents(:jane_weather_agent).events.create!(:user => users(:jane))
           agents(:jane_weather_agent).events.create!(:user => users(:jane))
-        }.should change { agents(:jane_weather_agent).reload.events_count }.by(1)
+        }.to change { agents(:jane_weather_agent).reload.events_count }.by(1)
       end
       end
 
 
       it "updates last_event_at on agent" do
       it "updates last_event_at on agent" do
-        lambda {
+        expect {
           agents(:jane_weather_agent).events.create!(:user => users(:jane))
           agents(:jane_weather_agent).events.create!(:user => users(:jane))
-        }.should change { agents(:jane_weather_agent).reload.last_event_at }
+        }.to change { agents(:jane_weather_agent).reload.last_event_at }
       end
       end
     end
     end
 
 
@@ -153,9 +153,9 @@ describe Event do
 
 
         agents(:jane_weather_agent).update_attribute :last_event_at, 2.days.ago
         agents(:jane_weather_agent).update_attribute :last_event_at, 2.days.ago
 
 
-        lambda {
+        expect {
           event.update_attribute :payload, { 'hello' => 'world' }
           event.update_attribute :payload, { 'hello' => 'world' }
-        }.should_not change { agents(:jane_weather_agent).reload.last_event_at }
+        }.not_to change { agents(:jane_weather_agent).reload.last_event_at }
       end
       end
     end
     end
   end
   end
@@ -180,12 +180,12 @@ describe EventDrop do
   end
   end
 
 
   it 'should be created via Agent#to_liquid' do
   it 'should be created via Agent#to_liquid' do
-    @event.to_liquid.class.should be(EventDrop)
+    expect(@event.to_liquid.class).to be(EventDrop)
   end
   end
 
 
   it 'should have attributes of its payload' do
   it 'should have attributes of its payload' do
     t = '{{title}}: {{url}}'
     t = '{{title}}: {{url}}'
-    interpolate(t, @event).should eq('some title: http://some.site.example.org/')
+    expect(interpolate(t, @event)).to eq('some title: http://some.site.example.org/')
   end
   end
 
 
   it 'should use created_at from the payload if it exists' do
   it 'should use created_at from the payload if it exists' do
@@ -194,27 +194,27 @@ describe EventDrop do
     @event.payload['created_at'] = created_at.strftime("%s")
     @event.payload['created_at'] = created_at.strftime("%s")
     @event.save!
     @event.save!
     t = '{{created_at | date:"%s" }}'
     t = '{{created_at | date:"%s" }}'
-    interpolate(t, @event).should eq(created_at.strftime("%s"))
+    expect(interpolate(t, @event)).to eq(created_at.strftime("%s"))
   end
   end
 
 
   it 'should be iteratable' do
   it 'should be iteratable' do
     # to_liquid returns self
     # to_liquid returns self
     t = "{% for pair in to_liquid %}{{pair | join:':' }}\n{% endfor %}"
     t = "{% for pair in to_liquid %}{{pair | join:':' }}\n{% endfor %}"
-    interpolate(t, @event).should eq("title:some title\nurl:http://some.site.example.org/\n")
+    expect(interpolate(t, @event)).to eq("title:some title\nurl:http://some.site.example.org/\n")
   end
   end
 
 
   it 'should have agent' do
   it 'should have agent' do
     t = '{{agent.name}}'
     t = '{{agent.name}}'
-    interpolate(t, @event).should eq('SF Weather')
+    expect(interpolate(t, @event)).to eq('SF Weather')
   end
   end
 
 
   it 'should have created_at' do
   it 'should have created_at' do
     t = '{{created_at | date:"%FT%T%z" }}'
     t = '{{created_at | date:"%FT%T%z" }}'
-    interpolate(t, @event).should eq(@event.created_at.strftime("%FT%T%z"))
+    expect(interpolate(t, @event)).to eq(@event.created_at.strftime("%FT%T%z"))
   end
   end
 
 
   it 'should have _location_' do
   it 'should have _location_' do
     t = '{{_location_.lat}},{{_location_.lng}}'
     t = '{{_location_.lat}},{{_location_.lng}}'
-    interpolate(t, @event).should eq("2.0,3.0")
+    expect(interpolate(t, @event)).to eq("2.0,3.0")
   end
   end
 end
 end

+ 127 - 127
spec/models/scenario_import_spec.rb

@@ -82,7 +82,7 @@ describe ScenarioImport do
 
 
   describe "initialization" do
   describe "initialization" do
     it "is initialized with an attributes hash" do
     it "is initialized with an attributes hash" do
-      ScenarioImport.new(:url => "http://google.com").url.should == "http://google.com"
+      expect(ScenarioImport.new(:url => "http://google.com").url).to eq("http://google.com")
     end
     end
   end
   end
 
 
@@ -94,79 +94,79 @@ describe ScenarioImport do
     end
     end
 
 
     it "is not valid when none of file, url, or data are present" do
     it "is not valid when none of file, url, or data are present" do
-      subject.should_not be_valid
-      subject.should have(1).error_on(:base)
-      subject.errors[:base].should include("Please provide either a Scenario JSON File or a Public Scenario URL.")
+      expect(subject).not_to be_valid
+      expect(subject).to have(1).error_on(:base)
+      expect(subject.errors[:base]).to include("Please provide either a Scenario JSON File or a Public Scenario URL.")
     end
     end
 
 
     describe "data" do
     describe "data" do
       it "should be invalid with invalid data" do
       it "should be invalid with invalid data" do
         subject.data = invalid_data
         subject.data = invalid_data
-        subject.should_not be_valid
-        subject.should have(1).error_on(:base)
+        expect(subject).not_to be_valid
+        expect(subject).to have(1).error_on(:base)
 
 
         subject.data = "foo"
         subject.data = "foo"
-        subject.should_not be_valid
-        subject.should have(1).error_on(:base)
+        expect(subject).not_to be_valid
+        expect(subject).to have(1).error_on(:base)
 
 
         # It also clears the data when invalid
         # It also clears the data when invalid
-        subject.data.should be_nil
+        expect(subject.data).to be_nil
       end
       end
 
 
       it "should be valid with valid data" do
       it "should be valid with valid data" do
         subject.data = valid_data
         subject.data = valid_data
-        subject.should be_valid
+        expect(subject).to be_valid
       end
       end
     end
     end
 
 
     describe "url" do
     describe "url" do
       it "should be invalid with an unreasonable URL" do
       it "should be invalid with an unreasonable URL" do
         subject.url = "foo"
         subject.url = "foo"
-        subject.should_not be_valid
-        subject.should have(1).error_on(:url)
-        subject.errors[:url].should include("appears to be invalid")
+        expect(subject).not_to be_valid
+        expect(subject).to have(1).error_on(:url)
+        expect(subject.errors[:url]).to include("appears to be invalid")
       end
       end
 
 
       it "should be invalid when the referenced url doesn't contain a scenario" do
       it "should be invalid when the referenced url doesn't contain a scenario" do
         stub_request(:get, "http://example.com/scenarios/1/export.json").to_return(:status => 200, :body => invalid_data)
         stub_request(:get, "http://example.com/scenarios/1/export.json").to_return(:status => 200, :body => invalid_data)
         subject.url = "http://example.com/scenarios/1/export.json"
         subject.url = "http://example.com/scenarios/1/export.json"
-        subject.should_not be_valid
-        subject.errors[:base].should include("The provided data does not appear to be a valid Scenario.")
+        expect(subject).not_to be_valid
+        expect(subject.errors[:base]).to include("The provided data does not appear to be a valid Scenario.")
       end
       end
 
 
       it "should be valid when the url points to a valid scenario" do
       it "should be valid when the url points to a valid scenario" do
         stub_request(:get, "http://example.com/scenarios/1/export.json").to_return(:status => 200, :body => valid_data)
         stub_request(:get, "http://example.com/scenarios/1/export.json").to_return(:status => 200, :body => valid_data)
         subject.url = "http://example.com/scenarios/1/export.json"
         subject.url = "http://example.com/scenarios/1/export.json"
-        subject.should be_valid
+        expect(subject).to be_valid
       end
       end
     end
     end
 
 
     describe "file" do
     describe "file" do
       it "should be invalid when the uploaded file doesn't contain a scenario" do
       it "should be invalid when the uploaded file doesn't contain a scenario" do
         subject.file = StringIO.new("foo")
         subject.file = StringIO.new("foo")
-        subject.should_not be_valid
-        subject.errors[:base].should include("The provided data does not appear to be a valid Scenario.")
+        expect(subject).not_to be_valid
+        expect(subject.errors[:base]).to include("The provided data does not appear to be a valid Scenario.")
 
 
         subject.file = StringIO.new(invalid_data)
         subject.file = StringIO.new(invalid_data)
-        subject.should_not be_valid
-        subject.errors[:base].should include("The provided data does not appear to be a valid Scenario.")
+        expect(subject).not_to be_valid
+        expect(subject.errors[:base]).to include("The provided data does not appear to be a valid Scenario.")
       end
       end
 
 
       it "should be valid with a valid uploaded scenario" do
       it "should be valid with a valid uploaded scenario" do
         subject.file = StringIO.new(valid_data)
         subject.file = StringIO.new(valid_data)
-        subject.should be_valid
+        expect(subject).to be_valid
       end
       end
     end
     end
   end
   end
 
 
   describe "#dangerous?" do
   describe "#dangerous?" do
     it "returns false on most Agents" do
     it "returns false on most Agents" do
-      ScenarioImport.new(:data => valid_data).should_not be_dangerous
+      expect(ScenarioImport.new(:data => valid_data)).not_to be_dangerous
     end
     end
 
 
     it "returns true if a ShellCommandAgent is present" do
     it "returns true if a ShellCommandAgent is present" do
       valid_parsed_data[:agents][0][:type] = "Agents::ShellCommandAgent"
       valid_parsed_data[:agents][0][:type] = "Agents::ShellCommandAgent"
-      ScenarioImport.new(:data => valid_parsed_data.to_json).should be_dangerous
+      expect(ScenarioImport.new(:data => valid_parsed_data.to_json)).to be_dangerous
     end
     end
   end
   end
 
 
@@ -180,57 +180,57 @@ describe ScenarioImport do
     context "when this scenario has never been seen before" do
     context "when this scenario has never been seen before" do
       describe "#import" do
       describe "#import" do
         it "makes a new scenario" do
         it "makes a new scenario" do
-          lambda {
+          expect {
             scenario_import.import(:skip_agents => true)
             scenario_import.import(:skip_agents => true)
-          }.should change { users(:bob).scenarios.count }.by(1)
-
-          scenario_import.scenario.name.should == name
-          scenario_import.scenario.description.should == description
-          scenario_import.scenario.guid.should == guid
-          scenario_import.scenario.tag_fg_color.should == tag_fg_color
-          scenario_import.scenario.tag_bg_color.should == tag_bg_color
-          scenario_import.scenario.source_url.should == source_url
-          scenario_import.scenario.public.should be_falsey
+          }.to change { users(:bob).scenarios.count }.by(1)
+
+          expect(scenario_import.scenario.name).to eq(name)
+          expect(scenario_import.scenario.description).to eq(description)
+          expect(scenario_import.scenario.guid).to eq(guid)
+          expect(scenario_import.scenario.tag_fg_color).to eq(tag_fg_color)
+          expect(scenario_import.scenario.tag_bg_color).to eq(tag_bg_color)
+          expect(scenario_import.scenario.source_url).to eq(source_url)
+          expect(scenario_import.scenario.public).to be_falsey
         end
         end
 
 
         it "creates the Agents" do
         it "creates the Agents" do
-          lambda {
+          expect {
             scenario_import.import
             scenario_import.import
-          }.should change { users(:bob).agents.count }.by(2)
+          }.to change { users(:bob).agents.count }.by(2)
 
 
           weather_agent = scenario_import.scenario.agents.find_by(:guid => "a-weather-agent")
           weather_agent = scenario_import.scenario.agents.find_by(:guid => "a-weather-agent")
           trigger_agent = scenario_import.scenario.agents.find_by(:guid => "a-trigger-agent")
           trigger_agent = scenario_import.scenario.agents.find_by(:guid => "a-trigger-agent")
 
 
-          weather_agent.name.should == "a weather agent"
-          weather_agent.schedule.should == "5pm"
-          weather_agent.keep_events_for.should == 14
-          weather_agent.propagate_immediately.should be_falsey
-          weather_agent.should be_disabled
-          weather_agent.memory.should be_empty
-          weather_agent.options.should == weather_agent_options
-
-          trigger_agent.name.should == "listen for weather"
-          trigger_agent.sources.should == [weather_agent]
-          trigger_agent.schedule.should be_nil
-          trigger_agent.keep_events_for.should == 0
-          trigger_agent.propagate_immediately.should be_truthy
-          trigger_agent.should_not be_disabled
-          trigger_agent.memory.should be_empty
-          trigger_agent.options.should == trigger_agent_options
+          expect(weather_agent.name).to eq("a weather agent")
+          expect(weather_agent.schedule).to eq("5pm")
+          expect(weather_agent.keep_events_for).to eq(14)
+          expect(weather_agent.propagate_immediately).to be_falsey
+          expect(weather_agent).to be_disabled
+          expect(weather_agent.memory).to be_empty
+          expect(weather_agent.options).to eq(weather_agent_options)
+
+          expect(trigger_agent.name).to eq("listen for weather")
+          expect(trigger_agent.sources).to eq([weather_agent])
+          expect(trigger_agent.schedule).to be_nil
+          expect(trigger_agent.keep_events_for).to eq(0)
+          expect(trigger_agent.propagate_immediately).to be_truthy
+          expect(trigger_agent).not_to be_disabled
+          expect(trigger_agent.memory).to be_empty
+          expect(trigger_agent.options).to eq(trigger_agent_options)
         end
         end
 
 
         it "creates new Agents, even if one already exists with the given guid (so that we don't overwrite a user's work outside of the scenario)" do
         it "creates new Agents, even if one already exists with the given guid (so that we don't overwrite a user's work outside of the scenario)" do
           agents(:bob_weather_agent).update_attribute :guid, "a-weather-agent"
           agents(:bob_weather_agent).update_attribute :guid, "a-weather-agent"
 
 
-          lambda {
+          expect {
             scenario_import.import
             scenario_import.import
-          }.should change { users(:bob).agents.count }.by(2)
+          }.to change { users(:bob).agents.count }.by(2)
         end
         end
       end
       end
 
 
       describe "#generate_diff" do
       describe "#generate_diff" do
         it "returns AgentDiff objects for the incoming Agents" do
         it "returns AgentDiff objects for the incoming Agents" do
-          scenario_import.should be_valid
+          expect(scenario_import).to be_valid
 
 
           agent_diffs = scenario_import.agent_diffs
           agent_diffs = scenario_import.agent_diffs
 
 
@@ -241,27 +241,27 @@ describe ScenarioImport do
             if key == :type
             if key == :type
               value = value.split("::").last
               value = value.split("::").last
             end
             end
-            weather_agent_diff.should respond_to(key)
+            expect(weather_agent_diff).to respond_to(key)
             field = weather_agent_diff.send(key)
             field = weather_agent_diff.send(key)
-            field.should be_a(ScenarioImport::AgentDiff::FieldDiff)
-            field.incoming.should == value
-            field.updated.should == value
-            field.current.should be_nil
+            expect(field).to be_a(ScenarioImport::AgentDiff::FieldDiff)
+            expect(field.incoming).to eq(value)
+            expect(field.updated).to eq(value)
+            expect(field.current).to be_nil
           end
           end
-          weather_agent_diff.should_not respond_to(:propagate_immediately)
+          expect(weather_agent_diff).not_to respond_to(:propagate_immediately)
 
 
           valid_parsed_trigger_agent_data.each do |key, value|
           valid_parsed_trigger_agent_data.each do |key, value|
             if key == :type
             if key == :type
               value = value.split("::").last
               value = value.split("::").last
             end
             end
-            trigger_agent_diff.should respond_to(key)
+            expect(trigger_agent_diff).to respond_to(key)
             field = trigger_agent_diff.send(key)
             field = trigger_agent_diff.send(key)
-            field.should be_a(ScenarioImport::AgentDiff::FieldDiff)
-            field.incoming.should == value
-            field.updated.should == value
-            field.current.should be_nil
+            expect(field).to be_a(ScenarioImport::AgentDiff::FieldDiff)
+            expect(field.incoming).to eq(value)
+            expect(field.updated).to eq(value)
+            expect(field.current).to be_nil
           end
           end
-          trigger_agent_diff.should_not respond_to(:schedule)
+          expect(trigger_agent_diff).not_to respond_to(:schedule)
         end
         end
       end
       end
     end
     end
@@ -280,49 +280,49 @@ describe ScenarioImport do
 
 
       describe "#import" do
       describe "#import" do
         it "uses the existing scenario, updating its data" do
         it "uses the existing scenario, updating its data" do
-          lambda {
+          expect {
             scenario_import.import(:skip_agents => true)
             scenario_import.import(:skip_agents => true)
-            scenario_import.scenario.should == existing_scenario
-          }.should_not change { users(:bob).scenarios.count }
+            expect(scenario_import.scenario).to eq(existing_scenario)
+          }.not_to change { users(:bob).scenarios.count }
 
 
           existing_scenario.reload
           existing_scenario.reload
-          existing_scenario.guid.should == guid
-          existing_scenario.tag_fg_color.should == tag_fg_color
-          existing_scenario.tag_bg_color.should == tag_bg_color
-          existing_scenario.description.should == description
-          existing_scenario.name.should == name
-          existing_scenario.source_url.should == source_url
-          existing_scenario.public.should be_falsey
+          expect(existing_scenario.guid).to eq(guid)
+          expect(existing_scenario.tag_fg_color).to eq(tag_fg_color)
+          expect(existing_scenario.tag_bg_color).to eq(tag_bg_color)
+          expect(existing_scenario.description).to eq(description)
+          expect(existing_scenario.name).to eq(name)
+          expect(existing_scenario.source_url).to eq(source_url)
+          expect(existing_scenario.public).to be_falsey
         end
         end
 
 
         it "updates any existing agents in the scenario, and makes new ones as needed" do
         it "updates any existing agents in the scenario, and makes new ones as needed" do
-          scenario_import.should be_valid
+          expect(scenario_import).to be_valid
 
 
-          lambda {
+          expect {
             scenario_import.import
             scenario_import.import
-          }.should change { users(:bob).agents.count }.by(1) # One, because the weather agent already existed.
+          }.to change { users(:bob).agents.count }.by(1) # One, because the weather agent already existed.
 
 
           weather_agent = existing_scenario.agents.find_by(:guid => "a-weather-agent")
           weather_agent = existing_scenario.agents.find_by(:guid => "a-weather-agent")
           trigger_agent = existing_scenario.agents.find_by(:guid => "a-trigger-agent")
           trigger_agent = existing_scenario.agents.find_by(:guid => "a-trigger-agent")
 
 
-          weather_agent.should == agents(:bob_weather_agent)
-
-          weather_agent.name.should == "a weather agent"
-          weather_agent.schedule.should == "5pm"
-          weather_agent.keep_events_for.should == 14
-          weather_agent.propagate_immediately.should be_falsey
-          weather_agent.should be_disabled
-          weather_agent.memory.should be_empty
-          weather_agent.options.should == weather_agent_options
-
-          trigger_agent.name.should == "listen for weather"
-          trigger_agent.sources.should == [weather_agent]
-          trigger_agent.schedule.should be_nil
-          trigger_agent.keep_events_for.should == 0
-          trigger_agent.propagate_immediately.should be_truthy
-          trigger_agent.should_not be_disabled
-          trigger_agent.memory.should be_empty
-          trigger_agent.options.should == trigger_agent_options
+          expect(weather_agent).to eq(agents(:bob_weather_agent))
+
+          expect(weather_agent.name).to eq("a weather agent")
+          expect(weather_agent.schedule).to eq("5pm")
+          expect(weather_agent.keep_events_for).to eq(14)
+          expect(weather_agent.propagate_immediately).to be_falsey
+          expect(weather_agent).to be_disabled
+          expect(weather_agent.memory).to be_empty
+          expect(weather_agent.options).to eq(weather_agent_options)
+
+          expect(trigger_agent.name).to eq("listen for weather")
+          expect(trigger_agent.sources).to eq([weather_agent])
+          expect(trigger_agent.schedule).to be_nil
+          expect(trigger_agent.keep_events_for).to eq(0)
+          expect(trigger_agent.propagate_immediately).to be_truthy
+          expect(trigger_agent).not_to be_disabled
+          expect(trigger_agent.memory).to be_empty
+          expect(trigger_agent.options).to eq(trigger_agent_options)
         end
         end
 
 
         it "honors updates coming from the UI" do
         it "honors updates coming from the UI" do
@@ -336,16 +336,16 @@ describe ScenarioImport do
             }
             }
           }
           }
 
 
-          scenario_import.should be_valid
+          expect(scenario_import).to be_valid
 
 
-          scenario_import.import.should be_truthy
+          expect(scenario_import.import).to be_truthy
 
 
           weather_agent = existing_scenario.agents.find_by(:guid => "a-weather-agent")
           weather_agent = existing_scenario.agents.find_by(:guid => "a-weather-agent")
-          weather_agent.name.should == "updated name"
-          weather_agent.schedule.should == "6pm"
-          weather_agent.keep_events_for.should == 2
-          weather_agent.should_not be_disabled
-          weather_agent.options.should == weather_agent_options.merge("api_key" => "foo")
+          expect(weather_agent.name).to eq("updated name")
+          expect(weather_agent.schedule).to eq("6pm")
+          expect(weather_agent.keep_events_for).to eq(2)
+          expect(weather_agent).not_to be_disabled
+          expect(weather_agent.options).to eq(weather_agent_options.merge("api_key" => "foo"))
         end
         end
 
 
         it "adds errors when updated agents are invalid" do
         it "adds errors when updated agents are invalid" do
@@ -358,12 +358,12 @@ describe ScenarioImport do
             }
             }
           }
           }
 
 
-          scenario_import.import.should be_falsey
+          expect(scenario_import.import).to be_falsey
 
 
           errors = scenario_import.errors.full_messages.to_sentence
           errors = scenario_import.errors.full_messages.to_sentence
-          errors.should =~ /Name can't be blank/
-          errors.should =~ /api_key is required/
-          errors.should =~ /Schedule is not a valid schedule/
+          expect(errors).to match(/Name can't be blank/)
+          expect(errors).to match(/api_key is required/)
+          expect(errors).to match(/Schedule is not a valid schedule/)
         end
         end
       end
       end
 
 
@@ -374,15 +374,15 @@ describe ScenarioImport do
           trigger_agent_diff = agent_diffs[1]
           trigger_agent_diff = agent_diffs[1]
 
 
           # Already exists
           # Already exists
-          weather_agent_diff.agent.should == agents(:bob_weather_agent)
+          expect(weather_agent_diff.agent).to eq(agents(:bob_weather_agent))
           valid_parsed_weather_agent_data.each do |key, value|
           valid_parsed_weather_agent_data.each do |key, value|
             next if key == :type
             next if key == :type
-            weather_agent_diff.send(key).current.should == agents(:bob_weather_agent).send(key)
+            expect(weather_agent_diff.send(key).current).to eq(agents(:bob_weather_agent).send(key))
           end
           end
 
 
           # Doesn't exist yet
           # Doesn't exist yet
           valid_parsed_trigger_agent_data.each do |key, value|
           valid_parsed_trigger_agent_data.each do |key, value|
-            trigger_agent_diff.send(key).current.should be_nil
+            expect(trigger_agent_diff.send(key).current).to be_nil
           end
           end
         end
         end
 
 
@@ -400,20 +400,20 @@ describe ScenarioImport do
             }
             }
           }
           }
 
 
-          scenario_import.should be_valid
+          expect(scenario_import).to be_valid
 
 
           agent_diffs = scenario_import.agent_diffs
           agent_diffs = scenario_import.agent_diffs
           weather_agent_diff = agent_diffs[0]
           weather_agent_diff = agent_diffs[0]
           trigger_agent_diff = agent_diffs[1]
           trigger_agent_diff = agent_diffs[1]
 
 
-          weather_agent_diff.name.current.should == agents(:bob_weather_agent).name
-          weather_agent_diff.name.incoming.should == valid_parsed_weather_agent_data[:name]
-          weather_agent_diff.name.updated.should == "a new name"
+          expect(weather_agent_diff.name.current).to eq(agents(:bob_weather_agent).name)
+          expect(weather_agent_diff.name.incoming).to eq(valid_parsed_weather_agent_data[:name])
+          expect(weather_agent_diff.name.updated).to eq("a new name")
 
 
-          weather_agent_diff.schedule.updated.should == "6pm"
-          weather_agent_diff.keep_events_for.updated.should == "2"
-          weather_agent_diff.disabled.updated.should == "true"
-          weather_agent_diff.options.updated.should == weather_agent_options.merge("api_key" => "foo")
+          expect(weather_agent_diff.schedule.updated).to eq("6pm")
+          expect(weather_agent_diff.keep_events_for.updated).to eq("2")
+          expect(weather_agent_diff.disabled.updated).to eq("true")
+          expect(weather_agent_diff.options.updated).to eq(weather_agent_options.merge("api_key" => "foo"))
         end
         end
 
 
         it "adds errors on validation when updated options are unparsable" do
         it "adds errors on validation when updated options are unparsable" do
@@ -422,8 +422,8 @@ describe ScenarioImport do
               "options" => '{'
               "options" => '{'
             }
             }
           }
           }
-          scenario_import.should_not be_valid
-          scenario_import.should have(1).error_on(:base)
+          expect(scenario_import).not_to be_valid
+          expect(scenario_import).to have(1).error_on(:base)
         end
         end
       end
       end
     end
     end
@@ -448,12 +448,12 @@ describe ScenarioImport do
         it "should check if the agent requires a service" do
         it "should check if the agent requires a service" do
           agent_diffs = services_scenario_import.agent_diffs
           agent_diffs = services_scenario_import.agent_diffs
           basecamp_agent_diff = agent_diffs[0]
           basecamp_agent_diff = agent_diffs[0]
-          basecamp_agent_diff.requires_service?.should == true
+          expect(basecamp_agent_diff.requires_service?).to eq(true)
         end
         end
 
 
         it "should add an error when no service is selected" do
         it "should add an error when no service is selected" do
-          services_scenario_import.import.should == false
-          services_scenario_import.errors[:base].length.should == 1
+          expect(services_scenario_import.import).to eq(false)
+          expect(services_scenario_import.errors[:base].length).to eq(1)
         end
         end
       end
       end
 
 
@@ -464,9 +464,9 @@ describe ScenarioImport do
               "service_id" => "0",
               "service_id" => "0",
             }
             }
           }
           }
-          lambda {
-            services_scenario_import.import.should == true
-          }.should change { users(:bob).agents.count }.by(2)
+          expect {
+            expect(services_scenario_import.import).to eq(true)
+          }.to change { users(:bob).agents.count }.by(2)
         end
         end
       end
       end
     end
     end

+ 15 - 15
spec/models/scenario_spec.rb

@@ -7,61 +7,61 @@ describe Scenario do
 
 
   describe "validations" do
   describe "validations" do
     before do
     before do
-      new_instance.should be_valid
+      expect(new_instance).to be_valid
     end
     end
 
 
     it "validates the presence of name" do
     it "validates the presence of name" do
       new_instance.name = ''
       new_instance.name = ''
-      new_instance.should_not be_valid
+      expect(new_instance).not_to be_valid
     end
     end
 
 
     it "validates the presence of user" do
     it "validates the presence of user" do
       new_instance.user = nil
       new_instance.user = nil
-      new_instance.should_not be_valid
+      expect(new_instance).not_to be_valid
     end
     end
 
 
     it "validates tag_fg_color is hex color" do
     it "validates tag_fg_color is hex color" do
       new_instance.tag_fg_color = '#N07H3X'
       new_instance.tag_fg_color = '#N07H3X'
-      new_instance.should_not be_valid
+      expect(new_instance).not_to be_valid
       new_instance.tag_fg_color = '#BADA55'
       new_instance.tag_fg_color = '#BADA55'
-      new_instance.should be_valid
+      expect(new_instance).to be_valid
     end
     end
 
 
     it "allows nil tag_fg_color" do
     it "allows nil tag_fg_color" do
       new_instance.tag_fg_color = nil
       new_instance.tag_fg_color = nil
-      new_instance.should be_valid
+      expect(new_instance).to be_valid
     end
     end
 
 
     it "validates tag_bg_color is hex color" do
     it "validates tag_bg_color is hex color" do
       new_instance.tag_bg_color = '#N07H3X'
       new_instance.tag_bg_color = '#N07H3X'
-      new_instance.should_not be_valid
+      expect(new_instance).not_to be_valid
       new_instance.tag_bg_color = '#BADA55'
       new_instance.tag_bg_color = '#BADA55'
-      new_instance.should be_valid
+      expect(new_instance).to be_valid
     end
     end
 
 
     it "allows nil tag_bg_color" do
     it "allows nil tag_bg_color" do
       new_instance.tag_bg_color = nil
       new_instance.tag_bg_color = nil
-      new_instance.should be_valid
+      expect(new_instance).to be_valid
     end
     end
 
 
     it "only allows Agents owned by user" do
     it "only allows Agents owned by user" do
       new_instance.agent_ids = [agents(:bob_website_agent).id]
       new_instance.agent_ids = [agents(:bob_website_agent).id]
-      new_instance.should be_valid
+      expect(new_instance).to be_valid
 
 
       new_instance.agent_ids = [agents(:jane_website_agent).id]
       new_instance.agent_ids = [agents(:jane_website_agent).id]
-      new_instance.should_not be_valid
+      expect(new_instance).not_to be_valid
     end
     end
   end
   end
 
 
   describe "counters" do
   describe "counters" do
     it "maintains a counter cache on user" do
     it "maintains a counter cache on user" do
-      lambda {
+      expect {
         new_instance.save!
         new_instance.save!
-      }.should change { users(:bob).reload.scenario_count }.by(1)
+      }.to change { users(:bob).reload.scenario_count }.by(1)
 
 
-      lambda {
+      expect {
         new_instance.destroy
         new_instance.destroy
-      }.should change { users(:bob).reload.scenario_count }.by(-1)
+      }.to change { users(:bob).reload.scenario_count }.by(-1)
     end
     end
   end
   end
 end
 end

+ 29 - 29
spec/models/service_spec.rb

@@ -8,11 +8,11 @@ describe Service do
   describe "#toggle_availability!" do
   describe "#toggle_availability!" do
     it "should toggle the global flag" do
     it "should toggle the global flag" do
       @service = services(:generic)
       @service = services(:generic)
-      @service.global.should == false
+      expect(@service.global).to eq(false)
       @service.toggle_availability!
       @service.toggle_availability!
-      @service.global.should == true
+      expect(@service.global).to eq(true)
       @service.toggle_availability!
       @service.toggle_availability!
-      @service.global.should == false
+      expect(@service.global).to eq(false)
     end
     end
 
 
     it "disconnects agents and disables them if the previously global service is made private again", focus: true do
     it "disconnects agents and disables them if the previously global service is made private again", focus: true do
@@ -21,15 +21,15 @@ describe Service do
 
 
       service = agent.service
       service = agent.service
       service.toggle_availability!
       service.toggle_availability!
-      service.agents.length.should == 2
+      expect(service.agents.length).to eq(2)
 
 
       service.toggle_availability!
       service.toggle_availability!
       jane_agent.reload
       jane_agent.reload
-      jane_agent.service_id.should be_nil
-      jane_agent.disabled.should be true
+      expect(jane_agent.service_id).to be_nil
+      expect(jane_agent.disabled).to be true
 
 
       service.reload
       service.reload
-      service.agents.length.should == 1
+      expect(service.agents.length).to eq(1)
     end
     end
   end
   end
 
 
@@ -38,8 +38,8 @@ describe Service do
     service = agent.service
     service = agent.service
     service.destroy
     service.destroy
     agent.reload
     agent.reload
-    agent.service_id.should be_nil
-    agent.disabled.should be true
+    expect(agent.service_id).to be_nil
+    expect(agent.disabled).to be true
   end
   end
 
 
   describe "preparing for a request" do
   describe "preparing for a request" do
@@ -49,18 +49,18 @@ describe Service do
 
 
     it "should not update the token if the token never expires" do
     it "should not update the token if the token never expires" do
       @service.expires_at = nil
       @service.expires_at = nil
-      @service.prepare_request.should == nil
+      expect(@service.prepare_request).to eq(nil)
     end
     end
 
 
     it "should not update the token if the token is still valid" do
     it "should not update the token if the token is still valid" do
       @service.expires_at = Time.now + 1.hour
       @service.expires_at = Time.now + 1.hour
-      @service.prepare_request.should == nil
+      expect(@service.prepare_request).to eq(nil)
     end
     end
 
 
     it "should call refresh_token! if the token expired" do
     it "should call refresh_token! if the token expired" do
       stub(@service).refresh_token! { @service }
       stub(@service).refresh_token! { @service }
       @service.expires_at = Time.now - 1.hour
       @service.expires_at = Time.now - 1.hour
-      @service.prepare_request.should == @service
+      expect(@service.prepare_request).to eq(@service)
     end
     end
   end
   end
 
 
@@ -71,7 +71,7 @@ describe Service do
 
 
     it "should return the correct endpoint" do
     it "should return the correct endpoint" do
       @service.provider = '37signals'
       @service.provider = '37signals'
-      @service.send(:endpoint).to_s.should == "https://launchpad.37signals.com/authorization/token"
+      expect(@service.send(:endpoint).to_s).to eq("https://launchpad.37signals.com/authorization/token")
     end
     end
 
 
     it "should update the token" do
     it "should update the token" do
@@ -80,7 +80,7 @@ describe Service do
       @service.provider = '37signals'
       @service.provider = '37signals'
       @service.refresh_token = 'refreshtokentest'
       @service.refresh_token = 'refreshtokentest'
       @service.refresh_token!
       @service.refresh_token!
-      @service.token.should == 'NEWTOKEN'
+      expect(@service.token).to eq('NEWTOKEN')
     end
     end
   end
   end
 
 
@@ -92,11 +92,11 @@ describe Service do
         service.save!
         service.save!
       }.to change { @user.services.count }.by(1)
       }.to change { @user.services.count }.by(1)
       service = @user.services.first
       service = @user.services.first
-      service.name.should == 'johnqpublic'
-      service.uid.should == '123456'
-      service.provider.should == 'twitter'
-      service.token.should == 'a1b2c3d4...'
-      service.secret.should == 'abcdef1234'
+      expect(service.name).to eq('johnqpublic')
+      expect(service.uid).to eq('123456')
+      expect(service.provider).to eq('twitter')
+      expect(service.token).to eq('a1b2c3d4...')
+      expect(service.secret).to eq('abcdef1234')
     end
     end
     it "should work with 37signals services" do
     it "should work with 37signals services" do
       signals = JSON.parse(File.read(Rails.root.join('spec/data_fixtures/services/37signals.json')))
       signals = JSON.parse(File.read(Rails.root.join('spec/data_fixtures/services/37signals.json')))
@@ -105,12 +105,12 @@ describe Service do
         service.save!
         service.save!
       }.to change { @user.services.count }.by(1)
       }.to change { @user.services.count }.by(1)
       service = @user.services.first
       service = @user.services.first
-      service.provider.should == '37signals'
-      service.name.should == 'Dominik Sander'
-      service.token.should == 'abcde'
-      service.uid.should == '12345'
-      service.refresh_token.should == 'fghrefresh'
-      service.options[:user_id].should == 12345
+      expect(service.provider).to eq('37signals')
+      expect(service.name).to eq('Dominik Sander')
+      expect(service.token).to eq('abcde')
+      expect(service.uid).to eq('12345')
+      expect(service.refresh_token).to eq('fghrefresh')
+      expect(service.options[:user_id]).to eq(12345)
       service.expires_at = Time.at(1401554352)
       service.expires_at = Time.at(1401554352)
     end
     end
     it "should work with github services" do
     it "should work with github services" do
@@ -120,10 +120,10 @@ describe Service do
         service.save!
         service.save!
       }.to change { @user.services.count }.by(1)
       }.to change { @user.services.count }.by(1)
       service = @user.services.first
       service = @user.services.first
-      service.provider.should == 'github'
-      service.name.should == 'dsander'
-      service.uid.should == '12345'
-      service.token.should == 'agithubtoken'
+      expect(service.provider).to eq('github')
+      expect(service.name).to eq('dsander')
+      expect(service.uid).to eq('12345')
+      expect(service.token).to eq('agithubtoken')
     end
     end
   end
   end
 end
 end

+ 9 - 9
spec/models/user_credential_spec.rb

@@ -2,18 +2,18 @@ require 'spec_helper'
 
 
 describe UserCredential do
 describe UserCredential do
   describe "validation" do
   describe "validation" do
-    it { should validate_uniqueness_of(:credential_name).scoped_to(:user_id) }
-    it { should validate_presence_of(:credential_name) }
-    it { should validate_presence_of(:credential_value) }
-    it { should validate_presence_of(:user_id) }
+    it { is_expected.to validate_uniqueness_of(:credential_name).scoped_to(:user_id) }
+    it { is_expected.to validate_presence_of(:credential_name) }
+    it { is_expected.to validate_presence_of(:credential_value) }
+    it { is_expected.to validate_presence_of(:user_id) }
   end
   end
 
 
   describe "mass assignment" do
   describe "mass assignment" do
-    it { should allow_mass_assignment_of :credential_name }
+    it { is_expected.to allow_mass_assignment_of :credential_name }
 
 
-    it { should allow_mass_assignment_of :credential_value }
+    it { is_expected.to allow_mass_assignment_of :credential_value }
 
 
-    it { should_not allow_mass_assignment_of :user_id }
+    it { is_expected.not_to allow_mass_assignment_of :user_id }
   end
   end
 
 
   describe "cleaning fields" do
   describe "cleaning fields" do
@@ -22,8 +22,8 @@ describe UserCredential do
       user_credential.credential_name = " new name "
       user_credential.credential_name = " new name "
       user_credential.credential_value = " new value "
       user_credential.credential_value = " new value "
       user_credential.save!
       user_credential.save!
-      user_credential.credential_name.should == "new name"
-      user_credential.credential_value.should == "new value"
+      expect(user_credential.credential_name).to eq("new name")
+      expect(user_credential.credential_value).to eq("new value")
     end
     end
   end
   end
 end
 end

+ 2 - 2
spec/models/users_spec.rb

@@ -5,13 +5,13 @@ describe User do
     describe "invitation_code" do
     describe "invitation_code" do
       it "only accepts valid invitation codes" do
       it "only accepts valid invitation codes" do
         User::INVITATION_CODES.each do |v|
         User::INVITATION_CODES.each do |v|
-          should allow_value(v).for(:invitation_code)
+          is_expected.to allow_value(v).for(:invitation_code)
         end
         end
       end
       end
 
 
       it "can reject invalid invitation codes" do
       it "can reject invalid invitation codes" do
         %w['foo', 'bar'].each do |v|
         %w['foo', 'bar'].each do |v|
-          should_not allow_value(v).for(:invitation_code)
+          is_expected.not_to allow_value(v).for(:invitation_code)
         end
         end
       end
       end
     end
     end

+ 8 - 8
spec/routing/webhooks_controller_spec.rb

@@ -1,23 +1,23 @@
 require 'spec_helper'
 require 'spec_helper'
 
 
-describe "routing for web requests" do
+describe "routing for web requests", :type => :routing do
   it "routes to handle_request" do
   it "routes to handle_request" do
     resulting_params = { :user_id => "6", :agent_id => "2", :secret => "foobar" }
     resulting_params = { :user_id => "6", :agent_id => "2", :secret => "foobar" }
-    get("/users/6/web_requests/2/foobar").should route_to("web_requests#handle_request", resulting_params)
-    post("/users/6/web_requests/2/foobar").should route_to("web_requests#handle_request", resulting_params)
-    put("/users/6/web_requests/2/foobar").should route_to("web_requests#handle_request", resulting_params)
-    delete("/users/6/web_requests/2/foobar").should route_to("web_requests#handle_request", resulting_params)
+    expect(get("/users/6/web_requests/2/foobar")).to route_to("web_requests#handle_request", resulting_params)
+    expect(post("/users/6/web_requests/2/foobar")).to route_to("web_requests#handle_request", resulting_params)
+    expect(put("/users/6/web_requests/2/foobar")).to route_to("web_requests#handle_request", resulting_params)
+    expect(delete("/users/6/web_requests/2/foobar")).to route_to("web_requests#handle_request", resulting_params)
   end
   end
 
 
   it "supports the legacy /webhooks/ route" do
   it "supports the legacy /webhooks/ route" do
-    post("/users/6/webhooks/2/foobar").should route_to("web_requests#handle_request", :user_id => "6", :agent_id => "2", :secret => "foobar")
+    expect(post("/users/6/webhooks/2/foobar")).to route_to("web_requests#handle_request", :user_id => "6", :agent_id => "2", :secret => "foobar")
   end
   end
 
 
   it "routes with format" do
   it "routes with format" do
-    get("/users/6/web_requests/2/foobar.json").should route_to("web_requests#handle_request",
+    expect(get("/users/6/web_requests/2/foobar.json")).to route_to("web_requests#handle_request",
                                                            { :user_id => "6", :agent_id => "2", :secret => "foobar", :format => "json" })
                                                            { :user_id => "6", :agent_id => "2", :secret => "foobar", :format => "json" })
 
 
-    get("/users/6/web_requests/2/foobar.atom").should route_to("web_requests#handle_request",
+    expect(get("/users/6/web_requests/2/foobar.atom")).to route_to("web_requests#handle_request",
                                                            { :user_id => "6", :agent_id => "2", :secret => "foobar", :format => "atom" })
                                                            { :user_id => "6", :agent_id => "2", :secret => "foobar", :format => "atom" })
   end
   end
 end
 end

+ 1 - 1
spec/spec_helper.rb

@@ -53,7 +53,7 @@ RSpec.configure do |config|
 
 
   config.render_views
   config.render_views
 
 
-  config.include Devise::TestHelpers, :type => :controller
+  config.include Devise::TestHelpers, type: :controller
   config.include SpecHelpers
   config.include SpecHelpers
   config.include Delorean
   config.include Delorean
 end
 end

+ 18 - 18
spec/support/shared_examples/email_concern.rb

@@ -16,73 +16,73 @@ shared_examples_for EmailConcern do
 
 
   describe "validations" do
   describe "validations" do
     it "should be valid" do
     it "should be valid" do
-      agent.should be_valid
+      expect(agent).to be_valid
     end
     end
 
 
     it "should validate the presence of 'subject'" do
     it "should validate the presence of 'subject'" do
       agent.options['subject'] = ''
       agent.options['subject'] = ''
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['subject'] = nil
       agent.options['subject'] = nil
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
 
 
     it "should validate the presence of 'expected_receive_period_in_days'" do
     it "should validate the presence of 'expected_receive_period_in_days'" do
       agent.options['expected_receive_period_in_days'] = ''
       agent.options['expected_receive_period_in_days'] = ''
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['expected_receive_period_in_days'] = nil
       agent.options['expected_receive_period_in_days'] = nil
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
 
 
     it "should validate that recipients, when provided, is one or more valid email addresses" do
     it "should validate that recipients, when provided, is one or more valid email addresses" do
       agent.options['recipients'] = ''
       agent.options['recipients'] = ''
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['recipients'] = nil
       agent.options['recipients'] = nil
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['recipients'] = 'bob@example.com'
       agent.options['recipients'] = 'bob@example.com'
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['recipients'] = ['bob@example.com']
       agent.options['recipients'] = ['bob@example.com']
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['recipients'] = ['bob@example.com', 'jane@example.com']
       agent.options['recipients'] = ['bob@example.com', 'jane@example.com']
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['recipients'] = ['bob@example.com', 'example.com']
       agent.options['recipients'] = ['bob@example.com', 'example.com']
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['recipients'] = ['hi!']
       agent.options['recipients'] = ['hi!']
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['recipients'] = { :foo => "bar" }
       agent.options['recipients'] = { :foo => "bar" }
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['recipients'] = "wut"
       agent.options['recipients'] = "wut"
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
   end
   end
 
 
   describe "#recipients" do
   describe "#recipients" do
     it "defaults to the user's email address" do
     it "defaults to the user's email address" do
-      agent.recipients.should == [users(:jane).email]
+      expect(agent.recipients).to eq([users(:jane).email])
     end
     end
 
 
     it "wraps a string with an array" do
     it "wraps a string with an array" do
       agent.options['recipients'] = 'bob@bob.com'
       agent.options['recipients'] = 'bob@bob.com'
-      agent.recipients.should == ['bob@bob.com']
+      expect(agent.recipients).to eq(['bob@bob.com'])
     end
     end
 
 
     it "handles an array" do
     it "handles an array" do
       agent.options['recipients'] = ['bob@bob.com', 'jane@jane.com']
       agent.options['recipients'] = ['bob@bob.com', 'jane@jane.com']
-      agent.recipients.should == ['bob@bob.com', 'jane@jane.com']
+      expect(agent.recipients).to eq(['bob@bob.com', 'jane@jane.com'])
     end
     end
 
 
     it "interpolates" do
     it "interpolates" do
       agent.options['recipients'] = "{{ username }}@{{ domain }}"
       agent.options['recipients'] = "{{ username }}@{{ domain }}"
-      agent.recipients('username' => 'bob', 'domain' => 'example.com').should == ["bob@example.com"]
+      expect(agent.recipients('username' => 'bob', 'domain' => 'example.com')).to eq(["bob@example.com"])
     end
     end
   end
   end
 end
 end

+ 3 - 3
spec/support/shared_examples/has_guid.rb

@@ -3,10 +3,10 @@ require 'spec_helper'
 shared_examples_for HasGuid do
 shared_examples_for HasGuid do
   it "gets created before_save, but only if it's not present" do
   it "gets created before_save, but only if it's not present" do
     instance = new_instance
     instance = new_instance
-    instance.guid.should be_nil
+    expect(instance.guid).to be_nil
     instance.save!
     instance.save!
-    instance.guid.should_not be_nil
+    expect(instance.guid).not_to be_nil
 
 
-    lambda { instance.save! }.should_not change { instance.reload.guid }
+    expect { instance.save! }.not_to change { instance.reload.guid }
   end
   end
 end
 end

+ 15 - 15
spec/support/shared_examples/liquid_interpolatable.rb

@@ -22,72 +22,72 @@ shared_examples_for LiquidInterpolatable do
 
 
   describe "interpolating liquid templates" do
   describe "interpolating liquid templates" do
     it "should work" do
     it "should work" do
-      @checker.interpolate_options(@checker.options, @event).should == {
+      expect(@checker.interpolate_options(@checker.options, @event)).to eq({
           "normal" => "just some normal text",
           "normal" => "just some normal text",
           "variable" => "hello",
           "variable" => "hello",
           "text" => "Some test with an embedded hello",
           "text" => "Some test with an embedded hello",
           "escape" => "This should be Hello+world"
           "escape" => "This should be Hello+world"
-      }
+      })
     end
     end
 
 
     it "should work with arrays", focus: true do
     it "should work with arrays", focus: true do
       @checker.options = {"value" => ["{{variable}}", "Much array", "Hey, {{hello_world}}"]}
       @checker.options = {"value" => ["{{variable}}", "Much array", "Hey, {{hello_world}}"]}
-      @checker.interpolate_options(@checker.options, @event).should == {
+      expect(@checker.interpolate_options(@checker.options, @event)).to eq({
         "value" => ["hello", "Much array", "Hey, Hello world"]
         "value" => ["hello", "Much array", "Hey, Hello world"]
-      }
+      })
     end
     end
 
 
     it "should work recursively" do
     it "should work recursively" do
       @checker.options['hash'] = {'recursive' => "{{variable}}"}
       @checker.options['hash'] = {'recursive' => "{{variable}}"}
       @checker.options['indifferent_hash'] = ActiveSupport::HashWithIndifferentAccess.new({'recursive' => "{{variable}}"})
       @checker.options['indifferent_hash'] = ActiveSupport::HashWithIndifferentAccess.new({'recursive' => "{{variable}}"})
-      @checker.interpolate_options(@checker.options, @event).should == {
+      expect(@checker.interpolate_options(@checker.options, @event)).to eq({
           "normal" => "just some normal text",
           "normal" => "just some normal text",
           "variable" => "hello",
           "variable" => "hello",
           "text" => "Some test with an embedded hello",
           "text" => "Some test with an embedded hello",
           "escape" => "This should be Hello+world",
           "escape" => "This should be Hello+world",
           "hash" => {'recursive' => 'hello'},
           "hash" => {'recursive' => 'hello'},
           "indifferent_hash" => {'recursive' => 'hello'},
           "indifferent_hash" => {'recursive' => 'hello'},
-      }
+      })
     end
     end
 
 
     it "should work for strings" do
     it "should work for strings" do
-      @checker.interpolate_string("{{variable}}", @event).should == "hello"
-      @checker.interpolate_string("{{variable}} you", @event).should == "hello you"
+      expect(@checker.interpolate_string("{{variable}}", @event)).to eq("hello")
+      expect(@checker.interpolate_string("{{variable}} you", @event)).to eq("hello you")
     end
     end
 
 
     it "should use local variables while in a block" do
     it "should use local variables while in a block" do
       @checker.options['locals'] = '{{_foo_}} {{_bar_}}'
       @checker.options['locals'] = '{{_foo_}} {{_bar_}}'
 
 
       @checker.interpolation_context.tap { |context|
       @checker.interpolation_context.tap { |context|
-        @checker.interpolated['locals'].should == ' '
+        expect(@checker.interpolated['locals']).to eq(' ')
 
 
         context.stack {
         context.stack {
           context['_foo_'] = 'This is'
           context['_foo_'] = 'This is'
           context['_bar_'] = 'great.'
           context['_bar_'] = 'great.'
 
 
-          @checker.interpolated['locals'].should == 'This is great.'
+          expect(@checker.interpolated['locals']).to eq('This is great.')
         }
         }
 
 
-        @checker.interpolated['locals'].should == ' '
+        expect(@checker.interpolated['locals']).to eq(' ')
       }
       }
     end
     end
 
 
     it "should use another self object while in a block" do
     it "should use another self object while in a block" do
       @checker.options['properties'] = '{{_foo_}} {{_bar_}}'
       @checker.options['properties'] = '{{_foo_}} {{_bar_}}'
 
 
-      @checker.interpolated['properties'].should == ' '
+      expect(@checker.interpolated['properties']).to eq(' ')
 
 
       @checker.interpolate_with({ '_foo_' => 'That was', '_bar_' => 'nice.' }) {
       @checker.interpolate_with({ '_foo_' => 'That was', '_bar_' => 'nice.' }) {
-        @checker.interpolated['properties'].should == 'That was nice.'
+        expect(@checker.interpolated['properties']).to eq('That was nice.')
       }
       }
 
 
-      @checker.interpolated['properties'].should == ' '
+      expect(@checker.interpolated['properties']).to eq(' ')
     end
     end
   end
   end
 
 
   describe "liquid tags" do
   describe "liquid tags" do
     it "should work with existing credentials" do
     it "should work with existing credentials" do
-      @checker.interpolate_string("{% credential aws_key %}", {}).should == '2222222222-jane'
+      expect(@checker.interpolate_string("{% credential aws_key %}", {})).to eq('2222222222-jane')
     end
     end
 
 
     it "should raise an exception for undefined credentials" do
     it "should raise an exception for undefined credentials" do

+ 19 - 19
spec/support/shared_examples/web_request_concern.rb

@@ -9,58 +9,58 @@ shared_examples_for WebRequestConcern do
 
 
   describe "validations" do
   describe "validations" do
     it "should be valid" do
     it "should be valid" do
-      agent.should be_valid
+      expect(agent).to be_valid
     end
     end
 
 
     it "should validate user_agent" do
     it "should validate user_agent" do
       agent.options['user_agent'] = nil
       agent.options['user_agent'] = nil
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['user_agent'] = ""
       agent.options['user_agent'] = ""
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['user_agent'] = "foo"
       agent.options['user_agent'] = "foo"
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['user_agent'] = ["foo"]
       agent.options['user_agent'] = ["foo"]
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['user_agent'] = 1
       agent.options['user_agent'] = 1
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
 
 
     it "should validate headers" do
     it "should validate headers" do
       agent.options['headers'] = "blah"
       agent.options['headers'] = "blah"
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['headers'] = ""
       agent.options['headers'] = ""
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['headers'] = {}
       agent.options['headers'] = {}
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['headers'] = { 'foo' => 'bar' }
       agent.options['headers'] = { 'foo' => 'bar' }
-      agent.should be_valid
+      expect(agent).to be_valid
     end
     end
 
 
     it "should validate basic_auth" do
     it "should validate basic_auth" do
       agent.options['basic_auth'] = "foo:bar"
       agent.options['basic_auth'] = "foo:bar"
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['basic_auth'] = ["foo", "bar"]
       agent.options['basic_auth'] = ["foo", "bar"]
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['basic_auth'] = ""
       agent.options['basic_auth'] = ""
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['basic_auth'] = nil
       agent.options['basic_auth'] = nil
-      agent.should be_valid
+      expect(agent).to be_valid
 
 
       agent.options['basic_auth'] = "blah"
       agent.options['basic_auth'] = "blah"
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
 
 
       agent.options['basic_auth'] = ["blah"]
       agent.options['basic_auth'] = ["blah"]
-      agent.should_not be_valid
+      expect(agent).not_to be_valid
     end
     end
   end
   end
 
 
@@ -75,17 +75,17 @@ shared_examples_for WebRequestConcern do
     end
     end
 
 
     it "should have the default value set by Faraday" do
     it "should have the default value set by Faraday" do
-      agent.user_agent.should == Faraday.new.headers[:user_agent]
+      expect(agent.user_agent).to eq(Faraday.new.headers[:user_agent])
     end
     end
 
 
     it "should be overridden by the environment variable if present" do
     it "should be overridden by the environment variable if present" do
       ENV['DEFAULT_HTTP_USER_AGENT'] = 'Huginn - https://github.com/cantino/huginn'
       ENV['DEFAULT_HTTP_USER_AGENT'] = 'Huginn - https://github.com/cantino/huginn'
-      agent.user_agent.should == 'Huginn - https://github.com/cantino/huginn'
+      expect(agent.user_agent).to eq('Huginn - https://github.com/cantino/huginn')
     end
     end
 
 
     it "should be overriden by the value in options if present" do
     it "should be overriden by the value in options if present" do
       agent.options['user_agent'] = 'Override'
       agent.options['user_agent'] = 'Override'
-      agent.user_agent.should == 'Override'
+      expect(agent.user_agent).to eq('Override')
     end
     end
   end
   end
 end
 end

+ 9 - 9
spec/support/shared_examples/working_helpers.rb

@@ -7,23 +7,23 @@ shared_examples_for WorkingHelpers do
 
 
       agent.last_error_log_at = 10.minutes.ago
       agent.last_error_log_at = 10.minutes.ago
       agent.last_event_at = 10.minutes.ago
       agent.last_event_at = 10.minutes.ago
-      agent.recent_error_logs?.should be_truthy
+      expect(agent.recent_error_logs?).to be_truthy
 
 
       agent.last_error_log_at = 11.minutes.ago
       agent.last_error_log_at = 11.minutes.ago
       agent.last_event_at = 10.minutes.ago
       agent.last_event_at = 10.minutes.ago
-      agent.recent_error_logs?.should be_truthy
+      expect(agent.recent_error_logs?).to be_truthy
 
 
       agent.last_error_log_at = 5.minutes.ago
       agent.last_error_log_at = 5.minutes.ago
       agent.last_event_at = 10.minutes.ago
       agent.last_event_at = 10.minutes.ago
-      agent.recent_error_logs?.should be_truthy
+      expect(agent.recent_error_logs?).to be_truthy
 
 
       agent.last_error_log_at = 15.minutes.ago
       agent.last_error_log_at = 15.minutes.ago
       agent.last_event_at = 10.minutes.ago
       agent.last_event_at = 10.minutes.ago
-      agent.recent_error_logs?.should be_falsey
+      expect(agent.recent_error_logs?).to be_falsey
 
 
       agent.last_error_log_at = 2.days.ago
       agent.last_error_log_at = 2.days.ago
       agent.last_event_at = 10.minutes.ago
       agent.last_event_at = 10.minutes.ago
-      agent.recent_error_logs?.should be_falsey
+      expect(agent.recent_error_logs?).to be_falsey
     end
     end
   end
   end
 
 
@@ -33,21 +33,21 @@ shared_examples_for WorkingHelpers do
     end
     end
 
 
     it "should return false until the first event was received" do
     it "should return false until the first event was received" do
-      @agent.received_event_without_error?.should == false
+      expect(@agent.received_event_without_error?).to eq(false)
       @agent.last_receive_at = Time.now
       @agent.last_receive_at = Time.now
-      @agent.received_event_without_error?.should == true
+      expect(@agent.received_event_without_error?).to eq(true)
     end
     end
 
 
     it "should return false when the last error occured after the last received event" do
     it "should return false when the last error occured after the last received event" do
       @agent.last_receive_at = Time.now - 1.minute
       @agent.last_receive_at = Time.now - 1.minute
       @agent.last_error_log_at = Time.now
       @agent.last_error_log_at = Time.now
-      @agent.received_event_without_error?.should == false
+      expect(@agent.received_event_without_error?).to eq(false)
     end
     end
 
 
     it "should return true when the last received event occured after the last error" do
     it "should return true when the last received event occured after the last error" do
       @agent.last_receive_at = Time.now
       @agent.last_receive_at = Time.now
       @agent.last_error_log_at = Time.now - 1.minute
       @agent.last_error_log_at = Time.now - 1.minute
-      @agent.received_event_without_error?.should == true
+      expect(@agent.received_event_without_error?).to eq(true)
     end
     end
   end
   end
 end
 end