sinatra-switch 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sinatra/switch.rb +4 -0
- data/sinatra-switch.gemspec +1 -1
- data/test/switch_test.rb +4 -0
- metadata +2 -2
data/lib/sinatra/switch.rb
CHANGED
@@ -28,10 +28,14 @@ module Sinatra
|
|
28
28
|
|
29
29
|
post "/switch/#{app_name}/on" do
|
30
30
|
File.open(file, 'w') {|f| f.write(on_message) }
|
31
|
+
status 200
|
32
|
+
"#{app_name} set to #{on_message}..."
|
31
33
|
end
|
32
34
|
|
33
35
|
post "/switch/#{app_name}/off" do
|
34
36
|
File.open(file, 'w') {|f| f.write(off_message) }
|
37
|
+
status 200
|
38
|
+
"#{app_name} set to #{off_message}..."
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
data/sinatra-switch.gemspec
CHANGED
data/test/switch_test.rb
CHANGED
@@ -41,6 +41,8 @@ class SinatraSwitchTest < Test::Unit::TestCase
|
|
41
41
|
|
42
42
|
def test_it_can_be_set_to_off
|
43
43
|
@session.post "/switch/light/off"
|
44
|
+
assert_equal @session.last_response.status, 200
|
45
|
+
|
44
46
|
@session.get "/switch/light"
|
45
47
|
assert_equal @session.last_response.status, 400
|
46
48
|
assert_include @session.last_response.body, "light is OFF"
|
@@ -49,6 +51,8 @@ class SinatraSwitchTest < Test::Unit::TestCase
|
|
49
51
|
def test_it_can_be_set_to_on
|
50
52
|
@session.post "/switch/light/off"
|
51
53
|
@session.post "/switch/light/on"
|
54
|
+
assert_equal @session.last_response.status, 200
|
55
|
+
|
52
56
|
@session.get "/switch/light"
|
53
57
|
assert_equal @session.last_response.status, 200
|
54
58
|
assert_include @session.last_response.body, "light is ON"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-switch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -52,7 +52,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
segments:
|
54
54
|
- 0
|
55
|
-
hash:
|
55
|
+
hash: 2074841067721576988
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|