File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class Service::Smartling < Service
1515
1616 def receive_push
1717 check_config
18- if data [ "master_only" ] == false || payload [ "ref" ] == "refs/heads/master"
18+ if data [ "master_only" ] == nil || data [ "master_only" ] == false || payload [ "ref" ] == "refs/heads/master"
1919 payload [ "projectId" ] = data [ "project_id" ]
2020 payload [ "apiKey" ] = data [ "api_key" ]
2121 payload [ "resourceFile" ] = data [ "config_path" ]
@@ -36,4 +36,4 @@ def check_config
3636 raise_config_error "Missing path to the project configuration" if data [ "config_path" ] . to_s . empty?
3737 end
3838
39- end
39+ end
Original file line number Diff line number Diff line change @@ -62,6 +62,29 @@ def test_requires_master_only_no_branch
6262 @stubs . verify_stubbed_calls
6363 end
6464
65+ def test_requires_master_only_nil_master
66+ data = self . data . update ( "master_only" => nil )
67+ @stubs . post "/github" do |env |
68+ assert_equal "capi.smatling.com" , env [ :url ] . host
69+ [ 200 , { } , '' ]
70+ end
71+ svc = service :push , data , payload
72+ svc . receive
73+ @stubs . verify_stubbed_calls
74+ end
75+
76+ def test_requires_master_only_nil_branch
77+ data = self . data . update ( "master_only" => nil )
78+ payload = self . payload . update ( "ref" => "refs/heads/branch_name" )
79+ @stubs . post "/github" do |env |
80+ assert_equal "capi.smatling.com" , env [ :url ] . host
81+ [ 200 , { } , '' ]
82+ end
83+ svc = service :push , data , payload
84+ svc . receive
85+ @stubs . verify_stubbed_calls
86+ end
87+
6588 def test_requires_master_only_yes_master
6689 data = self . data . update ( "master_only" => true )
6790 @stubs . post "/github" do |env |
@@ -133,4 +156,4 @@ def data
133156 def service ( *args )
134157 super Service ::Smartling , *args
135158 end
136- end
159+ end
You can’t perform that action at this time.
0 commit comments