diff --git a/lib/vero/config.rb b/lib/vero/config.rb index c8d447f..bc9ff3c 100644 --- a/lib/vero/config.rb +++ b/lib/vero/config.rb @@ -1,10 +1,12 @@ # frozen_string_literal: true class Vero::Config + attr_writer :development_mode # Deprecated field + attr_writer :domain - attr_accessor :tracking_api_key, :development_mode, :async, :disabled, :logging + attr_accessor :tracking_api_key, :async, :disabled, :logging - ACCEPTED_ATTRIBUTES = %i[tracking_api_key development_mode async disabled logging domain] + ACCEPTED_ATTRIBUTES = %i[tracking_api_key async disabled logging domain] def initialize reset! @@ -15,10 +17,7 @@ def config_params end def request_params - { - tracking_api_key: tracking_api_key, - development_mode: development_mode - }.compact + {tracking_api_key: tracking_api_key}.compact end def domain @@ -40,7 +39,6 @@ def disable_requests! def reset! self.disabled = false - self.development_mode = false self.async = true self.logging = false self.tracking_api_key = nil diff --git a/spec/lib/api_spec.rb b/spec/lib/api_spec.rb index c6fa93a..55112ff 100644 --- a/spec/lib/api_spec.rb +++ b/spec/lib/api_spec.rb @@ -8,12 +8,11 @@ describe :track! do it "should call the TrackAPI object via the configured sender" do input = {event_name: "test_event", identity: {email: "james@getvero.com"}, data: {test: "test"}} - expected = input.merge(tracking_api_key: "abc123", development_mode: true) + expected = input.merge(tracking_api_key: "abc123") mock_context = Vero::Context.new allow(mock_context.config).to receive(:configured?).and_return(true) allow(mock_context.config).to receive(:tracking_api_key).and_return("abc123") - allow(mock_context.config).to receive(:development_mode).and_return(true) allow(Vero::App).to receive(:default_context).and_return(mock_context) @@ -27,12 +26,11 @@ describe Vero::Api::Users do let(:subject) { Vero::Api::Users } let(:mock_context) { Vero::Context.new } - let(:expected) { input.merge(tracking_api_key: "abc123", development_mode: true) } + let(:expected) { input.merge(tracking_api_key: "abc123") } before :each do allow(mock_context.config).to receive(:configured?).and_return(true) allow(mock_context.config).to receive(:tracking_api_key).and_return("abc123") - allow(mock_context.config).to receive(:development_mode).and_return(true) allow(Vero::App).to receive(:default_context).and_return(mock_context) end diff --git a/spec/lib/config_spec.rb b/spec/lib/config_spec.rb index 9f03e35..90ff8cc 100644 --- a/spec/lib/config_spec.rb +++ b/spec/lib/config_spec.rb @@ -33,14 +33,10 @@ describe :request_params do it "should return a hash of tracking_api_key and development_mode if they are set" do config.tracking_api_key = nil - config.development_mode = nil expect(config.request_params).to eq({}) config.tracking_api_key = "abcd1234" expect(config.request_params).to eq({tracking_api_key: "abcd1234"}) - - config.development_mode = true - expect(config.request_params).to eq({tracking_api_key: "abcd1234", development_mode: true}) end end @@ -60,33 +56,6 @@ end end - describe :development_mode do - it "by default it should return false regardless of Rails environment" do - stub_env("development") do - config = Vero::Config.new - expect(config.development_mode).to be(false) - end - - stub_env("test") do - config = Vero::Config.new - expect(config.development_mode).to be(false) - end - - stub_env("production") do - config = Vero::Config.new - expect(config.development_mode).to be(false) - end - end - - it "can be overritten with the config block" do - config.development_mode = true - expect(config.request_params[:development_mode]).to be(true) - - config.reset! - expect(config.request_params[:development_mode]).to be(false) - end - end - describe :test_mode do it "should not raise error even though not configured properly" do input = {event_name: "test_event"} diff --git a/spec/lib/trackable_spec.rb b/spec/lib/trackable_spec.rb index 52cec12..5f03f26 100644 --- a/spec/lib/trackable_spec.rb +++ b/spec/lib/trackable_spec.rb @@ -18,8 +18,7 @@ def vero_context(user, logging = true, async = false, disabled = true) event_name: "test_event", tracking_api_key: "YWJjZDEyMzQ6ZWZnaDU2Nzg=", identity: {email: "user@getvero.com", age: 20, _user_type: "User"}, - data: {test: 1}, - development_mode: true + data: {test: 1} } @url = "https://api.getvero.com/api/v1/track.json" @user = User.new @@ -311,8 +310,7 @@ def vero_context(user, logging = true, async = false, disabled = true) event_name: "test_event", tracking_api_key: "YWJjZDEyMzQ6ZWZnaDU2Nzg=", identity: {email: "user@getvero.com", age: 20, _user_type: "UserWithoutInterface"}, - data: {test: 1}, - development_mode: true + data: {test: 1} } context = Vero::Context.new(Vero::App.default_context) diff --git a/spec/lib/view_helpers_spec.rb b/spec/lib/view_helpers_spec.rb index d0a9f4b..4df18c9 100644 --- a/spec/lib/view_helpers_spec.rb +++ b/spec/lib/view_helpers_spec.rb @@ -30,11 +30,9 @@ context "Vero::App has been properly configured" do before :each do @tracking_api_key = "abcd1234" - @api_dev_mode = false Vero::App.init do |c| c.tracking_api_key = @tracking_api_key - c.development_mode = @api_dev_mode end end